Re: Shell Scripts for automating Telnet sessions

2003-07-30 Thread Jeff Kinz
On Wed, Jul 30, 2003 at 09:06:24AM -0700, pnelson wrote:
> On Wed, 2003-07-30 at 02:48, anil garrepally wrote:
> > Can anyone tell me how to write a  Bash script, that will do 
> > telnet login to one machine and do some activity on that logged 
> > machine.
> > 
> > I was informed that .telnetrc file will help,if so what is the 
> > entry i should add in to that file.
> > 
> > where can i found Any kind of information related to scripting for 
> > Networking activities.Any help would be appreciated.
> 
> Investigate expect a very powerful tcl extension.

Absolutely - here is a primitive example.  This script returns the count
of emails waiting on your pop server.  I used to use it in a script
that would run "fetchmail"



# CUT HERE
#!/usr/bin/expect

log_user 0
eval spawn telnet -l myusername pop.my_isp.com 110
expect "ready."
send "user myusername\r"
expect "PASS"
send "pass MYPASSWORD\r"
expect "welcome"
send "stat\r"
expect "+OK "
expect -re "\[0-9]* "
set answer $expect_out(0,string)
send_user "$answer \r\n"
expect -re "\[0-9]*\r\n"
send "quit\r"
expect "signing off"
exit
#
# CUT HERE


> 
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]
> https://www.redhat.com/mailman/listinfo/redhat-list
> 

-- 
Jeff Kinz, Open-PC, Emergent Research,  Hudson, MA.  [EMAIL PROTECTED]
copyright 2003.  Use is restricted. Any use is an 
acceptance of the offer at http://www.kinz.org/policy.html.
Don't forget to change your password often.


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list


Re: Shell Scripts for automating Telnet sessions

2003-07-30 Thread Jack Bowling
On Wed, Jul 30, 2003 at 11:10:18AM -0500, Ed Wilts wrote:
> On Wed, 2003-07-30 at 02:48, anil garrepally wrote:
> > Can anyone tell me how to write a  Bash script, that will do 
> > telnet login to one machine and do some activity on that logged 
> > machine.
> > 
> > I was informed that .telnetrc file will help,if so what is the 
> > entry i should add in to that file.
> > 
> > where can i found Any kind of information related to scripting for 
> > Networking activities.Any help would be appreciated.
> 
> My suggestion would be to use ckermit.  It's included with Red Hat Linux
> and is an extremely powerful scripting language.
> 
> Alternatively, copy the script over to the other machine and then use an
> ssh or rsh commmand line to execute it.  i.e.
> $ scp foo system:
> $ ssh system ./foo
> The later example would only work if the script doesn't require any
> input of course.

ckermit is the ticket. It also has hooks for ssh.

-- 
Jack Bowling
mailto: [EMAIL PROTECTED]


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list


Re: Shell Scripts for automating Telnet sessions

2003-07-30 Thread Ed Wilts
On Wed, 2003-07-30 at 02:48, anil garrepally wrote:
> Can anyone tell me how to write a  Bash script, that will do 
> telnet login to one machine and do some activity on that logged 
> machine.
> 
> I was informed that .telnetrc file will help,if so what is the 
> entry i should add in to that file.
> 
> where can i found Any kind of information related to scripting for 
> Networking activities.Any help would be appreciated.

My suggestion would be to use ckermit.  It's included with Red Hat Linux
and is an extremely powerful scripting language.

Alternatively, copy the script over to the other machine and then use an
ssh or rsh commmand line to execute it.  i.e.
$ scp foo system:
$ ssh system ./foo
The later example would only work if the script doesn't require any
input of course.

-- 
Ed Wilts, Mounds View, MN, USA
mailto:[EMAIL PROTECTED]
Member #1, Red Hat Community Ambassador Program


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list


Re: Shell Scripts for automating Telnet sessions

2003-07-30 Thread pnelson
On Wed, 2003-07-30 at 02:48, anil garrepally wrote:
> Can anyone tell me how to write a  Bash script, that will do 
> telnet login to one machine and do some activity on that logged 
> machine.
> 
> I was informed that .telnetrc file will help,if so what is the 
> entry i should add in to that file.
> 
> where can i found Any kind of information related to scripting for 
> Networking activities.Any help would be appreciated.

Investigate expect a very powerful tcl extension.


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list


Re: Shell Scripts for automating Telnet sessions

2003-07-30 Thread Willem van der Walt<[EMAIL PROTECTED]>
do man nc or info nc
nc is netcat and can be used to do what you want.

On 30 Jul 2003, anil  garrepally wrote:

> Hi Everyone,
> 
> Can anyone tell me how to write a  Bash script, that will do 
> telnet login to one machine and do some activity on that logged 
> machine.
> 
> I was informed that .telnetrc file will help,if so what is the 
> entry i should add in to that file.
> 
> where can i found Any kind of information related to scripting for 
> Networking activities.Any help would be appreciated.
> 
> Thanks,
> Anil kumar.
> ___
> Download the hottest & happening ringtones here!
> OR SMS: Top tone to 7333
> Click here now: 
> http://sms.rediff.com/cgi-bin/ringtone/ringhome.pl
> 
> 
> 
> 


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list