We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Unicode-objects must be encoded before hashing
Hello,

**Describe the bug**
When user type ssh user@server the honeypot produce an error.

**To Reproduce**
Steps to reproduce the behavior:
1. Lanch honeypot
2. Connect to fake system
3. type ssh user@qsdqsd.fr
4. See error in logs


**Server (please complete the following information):**
 - OS: Ubutun 18.04
 - Python: 3.6.9

**Additional context**
Traceback:
```
	Traceback (most recent call last):
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
	    return self.currentContext().callWithContext(ctx, func, *args, **kw)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
	    return func(*args,**kw)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/service.py", line 45, in packetReceived
	    return f(packet)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/connection.py", line 258, in ssh_CHANNEL_DATA
	    log.callWithLogger(channel, channel.dataReceived, data)
	--- <exception caught here> ---
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/log.py", line 103, in callWithLogger
	    return callWithContext({"system": lp}, func, *args, **kw)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
	    return context.call({ILogContext: newCtx}, func, *args, **kw)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
	    return self.currentContext().callWithContext(ctx, func, *args, **kw)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
	    return func(*args,**kw)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/session.py", line 112, in dataReceived
	    self.client.transport.write(data)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/session.py", line 163, in write
	    self.proto.dataReceived(data)
	  File "/home/valentin/honeypot/cowrie/src/cowrie/insults/insults.py", line 98, in dataReceived
	    insults.ServerProtocol.dataReceived(self, data)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/insults/insults.py", line 537, in dataReceived
	    self.terminalProtocol.keystrokeReceived(ch, None)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/recvline.py", line 225, in keystrokeReceived
	    m()
	  File "/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py", line 320, in handle_RETURN
	    return recvline.RecvLine.handle_RETURN(self)
	  File "/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/recvline.py", line 292, in handle_RETURN
	    self.lineReceived(line)
	  File "/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py", line 182, in lineReceived
	    self.cmdstack[-1].lineReceived(line)
	  File "/home/valentin/honeypot/cowrie/src/cowrie/shell/honeypot.py", line 173, in lineReceived
	    self.runCommand()
	  File "/home/valentin/honeypot/cowrie/src/cowrie/shell/honeypot.py", line 289, in runCommand
	    self.protocol.call_command(pp, cmdclass, *cmd_array[0]['rargs'])
	  File "/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py", line 301, in call_command
	    HoneyPotBaseProtocol.call_command(self, pp, cmd, *args)
	  File "/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py", line 191, in call_command
	    obj.start()
	  File "/home/valentin/honeypot/cowrie/src/cowrie/commands/ssh.py", line 74, in start
	    s = hashlib.md5(host).hexdigest()
	builtins.TypeError: Unicode-objects must be encoded before hashing
	

```
Thanks

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cowrie/commands/ssh.py`
Content:
```
1 # Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
2 # See the COPYRIGHT file for more information
3 
4 from __future__ import absolute_import, division
5 
6 import getopt
7 import hashlib
8 import re
9 import socket
10 import time
11 
12 from twisted.internet import reactor
13 from twisted.python import log
14 
15 from cowrie.core.config import CowrieConfig
16 from cowrie.shell.command import HoneyPotCommand
17 
18 commands = {}
19 
20 
21 OUTPUT = [
22     'usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]',
23     '           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]',
24     '           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]',
25     '           [-i identity_file] [-J [user@]host[:port]] [-L address]',
26     '           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]',  # noqa
27     '           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]',
28     '           [-w local_tun[:remote_tun]] destination [command]'
29 ]
30 
31 
32 class command_ssh(HoneyPotCommand):
33 
34     def valid_ip(self, address):
35         try:
36             socket.inet_aton(address)
37             return True
38         except Exception:
39             return False
40 
41     def start(self):
42         try:
43             options = '-1246AaCfgKkMNnqsTtVvXxYb:c:D:e:F:i:L:l:m:O:o:p:R:S:w:'
44             optlist, args = getopt.getopt(self.args, options)
45         except getopt.GetoptError:
46             self.write('Unrecognized option\n')
47             self.exit()
48         for opt in optlist:
49             if opt[0] == '-V':
50                 self.write(CowrieConfig().get('shell', 'ssh_version',
51                            fallback="OpenSSH_7.9p1, OpenSSL 1.1.1a  20 Nov 2018")+"\n")
52                 self.exit()
53                 return
54         if not len(args):
55             for line in OUTPUT:
56                 self.write('{0}\n'.format(line))
57             self.exit()
58             return
59         user, host = 'root', args[0]
60         for opt in optlist:
61             if opt[0] == '-l':
62                 user = opt[1]
63         if args[0].count('@'):
64             user, host = args[0].split('@', 1)
65 
66         if re.match('^[0-9.]+$', host):
67             if self.valid_ip(host):
68                 self.ip = host
69             else:
70                 self.write('ssh: Could not resolve hostname %s: \
71                     Name or service not known\n' % (host,))
72                 self.exit()
73         else:
74             s = hashlib.md5(host).hexdigest()
75             self.ip = '.'.join([str(int(x, 16)) for x in
76                                 (s[0:2], s[2:4], s[4:6], s[6:8])])
77 
78         self.host = host
79         self.user = user
80 
81         self.write('The authenticity of host \'%s (%s)\' \
82             can\'t be established.\n' % (self.host, self.ip))
83         self.write('RSA key fingerprint is \
84             9d:30:97:8a:9e:48:0d:de:04:8d:76:3a:7b:4b:30:f8.\n')
85         self.write('Are you sure you want to continue connecting (yes/no)? ')
86         self.callbacks = [self.yesno, self.wait]
87 
88     def yesno(self, line):
89         self.write('Warning: Permanently added \'{}\' (RSA) to the \
90             list of known hosts.\n'.format(self.host))
91         self.write('%s@%s\'s password: ' % (self.user, self.host))
92         self.protocol.password_input = True
93 
94     def wait(self, line):
95         reactor.callLater(2, self.finish, line)
96 
97     def finish(self, line):
98         self.pause = False
99         rest, host = self.host, 'localhost'
100         rest = self.host.strip().split('.')
101         if len(rest) and rest[0].isalpha():
102             host = rest[0]
103         self.protocol.hostname = host
104         self.protocol.cwd = '/root'
105         if not self.fs.exists(self.protocol.cwd):
106             self.protocol.cwd = '/'
107         self.protocol.password_input = False
108         self.write('Linux {} 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 \
109             UTC 2009 i686\n'.format(self.protocol.hostname))
110         self.write('Last login: %s from 192.168.9.4\n'
111                    % (time.ctime(time.time() - 123123),))
112         self.exit()
113 
114     def lineReceived(self, line):
115         log.msg('INPUT (ssh):', line)
116         if len(self.callbacks):
117             self.callbacks.pop(0)(line)
118 
119 
120 commands['/usr/bin/ssh'] = command_ssh
121 commands['ssh'] = command_ssh
122
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/cowrie/commands/ssh.py b/src/cowrie/commands/ssh.py
--- a/src/cowrie/commands/ssh.py
+++ b/src/cowrie/commands/ssh.py
@@ -71,7 +71,7 @@
                     Name or service not known\n' % (host,))
                 self.exit()
         else:
-            s = hashlib.md5(host).hexdigest()
+            s = hashlib.md5(host.encode()).hexdigest()
             self.ip = '.'.join([str(int(x, 16)) for x in
                                 (s[0:2], s[2:4], s[4:6], s[6:8])])

{"golden_diff": "diff --git a/src/cowrie/commands/ssh.py b/src/cowrie/commands/ssh.py\n--- a/src/cowrie/commands/ssh.py\n+++ b/src/cowrie/commands/ssh.py\n@@ -71,7 +71,7 @@\n                     Name or service not known\\n' % (host,))\n                 self.exit()\n         else:\n-            s = hashlib.md5(host).hexdigest()\n+            s = hashlib.md5(host.encode()).hexdigest()\n             self.ip = '.'.join([str(int(x, 16)) for x in\n                                 (s[0:2], s[2:4], s[4:6], s[6:8])])\n", "issue": "Unicode-objects must be encoded before hashing\nHello,\r\n\r\n**Describe the bug**\r\nWhen user type ssh user@server the honeypot produce an error.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Lanch honeypot\r\n2. Connect to fake system\r\n3. type ssh user@qsdqsd.fr\r\n4. See error in logs\r\n\r\n\r\n**Server (please complete the following information):**\r\n - OS: Ubutun 18.04\r\n - Python: 3.6.9\r\n\r\n**Additional context**\r\nTraceback:\r\n```\r\n\tTraceback (most recent call last):\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py\", line 122, in callWithContext\r\n\t    return self.currentContext().callWithContext(ctx, func, *args, **kw)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py\", line 85, in callWithContext\r\n\t    return func(*args,**kw)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/service.py\", line 45, in packetReceived\r\n\t    return f(packet)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/connection.py\", line 258, in ssh_CHANNEL_DATA\r\n\t    log.callWithLogger(channel, channel.dataReceived, data)\r\n\t--- <exception caught here> ---\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/log.py\", line 103, in callWithLogger\r\n\t    return callWithContext({\"system\": lp}, func, *args, **kw)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/log.py\", line 86, in callWithContext\r\n\t    return context.call({ILogContext: newCtx}, func, *args, **kw)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py\", line 122, in callWithContext\r\n\t    return self.currentContext().callWithContext(ctx, func, *args, **kw)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/python/context.py\", line 85, in callWithContext\r\n\t    return func(*args,**kw)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/session.py\", line 112, in dataReceived\r\n\t    self.client.transport.write(data)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/ssh/session.py\", line 163, in write\r\n\t    self.proto.dataReceived(data)\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/insults/insults.py\", line 98, in dataReceived\r\n\t    insults.ServerProtocol.dataReceived(self, data)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/insults/insults.py\", line 537, in dataReceived\r\n\t    self.terminalProtocol.keystrokeReceived(ch, None)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/recvline.py\", line 225, in keystrokeReceived\r\n\t    m()\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py\", line 320, in handle_RETURN\r\n\t    return recvline.RecvLine.handle_RETURN(self)\r\n\t  File \"/home/valentin/honeypot/cowrie/cowrie-env/lib/python3.6/site-packages/twisted/conch/recvline.py\", line 292, in handle_RETURN\r\n\t    self.lineReceived(line)\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py\", line 182, in lineReceived\r\n\t    self.cmdstack[-1].lineReceived(line)\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/shell/honeypot.py\", line 173, in lineReceived\r\n\t    self.runCommand()\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/shell/honeypot.py\", line 289, in runCommand\r\n\t    self.protocol.call_command(pp, cmdclass, *cmd_array[0]['rargs'])\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py\", line 301, in call_command\r\n\t    HoneyPotBaseProtocol.call_command(self, pp, cmd, *args)\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/shell/protocol.py\", line 191, in call_command\r\n\t    obj.start()\r\n\t  File \"/home/valentin/honeypot/cowrie/src/cowrie/commands/ssh.py\", line 74, in start\r\n\t    s = hashlib.md5(host).hexdigest()\r\n\tbuiltins.TypeError: Unicode-objects must be encoded before hashing\r\n\t\r\n\r\n```\r\nThanks\n", "before_files": [{"content": "# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>\n# See the COPYRIGHT file for more information\n\nfrom __future__ import absolute_import, division\n\nimport getopt\nimport hashlib\nimport re\nimport socket\nimport time\n\nfrom twisted.internet import reactor\nfrom twisted.python import log\n\nfrom cowrie.core.config import CowrieConfig\nfrom cowrie.shell.command import HoneyPotCommand\n\ncommands = {}\n\n\nOUTPUT = [\n    'usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]',\n    '           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]',\n    '           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]',\n    '           [-i identity_file] [-J [user@]host[:port]] [-L address]',\n    '           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]',  # noqa\n    '           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]',\n    '           [-w local_tun[:remote_tun]] destination [command]'\n]\n\n\nclass command_ssh(HoneyPotCommand):\n\n    def valid_ip(self, address):\n        try:\n            socket.inet_aton(address)\n            return True\n        except Exception:\n            return False\n\n    def start(self):\n        try:\n            options = '-1246AaCfgKkMNnqsTtVvXxYb:c:D:e:F:i:L:l:m:O:o:p:R:S:w:'\n            optlist, args = getopt.getopt(self.args, options)\n        except getopt.GetoptError:\n            self.write('Unrecognized option\\n')\n            self.exit()\n        for opt in optlist:\n            if opt[0] == '-V':\n                self.write(CowrieConfig().get('shell', 'ssh_version',\n                           fallback=\"OpenSSH_7.9p1, OpenSSL 1.1.1a  20 Nov 2018\")+\"\\n\")\n                self.exit()\n                return\n        if not len(args):\n            for line in OUTPUT:\n                self.write('{0}\\n'.format(line))\n            self.exit()\n            return\n        user, host = 'root', args[0]\n        for opt in optlist:\n            if opt[0] == '-l':\n                user = opt[1]\n        if args[0].count('@'):\n            user, host = args[0].split('@', 1)\n\n        if re.match('^[0-9.]+$', host):\n            if self.valid_ip(host):\n                self.ip = host\n            else:\n                self.write('ssh: Could not resolve hostname %s: \\\n                    Name or service not known\\n' % (host,))\n                self.exit()\n        else:\n            s = hashlib.md5(host).hexdigest()\n            self.ip = '.'.join([str(int(x, 16)) for x in\n                                (s[0:2], s[2:4], s[4:6], s[6:8])])\n\n        self.host = host\n        self.user = user\n\n        self.write('The authenticity of host \\'%s (%s)\\' \\\n            can\\'t be established.\\n' % (self.host, self.ip))\n        self.write('RSA key fingerprint is \\\n            9d:30:97:8a:9e:48:0d:de:04:8d:76:3a:7b:4b:30:f8.\\n')\n        self.write('Are you sure you want to continue connecting (yes/no)? ')\n        self.callbacks = [self.yesno, self.wait]\n\n    def yesno(self, line):\n        self.write('Warning: Permanently added \\'{}\\' (RSA) to the \\\n            list of known hosts.\\n'.format(self.host))\n        self.write('%s@%s\\'s password: ' % (self.user, self.host))\n        self.protocol.password_input = True\n\n    def wait(self, line):\n        reactor.callLater(2, self.finish, line)\n\n    def finish(self, line):\n        self.pause = False\n        rest, host = self.host, 'localhost'\n        rest = self.host.strip().split('.')\n        if len(rest) and rest[0].isalpha():\n            host = rest[0]\n        self.protocol.hostname = host\n        self.protocol.cwd = '/root'\n        if not self.fs.exists(self.protocol.cwd):\n            self.protocol.cwd = '/'\n        self.protocol.password_input = False\n        self.write('Linux {} 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 \\\n            UTC 2009 i686\\n'.format(self.protocol.hostname))\n        self.write('Last login: %s from 192.168.9.4\\n'\n                   % (time.ctime(time.time() - 123123),))\n        self.exit()\n\n    def lineReceived(self, line):\n        log.msg('INPUT (ssh):', line)\n        if len(self.callbacks):\n            self.callbacks.pop(0)(line)\n\n\ncommands['/usr/bin/ssh'] = command_ssh\ncommands['ssh'] = command_ssh\n", "path": "src/cowrie/commands/ssh.py"}], "after_files": [{"content": "# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>\n# See the COPYRIGHT file for more information\n\nfrom __future__ import absolute_import, division\n\nimport getopt\nimport hashlib\nimport re\nimport socket\nimport time\n\nfrom twisted.internet import reactor\nfrom twisted.python import log\n\nfrom cowrie.core.config import CowrieConfig\nfrom cowrie.shell.command import HoneyPotCommand\n\ncommands = {}\n\n\nOUTPUT = [\n    'usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]',\n    '           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]',\n    '           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]',\n    '           [-i identity_file] [-J [user@]host[:port]] [-L address]',\n    '           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]',  # noqa\n    '           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]',\n    '           [-w local_tun[:remote_tun]] destination [command]'\n]\n\n\nclass command_ssh(HoneyPotCommand):\n\n    def valid_ip(self, address):\n        try:\n            socket.inet_aton(address)\n            return True\n        except Exception:\n            return False\n\n    def start(self):\n        try:\n            options = '-1246AaCfgKkMNnqsTtVvXxYb:c:D:e:F:i:L:l:m:O:o:p:R:S:w:'\n            optlist, args = getopt.getopt(self.args, options)\n        except getopt.GetoptError:\n            self.write('Unrecognized option\\n')\n            self.exit()\n        for opt in optlist:\n            if opt[0] == '-V':\n                self.write(CowrieConfig().get('shell', 'ssh_version',\n                           fallback=\"OpenSSH_7.9p1, OpenSSL 1.1.1a  20 Nov 2018\")+\"\\n\")\n                self.exit()\n                return\n        if not len(args):\n            for l in OUTPUT:\n                self.write('{0}\\n'.format(l))\n            self.exit()\n            return\n        user, host = 'root', args[0]\n        for opt in optlist:\n            if opt[0] == '-l':\n                user = opt[1]\n        if args[0].count('@'):\n            user, host = args[0].split('@', 1)\n\n        if re.match('^[0-9.]+$', host):\n            if self.valid_ip(host):\n                self.ip = host\n            else:\n                self.write('ssh: Could not resolve hostname %s: \\\n                    Name or service not known\\n' % (host,))\n                self.exit()\n        else:\n            s = hashlib.md5(host.encode()).hexdigest()\n            self.ip = '.'.join([str(int(x, 16)) for x in\n                                (s[0:2], s[2:4], s[4:6], s[6:8])])\n\n        self.host = host\n        self.user = user\n\n        self.write('The authenticity of host \\'%s (%s)\\' \\\n            can\\'t be established.\\n' % (self.host, self.ip))\n        self.write('RSA key fingerprint is \\\n            9d:30:97:8a:9e:48:0d:de:04:8d:76:3a:7b:4b:30:f8.\\n')\n        self.write('Are you sure you want to continue connecting (yes/no)? ')\n        self.callbacks = [self.yesno, self.wait]\n\n    def yesno(self, line):\n        self.write('Warning: Permanently added \\'{}\\' (RSA) to the \\\n            list of known hosts.\\n'.format(self.host))\n        self.write('%s@%s\\'s password: ' % (self.user, self.host))\n        self.protocol.password_input = True\n\n    def wait(self, line):\n        reactor.callLater(2, self.finish, line)\n\n    def finish(self, line):\n        self.pause = False\n        rest, host = self.host, 'localhost'\n        rest = self.host.strip().split('.')\n        if len(rest) and rest[0].isalpha():\n            host = rest[0]\n        self.protocol.hostname = host\n        self.protocol.cwd = '/root'\n        if not self.fs.exists(self.protocol.cwd):\n            self.protocol.cwd = '/'\n        self.protocol.password_input = False\n        self.write('Linux {} 2.6.26-2-686 #1 SMP Wed Nov 4 20:45:37 \\\n            UTC 2009 i686\\n'.format(self.protocol.hostname))\n        self.write('Last login: %s from 192.168.9.4\\n'\n                   % (time.ctime(time.time() - 123123),))\n        self.exit()\n\n    def lineReceived(self, line):\n        log.msg('INPUT (ssh):', line)\n        if len(self.callbacks):\n            self.callbacks.pop(0)(line)\n\n\ncommands['/usr/bin/ssh'] = command_ssh\ncommands['ssh'] = command_ssh\n", "path": "src/cowrie/commands/ssh.py"}]}