Anorov / PySocks

A SOCKS proxy client and wrapper for Python.
Other
1.23k stars 259 forks source link

Socks5 proxy for udp not comply with rfc1928? #155

Open Humburto opened 3 years ago

Humburto commented 3 years ago

This is my simple script with PySocks:

import socks
import socket
s = socks.socksocket(socket.AF_INET, socket.SOCK_DGRAM)
s.set_proxy(socks.SOCKS5, "127.0.0.1", 9922) 
s.connect(("10.0.21.2", 20000))
s.sendall("HELLO".encode('utf-8'))
print(s.recv(4096))

As rfc1928 says, each UDP datagram must carries a UDP request header with it (on page 7). However, my socks5 server only received "HELLO" without any header. Is this some kind of bug of PySocks ? Or is there something wrong with my code?

lilanleo commented 2 years ago

try s.set_proxy(socket.SOCK_DGRAM, address, port)instead