Commit 639f8786 authored by BaiJiangJie's avatar BaiJiangJie

[Update] 设置telnet连接timeout

parent d832530c
...@@ -180,6 +180,7 @@ class TelnetConnection: ...@@ -180,6 +180,7 @@ class TelnetConnection:
def get_socket(self): def get_socket(self):
logger.info('Get telnet server socket. {}'.format(self.client.user)) logger.info('Get telnet server socket. {}'.format(self.client.user))
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.settimeout(10)
self.sock.connect((self.asset.ip, self.asset.port)) self.sock.connect((self.asset.ip, self.asset.port))
# Send SGA and ECHO options to Telnet Server # Send SGA and ECHO options to Telnet Server
self.sock.send(telnetlib.IAC + telnetlib.DO + telnetlib.SGA) self.sock.send(telnetlib.IAC + telnetlib.DO + telnetlib.SGA)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment