Kindly ensure you don't go and use this for malacious purposes. Bear in mind that most production environments will have some kind of log parsing program in place to catch (and sometimes blacklist) stuff like this.
It scans input as it comes, to actually view exactly what it's seeing and how it's responding add "exp_internal 1" to the top of the script. Beware, the output will be quite verbose.
As soon as it sees a matching regex/pattern it'll go ahead and send whatever is within the expect statement. If nothing matches it will literally wait forever or execute the timeout branch if you have one specified.
The latter.
Use exp_continue and have it read the next line of your dictionary file in every attempt. It does also support looping.
You can expect multiple expressions, e.g
If you don't throw an interact it will close the spawn_id, in this case your SSH session, and it will disconnect you. Whether or not that's intended behavior is up to you.
exp_continue doesn't ever break, it forces a re-evaluation of the previous expect statement. Definitely possible to send different things with this, as mentioned above.
Yes, as stated prior, expect supports regex matching and multiple patterns in a single expect statement.
hai all,
i have an tcl script in which i have been reading the DUT Command prompt of an cisco switch as
DUT Command Prompt : cisco*
and running the test case of stp now the problem is if i have given any blank space in between the cisco or at the startup then the Expect is not identifying the... (0 Replies)
Does anyone know of an expect/tcl forum that is as helpful as this one is for shell scripting?
Or if anyone has any expect knowledge, can you please provide some guidance on how to write to a local error log based on output from a ssh session?
I have something like this:
foreach host... (2 Replies)
In the following "for" loop I assume the the script will expect "anyway", "first" NOT in any paticular order and send "yes" when there found, breaking out of the loop when "$prompt" is found. The way it is working is like 3 individual expect lines, and they MUST be in cronological order. ANY help... (0 Replies)
Can someone identify what is the problem here?.
no children
while executing
"exp_wait -nowait -i -1"
(procedure "logOptions" line 45)
invoked from within
"logOptions"
(procedure "doExecute" line 98)
invoked from within
"doExecute"
(procedure "main" line 32)
... (7 Replies)
I'm having this problem with a very simple tcl expect script that is running on Solaris 5.3 with TCL version 8.4.7 and expect version 5.0.
below is the simplified version of the code snippet, which I think has everything to illustrate the problem, the full version is at the very bottom in... (0 Replies)
hi, I am new in Expect.
I have a question about expect timeout.
suppose I have a structure of
expect { ".."{
send"............"}
timeout{
...............
}
}
The silly question is if I reach timeout, how can I store the error message showing on the screen to... (2 Replies)
How can I pass password in SSH command without using expect in a shell program.
I don't have expect installed on my Solaris server.
#!/bin/bash
ssh user@hotname (how to supply pass in script?:wall:)
Experts please help its very urgent.
Shrawan Kumar Sahu (4 Replies)
Dear All,
I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Morning and Happy New Year to all.
I am in a situation where I need to connect to a list of devices that are using either telnet or ssh.
I want to try to telnet, if I receive any of the following I want to attempt ssh :
"Connection refused"
"Connection timed out"
timeout expiration
... (3 Replies)