Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
How to use telnet in python
SUBMITTED BY:
alemotta
DATE:
April 8, 2017, 8:17 p.m.
FORMAT:
Text only
SIZE:
408 Bytes
Raw
Download
Tweet
HITS:
606
Go to comments
Report
How to use telnet in python
import getpass
import sys
import telnetlib
HOST = "hostname"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "
")
if password:
tn.read_until("Password: ")
tn.write(password + "
")
tn.write("ls
")
tn.write("exit
")
print tn.read_all()
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus