def forward_socks5_handshake(self, socksconn): initreq = msg.InitRequest() socksconn.sendall(initreq.pack()) initreply = utils.read_init_reply(socksconn) if initreply.method != msg.NO_AUTHENTICATION_REQUIRED: return False return True
def process(self): try: initreq = read_init_request(self.socksconn) self.remoteconn.sendall(initreq.pack()) initreply = read_init_reply(self.remoteconn) self.socksconn.sendall(initreply.pack()) req = read_request(self.socksconn) { CONNECT: self.cmd_connect, BIND: self.cmd_bind, UDP_ASSOCIATE : self.cmd_udp_associate }[req.cmd](req) self.clean() except Exception, e: log.error("[Exception][SocksForwardSession]: %s" % str(e)) self.clean()