Sponsored Content
Top Forums Shell Programming and Scripting BASH (or else) scripting for Telnet Post 302349791 by ppucci on Tuesday 1st of September 2009 08:30:50 PM
Old 09-01-2009
BASH (or else) scripting for Telnet

Hi everybody,

I am thinking on writing a shell script to telnet to Cisco routers, and I am looking for help. I have researched some and could not find much on the topic, or at least much of help anyway...

I read "expect" is one solution, but I am looking for something more flexible, as I might be looking into several different type of responses and actions.

For instance, I may get different prompts when logging in like:

Code:
Username:

or
Code:
Password:

and once I am past login, I might get either:

Code:
hostname>

for a session with no privileges
or
Code:
hostname#

for a session in privileged mode.

And so forth...

Any clues? Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

scripting Telnet

can someone tell me how i can write a shell script that will automatically log me in to any machines i want without bothering me for some password input? (i know i have to put in a password but I would like to take care of that in the script) can anyone help me here? (2 Replies)
Discussion started by: TRUEST
2 Replies

2. UNIX for Dummies Questions & Answers

Telnet FTP scripting

Hi quick question from a unix newbie Working on a project to get me using unix, the point of this project is to find a printer on the network check for jobs in the printer if the printer has no jobs do nothing if the printer has jobs then check the status for errors and e-mail the user. This... (2 Replies)
Discussion started by: w33man
2 Replies

3. Shell Programming and Scripting

Shell scripting with Telnet

Hi, im brasilian, sorry for bad english ok? Well, im writing one honeypot, look: #!/bin/bash echo "" echo `cat /etc/welcome.pot` echo "" echo -n "login: "; read usuario echo -n "Password: " #stty -echo read -s senha #stty echo exit Running it in localhost, thats right: ... (1 Reply)
Discussion started by: juniordevil
1 Replies

4. Shell Programming and Scripting

Need Help on Telnet using PERL Scripting

Iam trying to connect to a system through Telnet using net::Telnet Module #!/usr/bin/perl -w use net::Telnet $myPassword = "abcdef"; $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die'); $telnet->open (10.10.20.00); $telnet->waitfor ('/USERCODE: $/i'); $telnet->print('abc');... (2 Replies)
Discussion started by: sudhakaryadav
2 Replies

5. Shell Programming and Scripting

bash telnet session logging

I'm looking at allowing remote telnet into my server. like any security-minded administrator, I want to log what my users type on the telnet session. I'm using the script command to generate transcripts of the users session. I have /etc/profile set to automatically start the script command... (2 Replies)
Discussion started by: ramnet
2 Replies

6. Shell Programming and Scripting

bash scripting help

have this code but when i run it i get this error ./pulse: line 2: and here is the code #!/bin/bash if ; then pulseaudio -k; fi what am i doing wrong thanks Adam (5 Replies)
Discussion started by: ab52
5 Replies

7. Shell Programming and Scripting

Telnet using shell Scripting

i have written a script as shown below : telnet 10.161.240.2 8100 <?xml version="1.0"?> <login_command> <sequence id="1" /> <access id="1"/> <user name = "user1" password = "pass"/> </login_command> <?xml version="1.0"?> <RegistrationDescriptor> <sequence id="1" /> <access id="1"/>... (4 Replies)
Discussion started by: akrati1
4 Replies

8. Shell Programming and Scripting

Expect scripting telnet stop on bad username or password

I am trying to build and expect script to log into multiple aix boxes and change password. I need for the script to terminate if it cannot log into a server because the username or password is wrong. #!/usr/bin/expect set timeout 1 set host set user set password set uh "Unknown host" set... (3 Replies)
Discussion started by: leemalloy
3 Replies

9. Shell Programming and Scripting

Telnet Bash Script (Connection closed by foreign host.)

Hello Everyone, My following script is giving me problems, when the SIP trunk goes down and the telnet session is started and just when the command is about to complete the connection is closed then script restarts. I have noticed that as soon the script types in "sys re" or "sys rebo" or... (6 Replies)
Discussion started by: jeetz
6 Replies

10. UNIX for Dummies Questions & Answers

AIX bash script - exiting freezed telnet

Hallo all I'm writing a little shellscript in aix in order to test the correct connection to a specific ip-port. I'm using the sleep|telnet combination. All works great if connection is already open.. But if telnet connection are in trying state... It doesn't exit and all the rest of the script... (4 Replies)
Discussion started by: libeccio
4 Replies
Regexp::Common::URI::telnet(3)				User Contributed Perl Documentation			    Regexp::Common::URI::telnet(3)

NAME
Regexp::Common::URI::telnet -- Returns a pattern for telnet URIs. SYNOPSIS
use Regexp::Common qw /URI/; while (<>) { /$RE{URI}{telnet}/ and print "Contains a telnet URI. "; } DESCRIPTION
$RE{URI}{telnet} Returns a pattern that matches telnet URIs, as defined by RFC 1738. Telnet URIs have the form: "telnet:" "//" [ user [ ":" password ] "@" ] host [ ":" port ] [ "/" ] Under "{-keep}", the following are returned: $1 The complete URI. $2 The scheme. $3 The username:password combo, or just the username if there is no password. $4 The username, if given. $5 The password, if given. $6 The host:port combo, or just the host if there's no port. $7 The host. $8 The port, if given. $9 The trailing slash, if any. REFERENCES
[RFC 1738] Berners-Lee, Tim, Masinter, L., McCahill, M.: Uniform Resource Locators (URL). December 1994. SEE ALSO
Regexp::Common::URI for other supported URIs. AUTHOR
Damian Conway (damian@conway.org) MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.be). BUGS AND IRRITATIONS
Bound to be plenty. LICENSE and COPYRIGHT This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail. This module is free software, and maybe used under any of the following licenses: 1) The Perl Artistic License. See the file COPYRIGHT.AL. 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2. 3) The BSD Licence. See the file COPYRIGHT.BSD. 4) The MIT Licence. See the file COPYRIGHT.MIT. perl v5.16.2 2010-02-23 Regexp::Common::URI::telnet(3)
All times are GMT -4. The time now is 04:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy