社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

一个用 Python 编写的 SOCKS 代理,可以随机化你的源 IP 地址

Ots安全 • 5 天前 • 20 次点击  

TREVORproxy SSH 代理演示

TREVORproxy 子网代理演示

常见用例

  • WAF绕过

  • 密码喷洒

  • 网页抓取

工作原理

TREVORproxy 有两种操作模式:子网代理SSH 代理

  • 子网代理模式使用Linux 内核的AnyIP功能为您的网络接口分配整个子网,并为每个连接提供来自该子网的随机源 IP 地址。

  • 例如,如果您的云提供商为您提供了IPv6 范围,您可以从超过十八千万亿(18,446,744,073,709,551,616)个唯一 IP 地址/64发送流量。

  • SSH 代理模式iptables与 SSH 的 SOCKS 代理功能 ( ssh -D) 相结合,通过远程系统(云虚拟机等)循环数据包

注意:TREVORproxy 并非 DoS 攻击工具,因为它不会“欺骗”数据包。它是一个功能齐全的 SOCKS 代理,这意味着它被设计用于接收返回流量。

示例 #1 - 从 IPv6 子网内的随机地址发送流量

  • 注意:在subnet模式下,trevorproxy必须以 root 身份运行

  • 注意:这必须是一个合法的子网,例如,您的云提供商分配给您的 IPv6 范围。

# Start TREVORproxy
$ sudo trevorproxy subnet -s dead:beef::0/64 -i eth0
[DEBUG] ip route add local dead:beef::0/64 dev eth0
[INFO] Listening on socks5://127.0.0.1:1080

#
 Test SOCKS proxy
# Note that each request has a different source IP address
$ curl --proxy socks5://127.0.0.1:1080 -6 api64.ipify.org
dead:beef::74d0:b1be:3166:c934
$ curl --proxy socks5://127.0.0.1:1080 -6 api64.ipify.org
dead:beef::4927:1b4:8e5f:d44d
$ curl --proxy socks5://127.0.0.1:1080 -6 api64.ipify.org
dead:beef::2bb8:7b79:706e:cb7d
$ curl --proxy socks5://127.0.0.1:1080 -6 api64.ipify.org
dead:beef::7e13:abe3:dc24:5a00

示例 #2 - 通过 SSH 隧道发送流量


# Configure proxychains
cat /etc/proxychains. conf
...
socks5 127.0.0.11080
...

# Start TREVORproxy
$ trevorproxy ssh root@1.2.3.4 root@4.3.2.1
[DEBUG] Opening SSH connection to root@1.2.3.4
[DEBUG] /usr/bin/ssh root@1.2.3.4 -D 32482 -o StrictHostKeychecking=no
[DEBUG] Opening SSH connection to root@4.3.2.1
[DEBUG] /usr/bin/ssh root@4.3.2.1 -D 32483 -o StrictHostKeychecking=no
[DEBUG] Waiting for /usr/bin/ssh root@1.2.3.4 -D 32482 -o StrictHostKeychecking=no
[DEBUG] Waiting for /usr/bin/ssh root@4.3.2.1 -D 32483 -o StrictHostKeychecking=no
[DEBUG] Creating iptables rules
[DEBUG] iptables -A OUTPUT -t nat -d 127.0.0.1 -o lo -p tcp --dport 1080 -j DNAT --to-destination 127.0.0.1:32482 -m statistic --mode nth --every 2 --packet 0
[DEBUG] iptables -A OUTPUT -t nat -d 127.0.0.1 -olo -p tcp --dport 1080 -j DNAT --to-destination 127.0.0.1:32483
[INFO] Listening on socks5://127.0.0.1:1080

# Test SOCKS proxy
$ proxychains curl ifconfig.me
1.2.3.4
$ proxychains curl ifconfig.me
4.3.2.1
$ proxychains curl ifconfig.me
1.2.3.4
$ proxychains curl ifconfig.me
4.3.2.1

CLI 使用





    
$ trevorproxy --help
usage: trevorproxy [-h] [-p PORT] [-l LISTEN_ADDRESS] [-q] [-v] {interface,ssh} ...

Round-robin requests through multiple SSH tunnels via a single SOCKS server

positional arguments:
  {interface,ssh} proxy type
    interface send traffic from local interface
    ssh send traffic through SSH hosts

optional arguments:
  -h, --help            show this help message andexit
  -p PORT, --port PORT Port for SOCKS server to listen on (default:1080)
  -l LISTEN_ADDRESS, --listen-address LISTEN_ADDRESS
                        Listen address for SOCKS server (default:127.0.0.1)
  -q, --quiet Be quiet
  -v, -d, --verbose, --debug
                        Be verbose

CLI 使用 - 子网代理


$ trevorproxy subnet --help
usage: trevorproxy subnet [-h] [-i INTERFACE] [-s SUBNET]

optional arguments:
  -h, --help            show this help message and  exit
  -i INTERFACE, --interface INTERFACE
                        Interface to send packets on
  -s SUBNET, --subnet SUBNET
                        Subnet to send packets from

CLI 使用 - SSH 代理


$ trevorproxy ssh --help
usage: trevorproxy ssh [-h] [-k KEY] [--base-port BASE_PORT] ssh_hosts [ssh_hosts ...]

positional arguments:
  ssh_hosts Round-robin load-balance through these SSH hosts (user@host)

optional arguments:
  -h, --help show this help message and exit
  -k KEY--key KEY Use this SSH key when connecting to proxy hosts
  --base-port BASE_PORT
                        Base listening port to use for SOCKS proxies (default32482)


项目地址:

https://github.com/blacklanternsecurity/TREVORproxy


请参阅随附的博客文章,了解有趣的咆哮和一些很酷的演示!

https://github.com/blacklanternsecurity/TREVORspray/blob/trevorspray-v2/blogpost.md

感谢您抽出

.

.

来阅读本文

点它,分享点赞在看都在这里

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/183052
 
20 次点击