Re: Re: About remote login
mara ailiez sy <[email protected]> Wed, 28 Jan 2004 07:11:09 -0800 (PST)
| Newsgroups | gmane.linux.redhat.devel |
|---|---|
| Message-ID | <[email protected]> |
another question: what is getty prog? 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. Try it!