Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat ./telnetTest.sh
- #!/bin/bash
- while read line
- do
- telnet $line
- done
- $
- $ echo "testhost" | ./telnetTest.sh
- Trying 192.168.1.1...
- Connected to testhost (192.168.1.1).
- Escape character is '^]'.
- Connection closed by foreign host.
- $
- #!/bin/bash
- for HOST in `cat`
- do
- echo Connecting to $HOST...
- telnet $HOST </dev/tty
- done
- #!/usr/bin/expect -f
- spawn telnet $host_name
- expect {
- "T0>" {}
- -re "Connection refused|No route to host|Invalid argument|lookup failure"
- {send_user "r******* connection error, bye.n";exit}
- default {send_user "r******* connection error (telnet timeout),
- bye.n";exit}
- }
- send "commandn"
- expect -timeout 1 "something"
- #!/bin/bash
- TTY=`tty` # Find out what tty we have been invoked from.
- for i in `cat hostnames.csv` # List of hosts/ports
- do
- # Separate port/host into separate variables
- host=`echo $i | awk -F, '{ print $1 }'`
- port=`echo $i | awk -F, '{ print $2 }'`
- telnet $host $port < $TTY # Connect to the current device
- done
- $ for i in `cat hostnames.txt`; do telnet $i; done
- for i in adele betty
- do
- ssh all@$i
- done
- xterm -e telnet $host $port
- #!/bin/sh
- #SSG_details is file from which script will read ip adress and uname/password
- #to telnet.
- SSG_detail=/opt/Telnet/SSG_detail.txt
- cat $SSG_detail | while read ssg_det ; do
- ssg_ip=`echo $ssg_det|awk '{print $1}'`
- ssg_user=`echo $ssg_det|awk '{print $2}'`
- ssg_pwd=`echo $ssg_det|awk '{print $3}'`
- echo " IP to telnet:" $ssg_ip
- echo " ssg_user:" $ssg_user
- echo " ssg_pwd:" $ssg_pwd
- sh /opt/Telnet/Call_Telenet.sh $ssg_ip $ssg_user $ssg_pwd
- done
- exit 0
- #!/bin/sh
- DELAY=1
- COMM1='config t' #/* 1st commands to be run*/
- COMM2='show run'
- COMM3=''
- COMM4=''
- COMM5='exit'
- COMM6='wr'
- COMM7='ssg service-cache refresh all'
- COMM8='exit' #/* 8th command to be run */
- telnet $1 >> $logfile 2>> $logfile |&
- sleep $DELAY
- echo -p $2 >> $logfile 2>> $logfile
- sleep $DELAY
- echo -p $3 >> $logfile 2>> $logfile
- sleep $DELAY
- echo -p $4 >> $logfile 2>> $logfile
- sleep $DELAY
- echo -p $5 >> $logfile 2>> $logfile
- sleep $DELAY
- sleep $DELAY
- sleep $DELAY
- sleep $DELAY
- echo -p $COMM7 >> $logfile 2>> $logfile
- sleep $DELAY
- echo -p $COMM8 >> $logfile 2>> $logfile
- sleep $DELAY
- exit 0
- $> ./test3.sh
- #!/bin/sh
- ( echo open hostname
- sleep 5
- echo username
- sleep 1
- echo password
- sleep 1
- echo some more output, etc. ) | telnet
Add Comment
Please, Sign In to add comment