RE: about remote login

"Talukdar, Nipun" <[email protected]> Wed, 28 Jan 2004 19:50:24 +0530
Newsgroups gmane.linux.redhat.devel
Message-ID <90A459FEF0E0124D9D7266ECD37396CAEAE598@DPEXCH01.digitalindiasw.net>
You can  do that easily in C 
...  there is "getpass" routine for get your input without echoing ....
use gethostbyname , connect , send , recv  etc to connect to the remote host ......
getty prog is useful here ...
 
As far as I remember "rlogin" source was included in one book by W RICHARD STEVENS 
( unix n/w programming ???? ) .......
 
If you look at the RFC 1282 , it will give info about how to format the messages  between the
 client/server .......
telnet's implementation is different from rlogin's 
 
-Nipun
 

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of mara ailiez sy
Sent: Wednesday, January 28, 2004 7:17 PM
To: [email protected]
Subject: about remote login


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")
 
thanks very much

print tn.read_all()
 



  _____  

Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool.  <http://us.rd.yahoo.com/evt=21608/*http://webhosting.yahoo.com/ps/sb/> Try it!