python 通过sock5代理连接

# socket5 模块
import sys
import socket
import os
import struct
import logging
import CommonInterface
import Log
#
def iptoint(num):
	return struct.unpack('I', socket.inet_aton(num))[0]
    
#socket class
class PySocket5(object):
	def __init__ (self, proxy_ip, proxy_port, proxy_user, proxy_pass, dest_ip, dest_port):
		self.proxy_ip=proxy_ip
		self.proxy_port=proxy_port
		self.proxy_user = proxy_user
		self.proxy_pass = proxy_pass
		self.dest_ip = dest_ip
		self.dest_port = dest_port
		self.sock=None
		self.sock_init()

	def Connect(self):
		self.sock_connect(self.dest_ip, self.dest_port)
		
	def ConnectProxyServer(self):
		self.sock_connect(self.proxy_ip, self.proxy_port)
		##请求认证方式
		body = struct.pack('

 

你可能感兴趣的:(Python)