summaryrefslogtreecommitdiffstats
path: root/scripts/automation/sshpass.exp
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/sshpass.exp')
-rwxr-xr-xscripts/automation/sshpass.exp15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/automation/sshpass.exp b/scripts/automation/sshpass.exp
new file mode 100755
index 00000000..f27210c8
--- /dev/null
+++ b/scripts/automation/sshpass.exp
@@ -0,0 +1,15 @@
+#!/usr/cisco/bin/expect -f
+# ./ssh.exp password 192.168.1.11 id *
+set pass [lrange $argv 0 0]
+set server [lrange $argv 1 1]
+set name [lrange $argv 2 2]
+set cmd [lrange $argv 3 10]
+
+set cmd_str [join $cmd]
+
+spawn ssh $name@$server $cmd_str
+match_max 100000
+expect "*?assword:*"
+send -- "$pass\r"
+send -- "\r"
+interact