Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Expect telnet password is exposed

Reply
Thread Tools

Expect telnet password is exposed

 
 
Ajay
Guest
Posts: n/a
 
      02-10-2004
Finally getting hookedup to expect
Here is the script i got to start with, it's working fine. I got it frm this NG.
Now i want to modify it to suit my taste.
1) I want to create a new xterm window from this script then telnet into the
remote server and then run the other commands.
2) In the script i have to expose password. How to amke it secure secure it ?
Any help will be appreciated.

Tx
Ajay

#!/opt/exp/bin/expect -f

set name "myname"
set password "XYZ"
set host "server1"
set prompt_regexp "\\$"
set timeout 60

spawn telnet $host

expect {
login: {
send "$name\n"
} timeout {
send_user "connection to $host timed out.\n"
exit
} eof {
send_user "connection to $host failed: $expect_out(buffer).\n"
exit
}
}

expect {
Password: {
send "$password\n"
} timeout {
send_user "connection to $host timed out.\n"
exit
} eof {
send_user "connection to $host failed: $expect_out(buffer).\n"
exit
}
}
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      02-10-2004

Ajay <(E-Mail Removed)> wrote:
> Finally getting hookedup to expect
> Here is the script i got to start with, it's working fine. I got it frm this NG.


> #!/opt/exp/bin/expect -f


I find that unlikely: this is a Perl ng.

> Now i want to modify it to suit my taste.
> 1) I want to create a new xterm window from this script then telnet into the
> remote server and then run the other commands.


You need to create a shell script that runs

xterm -e /path/to/expect/script

> 2) In the script i have to expose password. How to amke it secure secure it ?


You're using telnet, so you're screwed anyway wrt security. In
general, you can either ask the user for the password each time (and
no, I don't know if/how you can do that in expect) or just make sure
the read permissions on the script are as tight as possible.

Ben

--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ] http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Ajay
Guest
Posts: n/a
 
      02-10-2004
Ben Morrow wrote:
>
> Ajay <(E-Mail Removed)> wrote:
> > Finally getting hookedup to expect
> > Here is the script i got to start with, it's working fine. I got it frm this NG.

>
> > #!/opt/exp/bin/expect -f

>
> I find that unlikely: this is a Perl ng.


kindly guide me to "expect" grp please || tell me the appropriate grp where i
can post expect related Qs

> > Now i want to modify it to suit my taste.
> > 1) I want to create a new xterm window from this script then telnet into the
> > remote server and then run the other commands.

>
> You need to create a shell script that runs
>
> xterm -e /path/to/expect/script

Yeh that's what i do. But i think i can do a fork and run telnet and other
commands inside that process. Still hunting Google...

> > 2) In the script i have to expose password. How to amke it secure secure it ?

>
> You're using telnet, so you're screwed anyway wrt security. In
> general, you can either ask the user for the password each time (and
> no, I don't know if/how you can do that in expect) or just make sure
> the read permissions on the script are as tight as possible.

i saw somewhere ppl talking about ssh.
how to do it into ssh ?
> Ben

Tx for reply
>
> --
> Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
> From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
> (Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
> /Alcestis/) [ flame, and falls out of sight. ] (E-Mail Removed)

 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a
 
      02-10-2004

Ajay <(E-Mail Removed)> wrote:
> Ben Morrow wrote:
> > Ajay <(E-Mail Removed)> wrote:
> >
> > > #!/opt/exp/bin/expect -f

> >
> > I find that unlikely: this is a Perl ng.

>
> kindly guide me to "expect" grp please || tell me the appropriate grp where i
> can post expect related Qs


You will find that politeness and full English sentences will get you
a long way in life. Try comp.lang.tcl (IIRC expect is written in or
for tcl), but don't blame me if it's wrong.

Ben

--
If I were a butterfly I'd live for a day, / I would be free, just blowing away.
This cruel country has driven me down / Teased me and lied, teased me and lied.
I've only sad stories to tell to this town: / My dreams have withered and died.
(E-Mail Removed) <=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>=<=>=<=> (Kate Rusby)
 
Reply With Quote
 
Glenn Jackman
Guest
Posts: n/a
 
      02-10-2004
Ajay <(E-Mail Removed)> wrote:
> Ben Morrow wrote:
> > Ajay <(E-Mail Removed)> wrote:
> > > #!/opt/exp/bin/expect -f

> > I find that unlikely: this is a Perl ng.

> kindly guide me to "expect" grp please || tell me the appropriate grp where i
> can post expect related Qs


comp.lang.tcl


--
Glenn Jackman
NCF Sysadmin
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Telnet - attempting to initiate a telnet session within an established telnet session Carcarius Ruby 0 12-06-2007 03:26 AM
perl expect script for telnet vinayaka gv General Computer Support 0 10-11-2007 12:07 PM
how to expect eof with expect+pty Simon Strandgaard Ruby 4 12-20-2006 04:00 PM
Bug in $obj->expect() ... ? (Expect 1.15) Phil Perl Misc 0 07-07-2006 07:25 AM
How can I telnet when I dont have specific access to a telnet client Jack B. Pollack Computer Support 4 07-24-2003 08:58 PM



Advertisments