Sponsored Content
Full Discussion: problem with Net::Telnet
Top Forums Shell Programming and Scripting problem with Net::Telnet Post 302314595 by ghostdog74 on Friday 8th of May 2009 07:44:33 PM
Old 05-08-2009
make sure you have a remote server to connect to, i hope its not really "home" (or is it?)
make sure remote server is configured to allow root login.
make sure telnetd is running on the remote server
make sure your prompt is correct
 

10 More Discussions You Might Find Interesting

1. Solaris

boot net problem

Hi my friends when I want to make boot net for my server I have receive: Time out ARP/RARP note: I have use Ok boot net (this is my Syntax) so what is the problem? (2 Replies)
Discussion started by: bintaleb
2 Replies

2. Shell Programming and Scripting

Webpage to Telnet via Perl and Expect: Telnet problem?

Somewhat long story: I have a simple Perl CGI script that uses Expect to Telnet to a device and grab some data, and then spits it back to Perl for display on the Webpage. This works for many devices I've tried, but one device just fails, it keeps rejecting the password on this device, only... (1 Reply)
Discussion started by: jondo
1 Replies

3. Shell Programming and Scripting

Need Help on "waitfor" command in net::Telnet Module

Hi, Can anybody help me in writing command "waitfor" for string "C:\WINNT\Profiles\mfcf0508>" while using net::Telnet module. I tried the below format : $telnet->waitfor('/"C\:\WINNT\Profiles\mfcf0508>".*$/i'); Getting error as : pattern match timed-out Plz help me (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

4. Windows & DOS: Issues & Discussions

Need Help on "waitfor" command in net::Telnet Module in PERL

Hi, Can anybody help me in writing command "waitfor" for string "C:\WINNT\Profiles\mfcf0508>" while using net::Telnet module. I tried the below format : $telnet->waitfor('/"C\:\WINNT\Profiles\mfcf0508>".*$/i'); Getting error as : pattern match timed-out Plz help me (3 Replies)
Discussion started by: sudhakaryadav
3 Replies

5. Shell Programming and Scripting

Need help on use of "cmd" command in net::Telnet module in PERL

in "cmd" command i want to copy the ouput of the command excuted to a particular file in a directory. How to do this..?? Ex : $telnet->cmd(String => 'allip:acl=a1;',Prompt => '/</'); i want to copy o/p of the command "allip:acl=a1;" in a log file in a particular directory. Plz suggest.. (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

6. Shell Programming and Scripting

Using Net::Telnet in Perl to connect to an adsl modem

Hello, First of all, congratulations on this forum! Very mice material! This is my fist thread and it has to do with connecting to an adsl modem and executing some commands. Heres what I do: $username = 'admin'; $passwd = 'admin'; $telnet = new Net::Telnet ( Timeout=>10,... (2 Replies)
Discussion started by: Ravendark
2 Replies

7. Shell Programming and Scripting

Pressing "Enter/Space bar" using Net::TELNET? in Perl

I'm trying to learn how to get my script to execute the enter button when it telnets into a router and the router displays output but you need to press the space bar or enter button to continue displaying my output of the router. How is this done? (0 Replies)
Discussion started by: xmaverick
0 Replies

8. Shell Programming and Scripting

NET::FTP Problem

I am facing some problem in the NET::FTP Library in perl script in the HPUX. I am using NET::FTP to ftp files from 23 remote servers. Except 1 server everything is working fine. I am getting this error from one server . but normal FTP is working fine for that server. everytime few files are ftped... (1 Reply)
Discussion started by: mohanm
1 Replies

9. Shell Programming and Scripting

Net::Telnet (match prompt)

Hi, The code below is used to telnet to list of devices and configure them. The program executes in this manner: 1. telnet to the first device in file.txt 2. one the telnet command is executed a "press any key to continue" prompts. 3. once a return key is executed it ask for username,... (1 Reply)
Discussion started by: sureshcisco
1 Replies

10. Shell Programming and Scripting

Perl variables inside Net::Telnet::Cisco Module doesn't work

I am writing perl script to configure Cisco device but Variables inside Net::Telnet::Cisco Module doesn't work and passed to device without resolving. Please advise. here is a sample of script: use Net::Telnet::Cisco; $device = "10.14.199.1"; ($o1, $o2, $o3, $o4) = split(/\./,$device);... (5 Replies)
Discussion started by: ahmed_zaher
5 Replies
Net::CLI::Interact::Manual::Cookbook(3pm)		User Contributed Perl Documentation		 Net::CLI::Interact::Manual::Cookbook(3pm)

NAME
Net::CLI::Interact::Manual::Cookbook - Miscellaneous recipes Windows Support The library works just fine under native windows (i.e use something like Strawberry Perl - no need for cygwin), for Telnet, Serial and SSH connections. However one additional step is required for you to have success: You must download the "plink.exe" application, and pass its filesystem location in the "app" parameter to "new()". Do not try to use any other Telnet or SSH programs (for instance the Windows bundled "telnet") - they will not work. Here's an example: my $s = Net::CLI::Interact->new( personality => "cisco", transport => "Telnet", (Net::CLI::Interact::Transport::is_win32() ? (app => "$ENV{HOMEPATH}\Desktop\plink.exe") : () ), ); Unix Support The library works fine on most Unix platforms. It will try to use the native "telnet", "ssh" (openssh) and "cu" programs for Telnet, SSH and Serial connections, respectively. If you want to use another application, pass it in the "app" parameter to "new". In some Unix environments there can be zombie child processes left around after running your script. If this happens, set the "reap" option, like so: my $s = Net::CLI::Interact->new( personality => "cisco", transport => "Telnet", connect_options => { reap => 1, }, ); Phrasebook Entries Prompts These are nothing more than named regular expressions: prompt configure match /(config[^)]*)# ?$/ Macros This example waits for the device to ask "[startup-config]?" and then responds with the text "startup-config". macro copy_run_start send copy running-config startup-config match /Destination filename [startup-config]?$/ send startup-config To send instead a press of the Return key (output record separator), use: macro write_mem send copy running-config startup-config match /Destination filename [startup-config]?$/ send '' To instead allow the user to pass in the file name, use a "sprintf" format. macro save_to_file send copy running-config startup-config match /Destination filename [startup-config]?$/ send %s The user must then pass a parameter to the "macro" call, even if it's an empty string: $s->macro('save_to_file', { params => ['file_name'] }); # or $s->macro('save_to_file', { params => [''] }); Continuations These are Macros which start with a match instead of a send: macro more_pages match / --More-- / send ' ' Note that the parameter of the "send" is not sent with a Return character (output record separator) appended. When included in a macro, the continuation can be in-line, like this: macro show_ip_route send show ip route follow / --More-- / with ' ' Running Commands Standalone Commands Simply send the command you wish to execute to the library. If not already done, a connection to the device will be established automatically: $s->cmd('show ip int br'); Normally this matches against a default prompt, which has been discovered automatically, or set by you: $s->set_prompt('user_prompt'); It's also possible to pass in a custom prompt for this command only: $s->cmd('show ip int br', { match => qr/special prompt>$/ }); Composite Macro Commands Call a predefined Macro from the phrasebook using this method: $s->macro('write_mem'); Sometimes the Macro needs parameters: $s->macro('to_priv_exec', { params => ['my_password'] }); You can't really create a Macro on the fly very easily, but with suitable use of "cmd()", "set_prompt()", and the "match" option to "cmd()" it's possible to achieve some simple flexibility. Reconfiguring On-the-Fly Phrasebook It's possible to load a new phrasebook by the following method, which must be passed at least the name of the personality: $s->set_phrasebook({ personality => 'ios' }); You can pass any options which the Phrasebook module itself would take. Prompt The current prompt can be changed by passing the name of the new Prompt as it is known by the phrasebook: $s->set_prompt('name'); If you want to test whether the current prompt matches a diffrent named Prompt from the phrasebook, this method can be used: $s->prompt_looks_like('name'); perl v5.14.2 2012-06-12 Net::CLI::Interact::Manual::Cookbook(3pm)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy