|
@@ -20,18 +20,30 @@ class ProxyClientProtocol(protocol.Protocol):
|
|
|
self.cli_queue.get().addCallback(self.serverDataReceived)
|
|
|
|
|
|
def serverDataReceived(self, chunk):
|
|
|
- # TODO: Line processing, and line cleaning (remove ANSI color codes)
|
|
|
+ # rlogin looks like this: \x00 password \x00 username \x00 terminal/speed \x00
|
|
|
+ # b'\x00up2lat3\x00bugz\x00ansi-bbs/115200\x00'
|
|
|
+ # We're looking for 4 \x00!
|
|
|
+ # TODO: Line processing, and line cleaning (remove ANSI color codes)
|
|
|
if chunk is False:
|
|
|
self.cli_queue = None
|
|
|
log.msg("Client: disconnecting from peer")
|
|
|
self.factory.continueTrying = False
|
|
|
self.transport.loseConnection()
|
|
|
+ elif b'\x00' in chunk:
|
|
|
+ # Hint: User rlogin reversed in syncterm
|
|
|
+ log.msg("Maybe RLOGIN?")
|
|
|
+ parts = chunk.split(b'\x00')
|
|
|
+ user = parts[1].decode('utf-8')
|
|
|
+ log.msg("GREETINGS {0}!".format(user))
|
|
|
+ # b'\x00up2lat3\x00bugz\x00ansi-bbs/115200\x00'
|
|
|
+ self.transport.write(chunk)
|
|
|
+ self.cli_queue.get().addCallback(self.serverDataReceived)
|
|
|
elif b"$" == chunk:
|
|
|
self.factory.svr_queue.put(b"HELLO.\r\n")
|
|
|
self.cli_queue.get().addCallback(self.serverDataReceived)
|
|
|
elif self.cli_queue:
|
|
|
log.msg("Client: writing %d bytes to peer" % len(chunk))
|
|
|
- log.msg(">>", chunk)
|
|
|
+ log.msg(">>", repr(chunk))
|
|
|
self.transport.write(chunk)
|
|
|
self.cli_queue.get().addCallback(self.serverDataReceived)
|
|
|
else:
|
|
@@ -39,7 +51,7 @@ class ProxyClientProtocol(protocol.Protocol):
|
|
|
|
|
|
def dataReceived(self, chunk):
|
|
|
log.msg("Client: %d bytes received from peer" % len(chunk))
|
|
|
- log.msg("<<", chunk)
|
|
|
+ log.msg("<<", repr(chunk))
|
|
|
self.factory.svr_queue.put(chunk)
|
|
|
|
|
|
def connectionLost(self, why):
|