Telnet клиент на Python
Например можно реализовать так:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import getpass import sys import telnetlib HOST = "21.211.37.17" user = "уцкаыукn"; password = "ц45пукпу" def teln(num): tn = telnetlib.Telnet(HOST) tn.set_debuglevel(0) tn.read_until("Username:") tn.write(user + "\r") tn.read_until("word:") tn.write(password + "\r") tn.write("show olt "+str(num)+" optical-online-onu\r ") tn.read_until("epon#") tn.write("logout\r") print tn.read_all() tn.close() teln(1) teln(2) teln(3) teln(4) |