因为学习和渗透需要,需要一款能进行内网端口映射以及sock5代理的一款软件来进行进一步的渗透测试在网上浏览了一下发现有多种内网穿透工具比如:frp,ngrok,ew等。但有都有各自的缺点,所以找着找着又找到一款软件,它既有sock5代理又能进行内网穿透,并且还有web前端界面可以快捷的进行映射管理也可以随时删除映射而不用去客户端上在配置,大大的减少了麻烦,nice!I want you!
1.服务器安装(centos7)
github传送门
wget https://github.com/cnlh/nps/releases/download/v0.23.2/linux_amd64_server.tar.gz
tar -zxvf linux_amd64_server.tar.gz
cd nps/conf/
vim nps.conf
在配置文件这里需要改一些配置,因为我本身就已经安装了nginx服务器所以会和现有的配置冲突,并且我本身并不打算用域名解析nps(主要是域名太长了懒得打2333),所以需要修改配置文件
appname = nps
#Boot mode(dev|pro)
runmode = dev
#HTTP(S) proxy port, no startup if empty
#http_proxy_ip=0.0.0.0 #不需要代理注释掉
#http_proxy_port=80 #不需要代理注释掉
#https_proxy_port=443 #不需要代理注释掉
#https_just_proxy=true #不需要代理注释掉
#default https certificate setting
#https_default_cert_file=conf/server.pem #不需要https注释掉
#https_default_key_file=conf/server.key #不需要https注释掉
##bridge
bridge_type=tcp
bridge_port=8024 //这个端口是你需要作为与服务器连接的端口选择自己需要的端口即可
bridge_ip=0.0.0.0
# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=123 #公钥自己设置个就行
#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1
# log level LevelEmergency->0 LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
log_path=nps.log
#Whether to restrict IP access, true or false or ignore
#ip_limit=true
#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000
#web
#web_host=a.o.com #不需要域名解析注释掉
web_username=admin #web面板的账号
web_password=123 #web面板的密码
web_port = 8080 #web面板的端口
web_ip=0.0.0.0
#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
auth_key=test
auth_crypt_key =1234567812345678
下面的配置就不用动了,保存退出
cd ../
./nps start
这样服务器就启动了,但对于在阿里云上的Centos来说防火墙还需要设置下以iptables为例
vim /etc/sysconfig/iptables
添加如下规则,比如端口段为8000-8100(因为之后的端口映射还需要占用段口,所以建议直接开放一定数量的端口段)
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8000:8100 -j ACCEPT
保存退出,并重启iptables服务
systemctl restart iptables
这时访问http://公网ip:8024应该就能看到登录界面了
先在添加客户端,点新增,推荐写一下备注,并启用加密,压缩
然后记住现在新增的客户端id等下要用,因为没填秘钥,所以会自动生成一个随机的秘钥!
然后添加tcp隧道,比如我要将内网主机的3389映射到8001端口上
保存即可
2.客户端配置
同样的我们下载客户端文件npc.exe
打开CMD
npc.exe -server=公网ip:连接端口(8024) -vkey=随机秘钥
出现下图就说明已经完成了
sock5代理也是可以配置的,并且经过实际测试发现npc比ew和frp更加的隐蔽,嘿嘿。。