| Author |
Expect script needs to send a password that contains the '#' character
|
|
| andriesb 2005-10-24, 3:45 pm |
| Hi,
I've been searching the Net and this group, and either I'm not
formulating my query correctly or no-one else has as yet run into this
(which I doubt) before me.
I have a few expect scripts. Small things that transfer files to a
different system. The security experts have changed the passwords on
these systems to contain the '#' character, which happens to be the
comment character in expect scripts. I've tried the normal escape
sequences but nothing seems to work.
Here is a sample script:
spawn ftp 10.0.0.38
expect "): "
send "user_id\r"
expect "assword:"
send "passw#1\r"
expect "ftp>"
send "put FILE1\r"
expect "ftp>"
send "put FILE2\r"
expect "ftp>"
send "bye\n"
When running this I simply get from the ftp application - not logged
in.
How do I fix this? (Changing the passwords are unfortunately not
possible - that would be the easy way out.)
Thanks in advance for the time spent reading this and for those of you
who do reply.
-AndriesB
| |
| Bill Marcum 2005-10-24, 3:45 pm |
| On 13 Oct 2005 08:12:23 -0700, andriesb
<ajpb@iafrica.com> wrote:
> Hi,
>
> I've been searching the Net and this group, and either I'm not
> formulating my query correctly or no-one else has as yet run into this
> (which I doubt) before me.
>
> I have a few expect scripts. Small things that transfer files to a
> different system. The security experts have changed the passwords on
> these systems to contain the '#' character, which happens to be the
> comment character in expect scripts. I've tried the normal escape
> sequences but nothing seems to work.
>
Did you try \043?
--
Gordon's Law:
If you think you have the solution, the question was poorly phrased.
| |
| Stein Arne Storslett 2005-10-24, 3:45 pm |
| <ajpb@iafrica.com> wrote in <1129216343.430303.100500@g44g2000cwa.googlegroups.com>:
> Hi,
>
> I've been searching the Net and this group, and either I'm not
> formulating my query correctly or no-one else has as yet run into this
> (which I doubt) before me.
>
> I have a few expect scripts. Small things that transfer files to a
> different system. The security experts have changed the passwords on
> these systems to contain the '#' character, which happens to be the
> comment character in expect scripts. I've tried the normal escape
> sequences but nothing seems to work.
>
> Here is a sample script:
>
> spawn ftp 10.0.0.38
> expect "): "
> send "user_id\r"
> expect "assword:"
> send "passw#1\r"
> expect "ftp>"
> send "put FILE1\r"
> expect "ftp>"
> send "put FILE2\r"
> expect "ftp>"
> send "bye\n"
>
>
> When running this I simply get from the ftp application - not logged
> in.
>
> How do I fix this? (Changing the passwords are unfortunately not
> possible - that would be the easy way out.)
I see that if I use autoexpect to create the script, it adds "--":
set timeout -1
spawn ssh test@localhost
match_max 100000
expect -exact "test@localhost's password: "
send -- "ab#cd\r"
expect -exact "^[\]0;test@myhost:~^G\[test@myhost ~\]\$ "
send -- "^D"
expect eof
I don't know if that will help you?
--
Stein Arne
| |
| andriesb 2005-10-24, 3:45 pm |
| Thanks for the suggestion but it seems it does not want to work for
me...
| |
| andriesb 2005-10-24, 3:45 pm |
| Hi, Thanks for the reply. I've tried the '--' but the version of expect
we have on the HP/UX boxes don't seem to react to it - either
positively or negtively.
| |
| andriesb 2005-10-24, 3:45 pm |
| Hi Jim,
I think I'll post this query in that news group.
The other two replies I've had had not helped. It's rather annoying to
be hampered by this single character... 
Thanks to all who have read this and a great thank you to those who
took the time to reply.
I'm of to comp.lang.tcl to see if any there might know.
Thanks again.
|
|
|
|