From 45836391c7489eef397ade272905102013554ced Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Sat, 9 May 2015 10:26:25 +0200 Subject: [PATCH] Some adjustments to the fake ftp --- fakeftp.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fakeftp.py b/fakeftp.py index 783347f..7c0f64f 100644 --- a/fakeftp.py +++ b/fakeftp.py @@ -453,17 +453,19 @@ class PasvCommandHandler(CommandHandler): class PortCommandHandler(CommandHandler): cmd = "PORT" def process(self, handler, message): + handler.log("PORT: %s" % message.parameter) hp = message.parameter.split(",") if len(hp) != 6: handler.send( InvalidParametersMessage() ) return - if int(hp[0]) == 10 or int(hp[0]) == 127 or int(hp[0]) == 192: #Prevent local scanning - handler.log( "Attempt to port to local network." ) - handler.send( InvalidPortCommandMessage() ) - return + #if int(hp[0]) == 11 or int(hp[0]) == 127 or int(hp[0]) == 192: #Prevent local scanning + # handler.log( "Attempt to port to local network." ) + # handler.send( InvalidPortCommandMessage() ) + # return - addr = ( ".".join(hp[:4]), int(hp[4])<<8+int(hp[5]) ) + port = ( int(hp[4])<<8 )+int(hp[5]) + addr = ( ".".join(hp[:4]), port ) handler.log( "Creating active data connection to %s:%d" % addr ) @@ -794,7 +796,7 @@ while True: server.serve_forever() break except Exception: - if port < 1500: + if port < 21: port += 1 else: print "Failed to find a port"