SOCKS is an Internet protocol that exchanges network packets between a client and server through a proxy server. SOCKS5 optionally provides authentication so only authorized users may access a server. Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded.
SOCKS5/Sokets5,可通過它的去間接的通路網絡,相當于一個中轉站。一般的代理協定比如Http代理都是工作在應用層的,效率比較低。而Socks代理協定提供一種通用的代理服務,工作在應用層和傳輸層之間,隻是傳遞傳輸層網絡資料包TCP/UDP,而不關心應用層的協定,該協定不包含加密。針對建立獨立的網絡非常有價值。
rfc1928:29.zip
socks5 is a small module SOCKS version 5 library written fom scratch in Python, which is highly inspired by h11 and hyper-h2. It's a "bring-your-own-IO" library; that is socks5 module does not contain any network related code. socks5 only deal with the parsing and state management of the socks5 connection, the underlying IO part is not cover in the internal code.
Currently, socks5 module support the following protocol and rfc.
socks4
socks4a
socks5 : rfc 1928
socks5 username/password authentication: rfc 1929
pip install PySocks
# / requesocks
複制
import socket
import socks
import requests
socks.set_default_proxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
socket.socket = socks.socksocket
print(requests.get('http://www.baidu.com').text)
複制
Close your local proxy first
https://baike.baidu.com/item/SOCKS5%E4%BB%A3%E7%90%86
https://blog.csdn.net/qq_42679379/article/details/88067821
https://github.com/mike820324/socks5
https://zhuanlan.zhihu.com/p/30670193