Subject: | |
From: | |
Reply To: | |
Date: | Wed, 18 Nov 1998 17:03:15 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
John MacLerran writes:
>
> Hi Listers,
>
> I'm trying to automate a Telnet login from an MPE/iX session, doing
> something like this:
>
> telnet < myfile
>
> Where myfile contains:
> open somehost.somewhere.org
> username
> password
> ls -l
> other unix commands...
> exit
>
> When I do the above, it doesn't work. It stops at the login: prompt on
> the remote host. I also can't put the equivalent of the above file in a
> job, because Telnet complains that it can't be run from a job (that may
> be the way we have our program capabilities set up -- I'll have to talk
> to our sys mgr about that). However, it would be preferable to do it
> from a command file in a session.
>
> Can anyone enlighten me as to how I could do this?
HP's REMSH.NET.SYS (aka /usr/bin/remsh) might be useful to you.
If you need more interactivity, you might be able to do it with Perl/iX and
Net::Telnet. Perl/iX is available from:
http://www.cccd.edu/~markb/perlix.html
Net::Telnet is available from CPAN. The documentation is at:
http://www.perl.com/CPAN-local/authors/id/JROGERS/Net-Telnet-3.01.readme
The example program looks like what you're trying to do:
Here's an example that prints who's logged-on to the remote host
sparky. In addition to a username and password, you must also
know the user's shell prompt, which for this example is bash$
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("/usr/bin/who");
print @lines;
--
Mark Bixby E-mail: [log in to unmask]
Coast Community College Dist. Web: http://www.cccd.edu/~markb/
District Information Services 1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support Voice: +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)
|
|
|