diff --git a/cowrie/core/protocol.py b/cowrie/core/protocol.py index d9c2999..5addee6 100644 --- a/cowrie/core/protocol.py +++ b/cowrie/core/protocol.py @@ -65,9 +65,9 @@ class HoneyPotBaseProtocol(insults.TerminalProtocol, TimeoutMixin): self.setTimeout(1800) # Source IP of client in user visible reports (can be fake or real) - if self.cfg.has_option('honeypot', 'fake_addr'): + try: self.clientIP = self.cfg.get('honeypot', 'fake_addr') - else: + except: self.clientIP = self.realClientIP if self.cfg.has_option('honeypot', 'internet_facing_ip'): @@ -428,7 +428,7 @@ class LoggingServerProtocol(insults.ServerProtocol): log.msg(eventid='KIPP0015', format='Data upload limit reached') #self.loseConnection() self.eofReceived() - return + return if self.stdinlog_open: with file(self.stdinlog_file, 'ab') as f: diff --git a/cowrie/core/ssh.py b/cowrie/core/ssh.py index 3f7a1fa..13acf39 100644 --- a/cowrie/core/ssh.py +++ b/cowrie/core/ssh.py @@ -241,12 +241,11 @@ class HoneyPotSSHFactory(factory.SSHFactory): _modulis = '/etc/ssh/moduli', '/private/etc/moduli' - # FIXME: try to mimic something real 100% t = HoneyPotTransport() - if self.cfg.has_option('honeypot', 'ssh_version_string'): + try: t.ourVersionString = self.cfg.get('honeypot', 'ssh_version_string') - else: + except: t.ourVersionString = "SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2" t.supportedPublicKeys = self.privateKeys.keys() @@ -460,9 +459,11 @@ class CowrieUser(avatar.ConchUser): self.home = '/home/' + username # sftp support enabled only when option is explicitly set - if self.cfg.has_option('honeypot', 'sftp_enabled'): + try: if (self.cfg.get('honeypot', 'sftp_enabled') == "true"): self.subsystemLookup['sftp'] = filetransfer.FileTransferServer + except: + pass def logout(self): log.msg(