Пример #1
0
 def proc_tcp_request(self, req):
     dst = (req.dstaddr, req.dstport)
     log.info("TCP request address: (%s:%d)" % dst)
     self.remoteconn = socket.create_connection(dst, self.timeout)
     self.track_sock(self.remoteconn)
     addrtype, bndaddr, bndport = sock_addr_info(self.remoteconn)
     request_success(self.socksconn, addrtype, bndaddr, bndport)
Пример #2
0
 def proc_tcp_request(self, req):
     dst = (req.dstaddr, req.dstport)
     log.info("TCP request address: (%s:%d)" % dst)
     self.remoteconn = socket.create_connection(dst, self.timeout)
     self.track_sock(self.remoteconn)
     addrtype, bndaddr, bndport = sock_addr_info(self.remoteconn)
     request_success(self.socksconn, addrtype, bndaddr, bndport)
Пример #3
0
 def proc_udp_request(self, req):
     self.client_associate = (req.dstaddr, req.dstport)
     log.info("UDP client adress: (%s:%d)" % self.client_associate)
     self.last_clientaddr = self.client_associate
     self.client2local_udpsock = bind_local_udp(self.socksconn)
     if not self.client2local_udpsock:
         request_fail(self.socksconn, req, GENERAL_SOCKS_SERVER_FAILURE)
         return False
     self.track_sock(self.client2local_udpsock)
     bndtype, bndaddr, bndport = sock_addr_info(self.client2local_udpsock)
     log.info("UDP ACCOSIATE: (%s:%d)" % (bndaddr, bndport))
     request_success(self.socksconn, bndtype, bndaddr, bndport)
     return True
Пример #4
0
 def proc_udp_request(self, req):
     self.client_associate = (req.dstaddr, req.dstport)
     log.info("UDP client adress: (%s:%d)" % self.client_associate)
     self.last_clientaddr = self.client_associate
     self.client2local_udpsock = bind_local_udp(self.socksconn)
     if not self.client2local_udpsock:
         request_fail(self.socksconn, req, GENERAL_SOCKS_SERVER_FAILURE)
         return False
     self.track_sock(self.client2local_udpsock)
     bndtype, bndaddr, bndport = sock_addr_info(self.client2local_udpsock)
     log.info("UDP ACCOSIATE: (%s:%d)" % (bndaddr, bndport))
     request_success(self.socksconn, bndtype, bndaddr, bndport)
     return True
Пример #5
0
 def proc_udp_request(self, req):
     self.client_associate = (req.dstaddr, req.dstport)
     self.last_clientaddr = self.client_associate
     self.client2local_udpsock = bind_local_udp(self.socksconn)
 
     self.local2remote_udpsock = bind_local_udp(self.remoteconn)
     if not self.client2local_udpsock or not self.local2remote_udpsock:
         request_fail(self.socksconn, req, GENERAL_SOCKS_SERVER_FAILURE)
         return False
     
     self.track_sock(self.client2local_udpsock)
     self.track_sock(self.local2remote_udpsock)
     send_request(self.remoteconn, UDP_ASSOCIATE, *sock_addr_info(self.local2remote_udpsock))
     reply = read_reply(self.remoteconn)
     if reply.rep != SUCCEEDED:
         return False
     
     self.remote_associate = (reply.bndaddr, reply.bndport)
     request_success(self.socksconn, *sock_addr_info(self.client2local_udpsock))
     return True