home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!bu.edu!rpi!masscomp!peora!tarpit!fang!newsance!abcom!devildog!acpy01!ajay
- From: ajay@acpy01.att.com (Ajay Dhawan (CXNIXPT1))
- Newsgroups: comp.lang.c
- Subject: Telnet w/o login and password
- Message-ID: <1992Jul28.204926.25668@devildog.att.com>
- Date: 28 Jul 92 20:49:26 GMT
- Sender: acpy01!ajay
- Distribution: all
- Organization: AT&T IMS - Piscataway, NJ (USA)
- Lines: 36
-
-
- I'm working on writing a C program to telnet to a host machine
- without interactively entering in a login or a password. I've
- managed to get past the login: prompt but I can't seem to get
- past the Password: prompt. I think my problem is that the
- password is read directely from the tty device rather than
- standard input, but I'm not too sure.
-
- I managed to get past the login: prompt by doing the following:
- I opened a pipe which returned two file descriptors, one for
- reading and one for writing. Then I used fork() to set up a
- parent/child relationship. The child process closes standard
- input and then duplicates the pipe read descriptor using
- dup(pd[0]) so that stdin is replaced by pipe read. The child
- process then uses execl to run telnet. The parent process
- uses the write() command to write to pd[1] which is the write
- end of the pipe. By doing this, the two processes are able
- to communicate.
-
- When I run my program, I get the login: prompt and the write
- works giving me the Password: prompt. But the write does
- not work on the Password: prompt. The program ends when
- the user gets timed out for input.
-
- I understand that entering a password is a very interactive
- process - I don't know if there is a way to do something
- like this non-interactively. I have just recently started
- working with such low level C programming. Perhaps there
- is a solution that I don't see. If you have any ideas, I
- would definitely be very interested. If you'd like, I
- can send you the code I described above.
-
- -Ajay Dhawan
-
-
-
-