wrong text type in bash stdin (#1092)

* wrong text type
* new test case for 'echo echo test | bash'
This commit is contained in:
Michel Oosterhof
2019-04-16 15:44:22 +04:00
committed by GitHub
parent 7e5f50fcaa
commit 44efaa17bd
2 changed files with 8 additions and 1 deletions

View File

@ -652,7 +652,7 @@ class command_sh(HoneyPotCommand):
self.execute_commands(line)
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

View File

@ -143,5 +143,12 @@ class ShellEchoCommandTests(unittest.TestCase):
self.proto.lineReceived(b'echo -e "\x6b\x61\x6d\x69"')
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):
self.proto.connectionLost("tearDown From Unit Test")