1. Telnet Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import getpass import sys import telnetlib class pytelnet(): def __init__(host,user,passwd): self.tn = telnetlib.Telnet(host.encode('utf-8')) self.tn.read_until(b"login: ") self.tn.write(user.encode('utf-8') + b"\n") self.tn.read_until(b"Password: ") self.tn.write(passwd.encode('utf-8') + b"\n") def write(s): self.tn.write(s.encode('utf-8')) def readall(): return tn.read_all().decode("utf-8") |
댓글 없음:
댓글 쓰기