Hello... I am currently researching about remote login and came across Python's Telnetlib. However, I cannot find a similar library in C. Does anyone know if there is an equivalent library in C or the equivalent functions can be implemented in C.
Attached here is the sample code in Python that I want to implement in C:
import getpass
import sys
import telnetlib
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")
import sys
import telnetlib
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")
thanks very much
print tn.read_all()
print tn.read_all()
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!