def dataReceived(self, data): if not self.otherConn: return SOCKSv4.dataReceived(self, data) if hijack == 's': data = editdata(data) csinfo = '%s:%s --> %s:%s' % getCSInfo(self) csinfo += ' len: %s' % len(data) print colored(csinfo, 'red') print colored(hexdump(data), 'green') logdata('%s\n%s' % (csinfo, hexdump(data))) return SOCKSv4.dataReceived(self, data)
def write(self, data): if not self.otherConn: return SOCKSv4.write(self, data) if hijack == 'r': data = editdata(data) csinfo = '%s:%s <-- %s:%s' % getCSInfo(self) csinfo += ' len: %s' % len(data) print colored(csinfo, 'red') print colored(hexdump(data), 'yellow') logdata('%s\n%s' % (csinfo, hexdump(data))) return SOCKSv4.write(self, data)
def __init__(self, factory, reactor=reactor): SOCKSv4.__init__(self, factory.logging, reactor) self.bufsize = self.DEFAULT_BUFSIZE self.factory = factory
def __init__(self, interface, whitelist): SOCKSv4.__init__(self, None, reactor) self.interface = interface self.whitelist = whitelist
def connectionMade(self): if self._allow(): SOCKSv4.connectionMade(self) else: self.transport.loseConnection()