Expect is a utility based on TCL. It's primary use is for building automation into interactive environments such as telnet or ssh based terminal environments. It provides the ability to enter commands on a command line and interpret the output.

learn more… | top users | synonyms

0
votes
0answers
15 views

Simple Expect program to send a key when the program yields some text

I need to run this program: Luis@Windu /cygdrive/c/Temporal/Expect$ oclhashcat64 ../Test.hccap -m 2500 -a 3 ?d?d?d?d?d?d?d?d oclHashcat v1.31 starting... Device #1: Bonaire, 1024MB, 1050Mhz, 12MCU ...
0
votes
0answers
60 views

Automate Interactive method of authentication for file transfer

Interactive method of authentication There is a server A and Server B Server A is the File Transfer server It has the files stored in it and we issue command scp admin@IP of REMOTE ...
0
votes
1answer
235 views

expect + how to verify if dir exists and if not how to create it

I write expect script that login to remote machine and run there some scripts But I need also to verify the following Verify if directory /var/cti/adm/APP exists If APP not exists under adm ...
0
votes
1answer
69 views

How do I build a script shell to send cmd via telnet and log only results?

I would like to make a shell script that can call a range of IPs via telnet, to send a command, and write the result to a file.
0
votes
0answers
220 views

Wrong exit status from expect script

I developed the TELNET_TEST.expect (expect script ) in order to test TELENT connection on remote machine this script perform telnet on target machine wait for login and send password and make exit ...
1
vote
1answer
112 views

Timeout does not work in expect script

I created the following expect script in order to automate logging into a VPN: #!/usr/bin/expect set PASS [lindex $argv 0] set timeout 10 spawn vpnc expect : {send $PASS\r} ...
0
votes
2answers
140 views

Not able to copy a file via script from local host to remote host

I am trying to write a script that can copy a file from local host to remote host. And then i want to execute that script from local host. But I am not able to copy. I googled and found the below ...
0
votes
1answer
344 views

Trying to reboot ADSL modem via expect script

I'm trying to create a Linux script which can reboot my ASDL Modem. Here is my rebootModem.exp file : #!/usr/bin/expect set userName admin set pass admin set command reboot #It is modem reboot ...
0
votes
1answer
130 views

Using EXPECT script with a $ in the password

I'm trying to set a variable in a Linux bash script which includes a $ symbol, i.e. password is Gl@d1us$123 so PASS="Gl@d1us\$123". I can preceed the $ with a \ and it works fine, but when it calls ...
1
vote
0answers
155 views

stdbuf not working while unbuffer does

I am trying to apply timestamps to stdout of a process. For the proper timestamps to be applied, I attempt to unbuffer stdout of the process. This works with unbuffer but not with stdbuf as I would ...
1
vote
1answer
86 views

Unbuffer swallows the exit status of killed process

The expect "unbuffer" command seems to swallow the exit status of its child if the process is killed. Is there something that can be done to stop this behavior? It does not swallow the exit status if ...
1
vote
1answer
2k views

expect command in ubuntu

I've searched all over SuperUser, but couldn't get the solution. Here is a script that am using for ssh using expect. I'm using ubuntu and I've installed expect using aptitude install expect. ...
0
votes
2answers
1k views

Linux: ssh command works outside bash script, but not within script?

I am having problem with the following command: echo "Pass for router:" read -s pass /usr/bin/expect - << EXPCT spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt ...
0
votes
1answer
1k views

Problems using EXPECT is a BASH shell script

This is the code (bash script): echo "Pass for router:" read -s pass /usr/bin/expect <<EOD spawn ssh 192.168.10.1 -l root 'opkg list-installed' > list-installed.txt #echo @pass expect ...
1
vote
2answers
1k views

couldn't execute “mysql”: no such file or directory, using autoexpect

I have the following file: exp.exp #!/usr/bin/expect db_host='localhost' db_name='webui_dev' db_user='root' db_pass='rootpass' new_db_name='db_2011' expect <<EOF log_user 0 spawn mysql -h ...
0
votes
0answers
67 views

rsync fails to copy files from remote machine

#Bypassing the ssh spawn -noecho /usr/bin/ssh -o 'StrictHostKeyChecking=no' "$user\@$ip"; if { $argc == $total_arguments} { set REMOTEDIR "$remote_dir"; spawn -noecho /usr/bin/rsync -r ...
0
votes
1answer
279 views

Expect not working using -c arguments

So I have an expect script like this that works: #!/usr/bin/expect spawn scp me@myserver.com:* . expect { password: {send "mypassword"; exp_continue} } Based on the man page for expect, I think I ...
0
votes
1answer
500 views

Expect and sudo timeout

I have a main shell script that prompts the user for his password. I then would like to call an expect script while passing the password to it. This expect script will run 3 sudo commands. I know the ...
2
votes
2answers
485 views

Bash/expect script to log in via ssh and port knocking. SSH Keys not possible

My login server is behind a firewall that uses port knocking to allow entry. The login-flow is Enter in port knocking command. This requires my external IP to be entered. When prompted, enter in my ...
0
votes
3answers
3k views

how to run a local script in remote server using expect and bash script

I want to make a script that will connect to a server and do some CRUD operation on the server and again return to local. I do not want to upload the script to server.. I have made a script that ...
1
vote
1answer
8k views

What is the meaning of “spawn” linux shell commands ? (Centos6)

I need to know how to setup a cron job that automatically connects to the remote server and change the directory and get all the files in that directory to local i think i have to use sftp but i saw ...
0
votes
1answer
2k views

Auto log in SSH using expect

I wrote a script to auto login into a remote server. The login data is stored in a database. /usr/bin/expect <<EOD spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no $SSHUser@$SSHHost ...
0
votes
2answers
2k views

Installation of Expect on Windows 7 64-bit fails with “not found in the archives”

Downloaded ActiveTcl from http://www.activestate.com/activetcl/downloads/ Installed ActiveTcl at c:/Tcl/ Go to Bin directory in command prompt (Start > Run > cmd > cd c:\Tcl\bin) To install Expect, I ...
0
votes
1answer
2k views

SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine

I am trying to automate the deploy of some .deb packages with an script. I want to execute sudo dpkg -i $myDeb.deb in a list of remote machines I can access with ssh. I've tried to automate the ...
1
vote
1answer
741 views

Why doesn't redirect work for scp password input?

I want to copy from remote box with scp, while the fact that each time I have to re-enter password is annoying. So I store my password in plain text and expect the following code should work scp ...
0
votes
1answer
2k views

Expect script inside bash script optional statement

Using: CentOS 6.2 BASH shell My script is something along the lines of #!/bin/bash INSTALL_PATH="Enter install path" CR="\n" /bin/su root -c "/usr/bin/expect << EOF spawn name.run expect ...
0
votes
3answers
2k views

Linux spawn, expect, send

The following code isn't working, but what I want to do is answer "n" whenever YUM asks whether I want to install the software or not. Thanks #!/usr/bin/expect -f spawn yum install emacs expect "Is ...
1
vote
1answer
696 views

Problems automating sftp with expect

I'm trying to automate data transfer using sftp. I have a hacky expect script that grabs the data file. Unfortunately, partway through transfer the file is unexpectedly truncated. When I tried ...
1
vote
2answers
1k views

How to by-pass user interactions in a script?

I am trying to automate the installation of a program through a shell script. There are a few steps which require user interaction from the command line (confirmation, yes/no, etc.). What is the best ...
1
vote
1answer
332 views

Can the expect utility handle a case where the process it spawns also spawns a sub process?

I'm trying to use expect to handle rsync over an ssh shell, but it gets stuck. If I run my rsync command it works (simplified here): It prompts me for my password and copies files to the server: ...
0
votes
2answers
670 views

Expect: Modify Ctrl-C Behavior

While exec is running a program, I would like Ctrl-C to terminate the program and resume the script, instead of killing the script. What's the best way of accomplishing that?