gateway: Fix prompt in get_telnet and set TELNET window size: 1000x32

This commit is contained in:
remittor
2025-04-17 08:15:59 +03:00
parent fea8d7df80
commit e46d952586
2 changed files with 3 additions and 3 deletions
+2
View File
@@ -790,6 +790,7 @@ class Gateway():
return False
def get_telnet(self, verbose = 0, password = None):
from telnetlib import NOP, IAC, SB, NAWS, SE
try:
tn = telnetlib.Telnet(self.ip_addr, timeout=4)
except Exception as e:
@@ -803,6 +804,7 @@ class Gateway():
idx, obj, output = tn.expect([p_login, prompt], timeout=2)
if idx < 0:
raise Exception('TELNET auth error (1)')
tn.sock.sendall(IAC + SB + NAWS + b'\x03\xE8\x00\x20' + IAC + SE)
if idx > 0:
tn.prompt = obj.group()
return tn
-2
View File
@@ -38,8 +38,6 @@ import socket
import selectors
from time import monotonic as _time
__all__ = ["Telnet"]
# Tunable parameters
DEBUGLEVEL = 0