def connect_and_login(self):
""" Establish a Telnet connection and perform a login """
self.session = Telnet()
try:
self.session.open(self.host, self.port, self.response_timeout)
except socket.timeout:
return False
if not self.login(self.username, self.password):
return False
try:
self.execute_command_lowlevel("terminal length 0")
self.execute_command_lowlevel("terminal width 0")
except EOFError:
return False
return True
评论列表
文章目录