[cactiuser@tat scripts]$ telnet 192.168.9.2 + Trying 192.168.9.2... + Connected to 192.168.9.2 (192.168.9.2). + Escape character is '^]'. + + HP-UX SMSCN2 B.11.00 U 9000/800 (ta) + + login: shineyang Password: secret Please wait...checking for disk quotas + (c)Copyright 1983-1997 Hewlett-Packard Co., All Rights Reserved. + (c)Copyright 1979, 1980, 1983, 1985-1993 The Regents of the Univ. of C +alifornia (c)Copyright 1980, 1984, 1986 Novell, Inc. + (c)Copyright 1986-1992 Sun Microsystems, Inc. + (c)Copyright 1985, 1986, 1988 Massachusetts Institute of Technology + (c)Copyright 1989-1993 The Open Software Foundation, Inc. + (c)Copyright 1986 Digital Equipment Corp. + (c)Copyright 1990 Motorola, Inc. + (c)Copyright 1990, 1991, 1992 Cornell University + (c)Copyright 1989-1991 The University of Maryland + (c)Copyright 1988 Carnegie Mellon University + (c)Copyright 1991-1997 Mentat, Inc. + (c)Copyright 1996 Morning Star Technologies, Inc. + (c)Copyright 1996 Progressive Systems, Inc. + (c)Copyright 1997 Isogon Corporation + + + RESTRICTED RIGHTS LEGEND + Use, duplication, or disclosure by the U.S. Government is subject to + restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in + Technical Data and Computer Software clause in DFARS 252.227-7013. + + + Hewlett-Packard Company + 3000 Hanover Street + Palo Alto, CA 94304 U.S.A. + + Rights for non-DOD U.S. Government Departments and Agencies are as set + forth in FAR 52.227-19(c)(1,2). + You have mail. + TERM = (hp) vt100
[telepath@SMSCN2] bye + Connection closed by foreign host.
############################
The following is the original perl script
############################
[cactiuser@tat scripts]$ cat test-n2.pl + #!/usr/bin/perl + use Net::Telnet; + use constant HOST => '192.168.9.2'; + use constant USER => 'shineyang'; + use constant PASS => 'secret'; + my $khprompt = '/\[telepath\@SMSCN2\]\s/'; + my $term = 'vt100'; + &getdata; + + sub getdata #Get the data from NG SMSC series + { + open (result, "> /home/cactiuser/TWM_N4/log/result-hourly.txt"); + my $t= Net::Telnet->new(HOST => '192.168.9.2', + Dump_Log => 'test-dump.txt', + Input_log => 'test-input.txt', + PORT => 23, + ERRMODE => "return", + Prompt => $khprompt, + Timeout => 10); + print "Connected-192.168.9.2\n"; + unless ( defined $t ) + { + print "problem connecting\n"; + exit; + } + #$t->print ('vt100') or die "cannot go next" ; + $t->login( Name => USER, + Password => PASS, + Timeout => 20, + ) or die "Cannot login "; + + $t->prompt('/TERM\s/=\s/(hp/)\s/'); + $t->cmd( String => $term, + Dump_Log => 'cmd-dump.txt', + Input_log => 'cmd-input.txt', + ); + $t->cmd('ls'); + $t->cmd('exit'); + $t->close; + close(result); + }
#####################
The following is the Error Msg
#####################
[cactiuser@tat scripts]$ perl test-n2-new.pl + Connected-192.168.9.2 + Cannot login at test-n2-new.pl line 27
############
The Debug log
##############
[cactiuser@tat scripts]$ cat test-dump.txt + < 0x00000: ff fd 24 + + > 0x00000: ff fc 24 + + < 0x00000: ff fd 18 + + > 0x00000: ff fc 18 + + < 0x00000: ff fe 18 ff fd 20 + + > 0x00000: ff fc 20 + + < 0x00000: ff fe 20 ff fb 01 ff fb 03 ff fd 1f ff fd 21 ff + < 0x00010: fd 01 0d 0a 48 50 2d 55 58 20 53 4d 53 43 4e 32 ..HP-UX SMS +CN2 < 0x00020: 20 42 2e 31 31 2e 30 30 20 55 20 39 30 30 30 2f B.11.00 U 9 +000/ < 0x00030: 38 30 30 20 28 74 61 29 0d 0a 0d 0a 800 (ta).... + + > 0x00000: ff fd 01 ff fd 03 ff fc 1f ff fc 21 ff fc 01 + + < 0x00000: ff fe 1f + + < 0x00000: ff fe 21 + + < 0x00000: ff fe 01 + + < 0x00000: 6c 6f 67 69 6e 3a 20 login: + + > 0x00000: xx xx xx xx xx xx xx xx 0d 0a xxxxxxxx.. + + > 0x00000: xx xx xx xx xx xx xx xx 0d 0a xxxxxxxx.. + < 0x00000: 50 61 73 73 77 6f 72 64 3a 20 Password: + + > 0x00000: xx xx xx xx xx xx xx xx 0d 0a xxxxxxxx.. + + < 0x00000: 0d 0a .. + + < 0x00000: 50 6c 65 61 73 65 20 77 61 69 74 2e 2e 2e 63 68 Please wait +...ch < 0x00010: 65 63 6b 69 6e 67 20 66 6f 72 20 64 69 73 6b 20 ecking for +disk < 0x00020: 71 75 6f 74 61 73 0d 0a quotas.. + + < 0x00000: 28 63 29 43 6f 70 79 72 69 67 68 74 20 31 39 38 (c)Copyrigh +t 198 < 0x00010: 33 2d 31 39 39 37 20 48 65 77 6c 65 74 74 2d 50 3-1997 Hewl +ett-P < 0x00020: 61 63 6b 61 72 64 20 43 6f 2e 2c 20 20 41 6c 6c ackard Co.. + All < 0x00030: 20 52 69 67 68 74 73 20 52 65 73 65 72 76 65 64 Rights Rese +rved < 0x00040: 2e 0d 0a 28 63 29 43 6f 70 79 72 69 67 68 74 20 ...(c)Copyr +ight < 0x00050: 31 39 37 39 2c 20 31 39 38 30 2c 20 31 39 38 33 1979. 1980. + 1983 < 0x00060: 2c 20 31 39 38 35 2d 31 39 39 33 20 54 68 65 20 . 1985-1993 + The < 0x00070: 52 65 67 65 6e 74 73 20 6f 66 20 74 68 65 20 55 Regents of +the U < 0x00080: 6e 69 76 2e 20 6f 66 20 43 61 6c 69 66 6f 72 6e niv. of Cal +iforn < 0x00090: 69 61 0d 0a 28 63 29 43 6f 70 79 72 69 67 68 74 ia..(c)Copy +right < 0x000a0: 20 31 39 38 30 2c 20 31 39 38 34 2c 20 31 39 38 1980. 1984. + 198 < 0x000b0: 36 20 4e 6f 76 65 6c 6c 2c 20 49 6e 63 2e 0d 0a 6 Novell. I +nc... < 0x000c0: 28 63 29 43 6f 70 79 72 69 67 68 74 20 31 39 38 (c)Copyrigh +t 198 < 0x000d0: 36 2d 31 39 39 32 20 53 75 6e 20 4d 69 63 72 6f 6-1992 Sun +Micro < 0x000e0: 73 79 73 74 65 6d 73 2c 20 49 6e 63 2e 0d 0a 28 systems. In +c...( < 0x000f0: 63 29 43 6f 70 79 72 69 67 68 74 20 31 39 38 35 c)Copyright + 1985 < 0x00100: 2c 20 31 39 38 36 2c 20 31 39 38 38 20 4d 61 73 . 1986. 198 +8 Mas < 0x00110: 73 61 63 68 75 73 65 74 74 73 20 49 6e 73 74 69 sachusetts +Insti < 0x00120: 74 75 74 65 20 6f 66 20 54 65 63 68 6e 6f 6c 6f tute of Tec +hnolo < 0x00130: 67 79 0d 0a 28 63 29 43 6f 70 79 72 69 67 68 74 gy..(c)Copy +right < 0x00140: 20 31 39 38 39 2d 31 39 39 33 20 20 54 68 65 20 1989-1993 T +he < 0x00150: 4f 70 65 6e 20 53 6f 66 74 77 61 72 65 20 46 6f Open Softwa +re Fo < 0x00160: 75 6e 64 61 74 69 6f 6e 2c 20 49 6e 63 2e 0d 0a undation. I +nc... < 0x00170: 28 63 29 43 6f 70 79 72 69 67 68 74 20 31 39 38 (c)Copyrigh +t 198 < 0x00180: 36 20 44 69 67 69 74 61 6c 20 45 71 75 69 70 6d 6 Digital E +quipm < 0x00190: 65 6e 74 20 43 6f 72 70 2e 0d 0a 28 63 29 43 6f ent Corp... +(c)Co < 0x001a0: 70 79 72 69 67 68 74 20 31 39 39 30 20 4d 6f 74 pyright 199 +0 Mot < 0x001b0: 6f 72 6f 6c 61 2c 20 49 6e 63 2e 0d 0a 28 63 29 orola. Inc. +..(c) < 0x001c0: 43 6f 70 79 72 69 67 68 74 20 31 39 39 30 2c 20 Copyright 1 +990. < 0x001d0: 31 39 39 31 2c 20 31 39 39 32 20 43 6f 72 6e 65 1991. 1992 +Corne < 0x001e0: 6c 6c 20 55 6e 69 76 65 72 73 69 74 79 0d 0a 28 ll Universi +ty..( < 0x001f0: 63 29 43 6f 70 79 72 69 67 68 74 20 31 39 38 39 c)Copyright + 1989 < 0x00200: 2d 31 39 39 31 20 54 68 65 20 55 6e 69 76 65 72 -1991 The U +niver < 0x00210: 73 69 74 79 20 6f 66 20 4d 61 72 79 6c 61 6e 64 sity of Mar +yland < 0x00220: 0d 0a 28 63 29 43 6f 70 79 72 69 67 68 74 20 31 ..(c)Copyri +ght 1 < 0x00230: 39 38 38 20 43 61 72 6e 65 67 69 65 20 4d 65 6c 988 Carnegi +e Mel < 0x00240: 6c 6f 6e 20 55 6e 69 76 65 72 73 69 74 79 0d 0a lon Univers +ity.. < 0x00250: 28 63 29 43 6f 70 79 72 69 67 68 74 20 31 39 39 (c)Copyrigh +t 199 < 0x00260: 31 2d 31 39 39 37 20 4d 65 6e 74 61 74 2c 20 49 1-1997 Ment +at. I < 0x00270: 6e 63 2e 0d 0a 28 63 29 43 6f 70 79 72 69 67 68 nc...(c)Cop +yrigh < 0x00280: 74 20 31 39 39 36 20 4d 6f 72 6e 69 6e 67 20 53 t 1996 Morn +ing S < 0x00290: 74 61 72 20 54 65 63 68 6e 6f 6c 6f 67 69 65 73 tar Technol +ogies < 0x002a0: 2c 20 49 6e 63 2e 0d 0a 28 63 29 43 6f 70 79 72 . Inc...(c) +Copyr < 0x002b0: 69 67 68 74 20 31 39 39 36 20 50 72 6f 67 72 65 ight 1996 P +rogre < 0x002c0: 73 73 69 76 65 20 53 79 73 74 65 6d 73 2c 20 49 ssive Syste +ms. I < 0x002d0: 6e 63 2e 0d 0a 28 63 29 43 6f 70 79 72 69 67 68 nc...(c)Cop +yrigh < 0x002e0: 74 20 31 39 39 37 20 49 73 6f 67 6f 6e 20 43 6f t 1997 Isog +on Co < 0x002f0: 72 70 6f 72 61 74 69 6f 6e 0d 0a 0d 0a 20 20 0d rporation.. +.. . < 0x00300: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 . + < 0x00310: 20 20 20 20 20 20 20 20 20 20 20 20 52 45 53 54 REST + < 0x00320: 52 49 43 54 45 44 20 52 49 47 48 54 53 20 4c 45 RICTED RIGH +TS LE < 0x00330: 47 45 4e 44 0d 0a 55 73 65 2c 20 64 75 70 6c 69 GEND..Use. +dupli < 0x00340: 63 61 74 69 6f 6e 2c 20 6f 72 20 64 69 73 63 6c cation. or +discl < 0x00350: 6f 73 75 72 65 20 62 79 20 74 68 65 20 55 2e 53 osure by th +e U.S < 0x00360: 2e 20 47 6f 76 65 72 6e 6d 65 6e 74 20 69 73 20 . Governmen +t is < 0x00370: 73 75 62 6a 65 63 74 20 74 6f 0d 0a 72 65 73 74 subject to. +.rest < 0x00380: 72 69 63 74 69 6f 6e 73 20 61 73 20 73 65 74 20 rictions as + set < 0x00390: 66 6f 72 74 68 20 69 6e 20 73 75 62 2d 70 61 72 forth in su +b-par < 0x003a0: 61 67 72 61 70 68 20 28 63 29 28 31 29 28 69 69 agraph (c)( +1)(ii < 0x003b0: 29 20 6f 66 20 74 68 65 20 52 69 67 68 74 73 20 ) of the Ri +ghts < 0x003c0: 69 6e 0d 0a 54 65 63 68 6e 69 63 61 6c 20 44 61 in..Technic +al Da < 0x003d0: 74 61 20 61 6e 64 20 43 6f 6d 70 75 74 65 72 20 ta and Comp +uter < 0x003e0: 53 6f 66 74 77 61 72 65 20 63 6c 61 75 73 65 20 Software cl +ause < 0x003f0: 69 6e 20 44 46 41 52 53 20 32 35 32 2e 32 32 37 in DFARS 25 +2.227 + < 0x00000: 2d 37 30 31 33 2e 0d 0a 20 20 0d 0a 20 20 0d 0a -7013... .. + .. < 0x00010: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + < 0x00020: 20 20 20 20 20 20 20 20 20 20 20 48 65 77 6c 65 Hewle + < 0x00030: 74 74 2d 50 61 63 6b 61 72 64 20 43 6f 6d 70 61 tt-Packard +Compa < 0x00040: 6e 79 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 ny.. + < 0x00050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 3 + < 0x00060: 30 30 30 20 48 61 6e 6f 76 65 72 20 53 74 72 65 000 Hanover + Stre < 0x00070: 65 74 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 et.. + < 0x00080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 P + < 0x00090: 61 6c 6f 20 41 6c 74 6f 2c 20 43 41 20 39 34 33 alo Alto. C +A 943 < 0x000a0: 30 34 20 55 2e 53 2e 41 2e 0d 0a 20 20 0d 0a 52 04 U.S.A... + ..R < 0x000b0: 69 67 68 74 73 20 66 6f 72 20 6e 6f 6e 2d 44 4f ights for n +on-DO < 0x000c0: 44 20 55 2e 53 2e 20 47 6f 76 65 72 6e 6d 65 6e D U.S. Gove +rnmen < 0x000d0: 74 20 44 65 70 61 72 74 6d 65 6e 74 73 20 61 6e t Departmen +ts an < 0x000e0: 64 20 41 67 65 6e 63 69 65 73 20 61 72 65 20 61 d Agencies +are a < 0x000f0: 73 20 73 65 74 0d 0a 66 6f 72 74 68 20 69 6e 20 s set..fort +h in < 0x00100: 46 41 52 20 35 32 2e 32 32 37 2d 31 39 28 63 29 FAR 52.227- +19(c) < 0x00110: 28 31 2c 32 29 2e 0d 0a (1.2)... + + < 0x00000: 59 6f 75 20 68 61 76 65 20 6d 61 69 6c 2e 0d 0a You have ma +il... + < 0x00000: 54 45 52 4d 20 3d 20 28 TERM = ( + + < 0x00000: 68 70 hp + + < 0x00000: 29 20 )
20070713 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips, obscured password and login
In reply to The problem about the module-"Net::telnet" by shineyang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |