Expect telnet password is exposed

A

Ajay

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
}
}
 
B

Ben Morrow

Ajay said:
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
 
A

Ajay

Ben said:
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 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...
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 address removed)
 
B

Ben Morrow

Ajay said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top