/ proxy_scout.py
proxy_scout.py
 1  import socket
 2  import os
 3  
 4  # Common internal proxy ports
 5  PORTS = [3128, 8080, 1080, 8888]
 6  
 7  def scan_subnet():
 8      # Detect local subnet
 9      cmd = "hostname -I | cut -d' ' -f1 | cut -d. -f1-3"
10      subnet = os.popen(cmd).read().strip()
11      
12      print(f"[*] [SCOUT] Scanning subnet {subnet}.0/24 for new chain links...")
13      
14      for i in range(1, 255):
15          target = f"{subnet}.{i}"
16          for port in PORTS:
17              with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
18                  s.settimeout(0.01)
19                  if s.connect_ex((target, port)) == 0:
20                      print(f"[+] [SCOUT] Proxy found: {target}:{port}")
21                      append_to_chain(target, port)
22  
23  def append_to_chain(ip, port):
24      with open("proxychains.conf", "a") as f:
25          f.write(f"socks5 {ip} {port}\n")
26  
27  if __name__ == "__main__":
28      scan_subnet()