端口转发
模拟环境:
本地win11开启web服务模拟内网机器,kali模拟已经拿到shell的linux靶机。
需求:将内网win11的服务转发到公网上,让攻击者能够直接访问
服务端设置 (放vps运行)
1 2 3 4 5 6 7 8 9 10 11
| [common] bind_port = 10000 dashboard_port = 10050 dashboard_user = admin dashboard_pwd = admin enable_prometheus = true vhost_http_port = 8087 #http服务要在服务端设置
log_file = ./log/frps.log log_level = info log_max_days = 3
|
客户端设置 (在kali中运行)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [common] server_addr = vpsIP server_port = 10000
user = k4
[web] type = http use_compression = true local_ip = 10.254.2.55 custom_domains = vpsIP local_port = 8087 remote_port = 8087
log_file = ./log/frpc.log log_level = debug
|
能够拿到win的shell,太危险辣,没事就别挂本机的,小心学习资料暴露(狗头)

frp使用
1 2 3 4 5
| #后台运行frp后台 ./frps -c frps.ini >/dev/null 2>&1 & #启动 ps -aux|grep frp| grep -v grep #关闭(杀进程) root 3600 0.1 0.1 110188 9484 pts/0 Sl 15:04 0:00 ./frpc -c ./frpc.ini kill -9 3600
|
还可以配合利用systemctl来控制启动
内网穿透
上面实例只是将本地的单个端口转发到了公网上,但是渗透环境中需要将内网环境带出来。这样子就需要搭建一个反向代理:代理服务器接收internet的请求,然后将请求转发给内部网络的服务器,并将从内网服务器返回的结果返回给internet上请求连接的客户端

FRP
Frp服务端
1 2 3 4 5 6 7 8 9
| [common] Bind_addr = 0.0.0.0 bind_port = 7000
dashboard_port = 7500 dashboard_user = admin dashboard_pwd = admin allow_ports = 40000-50000
|
Frp客户端
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [common] server_addr = vpsIP server_port = 7000 tls_enable = ture pool_count = 5
[socks5] type = tcp remote_port = 46075 plugin = socks5 plugin_user = admin plugin_passwd = admin use_encryption = true use_compression = true
|

Proxifier
设置好代理后即可访问


Frp部分参数
1 2 3 4 5 6 7 8 9 10 11 12 13
| Bind_addr = 0.0.0.0 #服务端监听地址 默认0.0.0.0 bind_port = 7000 #服务端监听端口 dashboard_port = 7500 #状态以及代理统计信息展示,vpsip:7500可查看详情 dashboard_user = admin #访问用户 dashboard_pwd = password # dashboard_pwd访问密码 log_file = ./frps.log #log_file日志文件
log_level = info # log_level记录的日志级别 log_max_days = 3 # log_max_days日志留存3天 authentication_timeout = 0 #authentication_timeout超时时间 max_pool_count最大链接池,每个代理预先与后端服务器建立起指定数量的最大链接数 max_pool_count = 50 allow_ports = 40000-50000 #允许代理绑定的服务端端口
|
参考