Minor bug fixes

This commit is contained in:
davegermiquet
2016-06-12 13:00:02 -04:00
parent 6259e81bee
commit 7c655a6c6b
3 changed files with 11 additions and 12 deletions

View File

@@ -77,14 +77,16 @@ class command_busybox(HoneyPotCommand):
cmd = parsed_arguments[0]
cmdclass = self.protocol.getCommand(cmd,
self.environ['PATH'].split(':'))
if self.input_data:
self.write(self.input_data)
if cmdclass:
log.msg(eventid='cowrie.command.success',
input=line,
format='Command found: %(input)s')
command = StdOutStdErrEmulationProtocol(self.protocol,cmdclass,parsed_arguments[1:],self.input_data,None)
self.protocol.pp.insert_command(command)
# Place this here so it doesn't write out only if last statement
if self.input_data:
self.write(self.input_data)
else:
self.help()
else:

View File

@@ -123,9 +123,10 @@ Sudoers I/O plugin version 1.8.5p2\n''')
input=line,
format='Command found: %(input)s')
command = StdOutStdErrEmulationProtocol(self.protocol,cmdclass,parsed_arguments[1:], None ,None)
self.protocol.pp.insert_command(command)
# this needs to go here so it doesn't write it out....
if self.input_data:
self.write(self.input_data)
self.protocol.pp.insert_command(command)
self.exit()
else:
self.short_help()

View File

@@ -474,16 +474,12 @@ class StdOutStdErrEmulationProtocol(object):
"""
"""
self.data = self.data + data
log.msg(str(self.cmd))
# We do not print the output of sudo or busybox we print the NEXT command
if not 'command_sudo' in str(self.cmd) and not 'command_busybox' in str(self.cmd):
if not self.next_command:
if not self.protocol is None and not self.protocol.terminal is None:
self.protocol.terminal.write(data)
else:
log.msg("Connection was probably lost. Could not write to terminal")
if not self.next_command:
if not self.protocol is None and not self.protocol.terminal is None:
self.protocol.terminal.write(str(data))
else:
log.msg("Connection was probably lost. Could not write to terminal")
# Insert the next command into the list.