From 36f32c009acbfbef31c63d27ccbf5fc792936619 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Mon, 30 May 2016 17:20:17 +0000 Subject: [PATCH] twistedchecker --- cowrie/core/honeypot.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cowrie/core/honeypot.py b/cowrie/core/honeypot.py index 254c951..e839496 100644 --- a/cowrie/core/honeypot.py +++ b/cowrie/core/honeypot.py @@ -49,7 +49,10 @@ class HoneyPotCommand(object): self.write = self.protocol.pp.outReceived self.error = self.protocol.pp.errReceived + def check_arguments(self,application,args): + """ + """ files = [] for arg in args: path = self.fs.resolve_path(arg, self.protocol.cwd) @@ -59,9 +62,13 @@ class HoneyPotCommand(object): files.append(path) return files + def set_input_data(self,data): + """ + """ self.input_data = data + def write_to_file(self, data): """ """ @@ -70,6 +77,7 @@ class HoneyPotCommand(object): self.writtenBytes += len(data) self.fs.update_size(self.outfile, self.writtenBytes) + def start(self): """ """ @@ -91,7 +99,7 @@ class HoneyPotCommand(object): self.protocol.cmdstack.pop() self.protocol.cmdstack[-1].resume() except AttributeError: - # cmdstack could be gone already (wget + disconnect) + # Cmdstack could be gone already (wget + disconnect) pass @@ -102,6 +110,7 @@ class HoneyPotCommand(object): self.write('^C\n') self.exit() + def lineReceived(self, line): """ """ @@ -138,10 +147,10 @@ class HoneyPotShell(object): self.interactive = interactive self.cmdpending = [] self.environ = protocol.environ - #self.lexer.debug = 1 - + # self.lexer.debug = 1 self.showPrompt() + def lineReceived(self, line): """ """ @@ -301,6 +310,7 @@ class HoneyPotShell(object): if not exit: runOrPrompt() + def resume(self): """ """ @@ -342,6 +352,7 @@ class HoneyPotShell(object): self.protocol.terminal.write(prompt % attrs) self.protocol.ps = (prompt % attrs , '> ') + def eofReceived(self): """ this should probably not go through ctrl-d, but use processprotocol to close stdin @@ -443,10 +454,11 @@ class HoneyPotShell(object): self.protocol.terminal.write(newbuf) + class StdOutStdErrEmulationProtocol(object): """ + Pipe support written by Dave Germiquet """ - __author__ = 'davegermiquet' def __init__(self,protocol,cmd,cmdargs,input_data,next_protocol):