Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting & PUTTY.exe 3

Status
Not open for further replies.

kevint21

Programmer
Apr 25, 2001
52
GB
Is it possible to run a script to execute putty. I run putty 6 times each morning to login to different routers. I do a show techcommand on the routers. Is it possible to generate a script that i can click on and just login to the router to do this show tech without having to type in the IP address and my tacacs password, etc - ie doing each line in putty manually.

Any advice would be welcome.
 
I don't know if Putty can run scripts but I've previously used (and still do use) another freeware terminal emulator to run similar scripts for me. The one I use is called Teraterm and is freely available for download.
 
Thanks for making an effort. I do use Teraterm myself in work to login to routers. What i'm trying to do is write a script that does the following..

1. open telnet
2. log all session data to say myfile.txt
3. click on session
4. enter the ip address (router)
5. then put in my login username and password for the router
6. do a show tech command on the router
7. exit

I found software called TST10.exe but i'm not sure how to use it.
 
I do something similar in windows telnet.
Daily I open telnet (Winxp)
I start a logfile
"set logfile tl-20060525.txt"
This turns on logging and writes to file name "tl-20060525.txt" in the same directory as the telnet.exe.

then I open a connection to say...
"open 172.16.1.14"

then I copy a lines of commands i want to send

username
password
enable
enablepassword
show clock
terminal length 0
show interface
show ip route
.....
....ect....

and the logfile captures all the output.

I normally open other connections in the same window as each one finishes. One problem with this is to continue logging to this file, you have to leave the window open. Or create another log filename when you open another session as it will with out warning overwrite you previous log.

I find this very usefull and have gotten a lot of mileage out of this from management. I log every command I issue and have been for years.

I use Putty for my SSH connections and it's nice because it will append output to an existing file. I set it up where it creates one file per day and appends all the activity (Putty) to that file.

What Id like to do is create a macro, or batch file that I can trigger to collect information at intervals. to watch a suspect circuit for example. Something automated. I keep looking for someone to post the solution now and then but haven’t spent a lot of time on it. I'm more or less looking for a freebee.
 
If it were me, I would do it a completely different way. I would install ActiveState's Window's version of Perl and write all the scripts you want and have total control over everything. I do this from a Linux box and monitor switches, routers, logs files, SMTP, POP, HTTP and everything else you can think of. Heck I even write triggers that will call my cell phone and send me an SMS text message when a trigger is found.

You can do the same thing in Windows and monitor and parse the results via SSH with just a few lines of code. You can make your scripts run as a daemon 24/7 if you want (which I do) and do its thing at different times, days, weeks or ?

I wouldn't know what I would do without Perl,
Jen
 
Jenn01
Thats where i want to be. Exactly where you are. I don't have all the skill necessary yet. Thanks.
 
Hey Ru55ell,

Perl is fairly easy to learn and there's a ton of support out there and chances are, what you need has already been written. There are already perl packages for connecting with Cisco routers. Check this out:


For a secure connection using SSH, check this out (sample program - search ssh):


As an administrator I can say that you learning a little Perl will go a long way to making your life a lot easier and since it doesn't care what platform you are using, you can use your scripts on your Unix boxes, MACs or the dreaded Windows platform. Try porting your putty.exe to something else.

Have a great weekend,
Jen
 
Jen and Ru55ell - thanks for the posts. Just for the record i actually got this going this week. I got software called KiwiCatTools (off their website) and it lets you run an automated script that will login to putty (telnet) etc and also run through whatever commands you want to do on the router is show tech and save them to a .txt file.

Works a treat. 10/10 for this software. You can even put your username and passwords in so it can login to the router and set it on a timer etc. Excellant.
 
Sounds great kevint21. Now all you have to worry about is your Windows machine crashing, worms, viruses and all the other problems that come with Windows. hahahaha

Have great holiday weekend,
Jen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top