Skip to content

Commit

Permalink
Fixing telnet read until (threat9#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucyoa authored Jun 14, 2018
1 parent f61d9eb commit 6d6d172
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions routersploit/core/telnet/telnet_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,26 @@ def telnet_interactive(self, telnet):

def telnet_read_until(self, telnet_client, data):
if telnet_client:
if type(data) is str:
data = bytes(data, "utf-8")
try:
if type(data) is str:
data = bytes(data, "utf-8")

response = telnet_client.read_until(data, 5)
return str(response, "utf-8")
response = telnet_client.read_until(data, 5)
return str(response, "utf-8")
except Exception:
pass

return None

def telnet_write(self, telnet_client, data):
if telnet_client:
if type(data) is str:
data = bytes(data, "utf-8")
try:
if type(data) is str:
data = bytes(data, "utf-8")

return telnet_client.write(data, 5)
return telnet_client.write(data, 5)
except Exception:
pass

return None

Expand Down

0 comments on commit 6d6d172

Please sign in to comment.