update 'cat' to wait on stdin.

This commit is contained in:
Michel Oosterhof 2015-08-12 16:23:27 -07:00
parent 4d151df0ea
commit a77aa94d33
1 changed files with 18 additions and 10 deletions

View File

@ -11,7 +11,10 @@ from cowrie.core.fs import *
commands = {}
class command_cat(HoneyPotCommand):
def call(self):
def start(self):
if not self.args or self.args[0] == '>':
pass
else:
for arg in self.args:
path = self.fs.resolve_path(arg, self.honeypot.cwd)
if self.fs.is_dir(path):
@ -21,6 +24,11 @@ class command_cat(HoneyPotCommand):
self.write(self.fs.file_contents(path))
except:
self.writeln('cat: %s: No such file or directory' % (arg,))
self.exit()
def lineReceived(self, line):
log.msg( eventid='KIPP0008', realm='cat', input=line,
format='INPUT (%(realm)s): %(input)s' )
commands['/bin/cat'] = command_cat