[wplug] ssh - reading password from stdin?
Lance Tost
ltost at pobox.com
Thu Jul 10 21:09:08 EDT 2003
Check out Net::Telnet.
# perldoc Net::Telnet
If you don't have it installed,
# perl -MCPAN -e 'install Net::Telnet' will install it.
NAME
Net::Telnet - interact with TELNET port or other TCP ports
SYNOPSIS
"use Net::Telnet ();"
see METHODS section below
DESCRIPTION
Net::Telnet allows you to make client connections to a TCP port and
do
network I/O, especially to a port using the TELNET protocol.
Simple
I/O methods such as print, get, and getline are provided. More
sophis-
ticated interactive features are provided because connecting to a
TEL-
NET port ultimately means communicating with a program designed for
human interaction. These interactive features include the ability
to
specify a time-out and to wait for patterns to appear in the input
stream, such as the prompt from a shell.
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
On Thu, 10 Jul 2003, Timothy Wong wrote:
> Date: Thu, 10 Jul 2003 01:09:42 -0400 (EDT)
> From: Timothy Wong <timothyw at andrew.cmu.edu>
> Reply-To: wplug at wplug.org
> To: wplug at wplug.org
> Subject: [wplug] ssh - reading password from stdin?
>
> Hi everybody,
>
> Does anybody know if there is a way to force ssh (or telnet) to read the
> user's password from STDIN? I would like to do this so that I can open an
> instance of ssh from perl a la "open (SSH, "| ssh myhost.com -l
> username")" and then using perl's print to control the ssh session.
>
> Another issue that presents itself is how to read from this instance of
> SSH...I can write to it, but I can't specify two pipes in the open
> statement...can I?
>
> Any help would be appreciated!
>
> Thanks!!
>
> -Tim
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>
--
Lance Tost <ltost at pobox.com>
More information about the wplug
mailing list