mirror of
https://github.com/aljazceru/cowrie.git
synced 2026-02-23 15:24:30 +01:00
Minor bug fixes
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user