telnet eastar

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import telnetlib
def telnet_term(host, port=23):
with telnetlib.Telnet(host, port, timeout=10) as tn:
tn.write(b'sh sy\n')
answer = tn.read_until(b'#')
tn.write(b'exit\n')
return list(map( str.strip, answer[5:].decode().split('\n')[2:7]))
host = '172.16.102.249'
for i in telnet_term(host):
print(i, sep='\n')