Example #1
0
 def onaccept():
     sock, srcip = listener.accept()
     dstip = original_dst(sock)
     debug1("Accept: %r:%r -> %r:%r.\n" % (srcip[0], srcip[1], dstip[0], dstip[1]))
     if dstip == listener.getsockname():
         debug1("-- ignored: that's my address!\n")
         sock.close()
         return
     if use_server:
         chan = mux.next_channel()
         mux.send(chan, ssnet.CMD_CONNECT, "%s,%s" % dstip)
         outwrap = MuxWrapper(mux, chan)
     else:
         outwrap = ssnet.connect_dst(dstip[0], dstip[1])
     handlers.append(Proxy(SockWrapper(sock, sock), outwrap))
Example #2
0
 def new_channel(channel, data):
     (dstip,dstport) = data.split(',', 1)
     dstport = int(dstport)
     outwrap = ssnet.connect_dst(dstip,dstport)
     handlers.append(Proxy(MuxWrapper(mux, channel), outwrap))
Example #3
0
 def new_channel(channel, data):
     (family, dstip, dstport) = data.split(',', 2)
     family = int(family)
     dstport = int(dstport)
     outwrap = ssnet.connect_dst(family, dstip, dstport)
     handlers.append(Proxy(MuxWrapper(mux, channel), outwrap))