RE: about remote login

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: redhat-devel-list-admin@xxxxxxxxxx [mailto:redhat-devel-list-admin@xxxxxxxxxx]On Behalf Of mara ailiez sy
Sent: Wednesday, January 28, 2004 7:17 PM
To: redhat-devel-list@xxxxxxxxxx
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!

[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux