mirror of
https://github.com/cowrie/cowrie.git
synced 2025-07-01 18:07:27 -04:00
wrong text type in bash stdin (#1092)
* wrong text type * new test case for 'echo echo test | bash'
This commit is contained in:
@ -652,7 +652,7 @@ class command_sh(HoneyPotCommand):
|
|||||||
self.execute_commands(line)
|
self.execute_commands(line)
|
||||||
|
|
||||||
elif self.input_data:
|
elif self.input_data:
|
||||||
self.execute_commands(self.input_data)
|
self.execute_commands(self.input_data.decode('utf8'))
|
||||||
|
|
||||||
# TODO: handle spawning multiple shells, support other sh flags
|
# TODO: handle spawning multiple shells, support other sh flags
|
||||||
|
|
||||||
|
|||||||
@ -143,5 +143,12 @@ class ShellEchoCommandTests(unittest.TestCase):
|
|||||||
self.proto.lineReceived(b'echo -e "\x6b\x61\x6d\x69"')
|
self.proto.lineReceived(b'echo -e "\x6b\x61\x6d\x69"')
|
||||||
self.assertEquals(self.tr.value(), b'kami\n' + PROMPT)
|
self.assertEquals(self.tr.value(), b'kami\n' + PROMPT)
|
||||||
|
|
||||||
|
def test_echo_command_017(self):
|
||||||
|
"""
|
||||||
|
echo -e "\x6b\x61\x6d\x69"
|
||||||
|
"""
|
||||||
|
self.proto.lineReceived(b'echo echo test | bash')
|
||||||
|
self.assertEquals(self.tr.value(), b'test\n' + PROMPT)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.proto.connectionLost("tearDown From Unit Test")
|
self.proto.connectionLost("tearDown From Unit Test")
|
||||||
|
|||||||
Reference in New Issue
Block a user