Hello everyone,
I'm trying to use Net::Telnet to connect to a server that has a test
account called (appropriately) TEST. It has no password on doing a
normal telnet to the server after supplying the username, I am taken to
the shell rather than being prompted for my password.
The prompt I'm given is:
TEST F50:/genii4 $
Heres's the script I wrote:
#!/usr/bin/perl -w
#
use strict;
use Net::Telnet();
my $host = "172.16.1.2";
my $user = "TEST";
my $pass = "";
my $t = new Net::Telnet(Timeout => 30, Dump_Log => "/tmp/log-dump");
$t->open("$host");
$t->login(Name => $user, Password => $pass);
$t->waitfor('/.*genii4.*\$$/');
$t->print('cd $GENSRC');
$t->cmd('cd g2oesrc');
my @pwd = $t->cmd("pwd");
print @pwd;
$t->close();
This is what's in the log-dump file:
< 0x00000: ff fe 25 ff fd 18 ��%��.
> 0x00000: ff fc 18 ��.
< 0x00000: ff fe 18 ff fd 18 ff fb 01 ff fb 03 ff fd 1f ff
��.��.��.��.��.�
< 0x00010: fc c8 ff fd 01 0d 0a 0d 0a 74 65 6c 6e 65 74 20
����.....telnet
< 0x00020: 28 66 35 30 2e 75 61 76 63 6f 2e 63 6f 6d 29 0d
(f50.uavco.com).
< 0x00030: 0a 0d 00 0d 0a 0d 00 .......
> 0x00000: ff fc 18 ff fd 01 ff fd 03 ff fc 1f ff fc 01
��.��.��.��.��.
< 0x00000: ff fe 1f ff fe 01 ��.��.
< 0x00000: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
................
< 0x00010: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
................
< 0x00020: 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a 0d 0a
................
< 0x00030: 0d 0a 0d 00 41 49 58 20 56 65 72 73 69 6f 6e 20 ....AIX
Version
< 0x00040: 34 0d 0a 0d 00 28 43 29 20 43 6f 70 79 72 69 67 4....(C)
Copyrig
< 0x00050: 68 74 73 20 62 79 20 49 42 4d 20 61 6e 64 20 62 hts by
IBM and b
< 0x00060: 79 20 6f 74 68 65 72 73 20 31 39 38 32 2c 20 31 y others
1982. 1
< 0x00070: 39 39 36 2e 0d 0a 0d 00 6c 6f 67 69 6e 3a 20
996.....login:
> 0x00000: 54 45 53 54 0d 0a TEST..
< 0x00000: 54 45 53 54 0d 0a TEST..
< 0x00000: 4c 61 73 74 20 75 6e 73 75 63 63 65 73 73 66 75 Last
unsuccessfu
< 0x00010: 6c 20 6c 6f 67 69 6e 3a 20 57 65 64 20 4d 61 79 l login:
Wed May
< 0x00020: 20 33 31 20 30 39 3a 35 33 3a 34 30 20 45 44 54 31
09:53:40 EDT
< 0x00030: 20 32 30 30 30 20 6f 6e 20 2f 64 65 76 2f 70 74 2000 on
/dev/pt
< 0x00040: 73 2f 34 35 20 66 72 6f 6d 20 63 6f 67 6e 6f 73 s/45 from
cognos
< 0x00050: 0d 0a 4c 61 73 74 20 6c 6f 67 69 6e 3a 20 54 75 ..Last
login: Tu
< 0x00060: 65 20 4a 75 6c 20 32 39 20 31 30 3a 35 34 3a 34 e Jul 29
10:54:4
< 0x00070: 36 20 45 44 54 20 32 30 30 33 20 6f 6e 20 2f 64 6 EDT
2003 on /d
< 0x00080: 65 76 2f 70 74 73 2f 31 34 20 66 72 6f 6d 20 65 ev/pts/14
from e
< 0x00090: 63 2e 75 61 76 63 6f 2e 63 6f 6d 0d 0a 0d 0a
c.uavco.com....
< 0x00000: 54 45 53 54 20 46 35 30 3a 2f 67 65 6e 69 69 34 TEST
F50:/genii4
< 0x00010: 20 24 20 $
The error I get from Net::Telnet is:
timed-out waiting for password prompt at ./telnet.pl line 12
Can anyone offer any ideas how I can get around this. Don't worry about
security issues, it's an internal box and nothing important is on it, I
just need to test this as the TEST user.
I've also tried to set the Prompt parameter when initializing the object
like so:
my $t = new Net::Telnet(Timeout => 30,
Dump_Log => "/tmp/log-dump",
Prompt => '/genii4 ?$/i');
Still no luck.
Any help is appreciated...
Kevin
--
K Old <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]