#!/usr/bin/expect -f set ip [lindex $argv 0] set pass [lindex $argv 1] set enable [lindex $argv 2] set force_conservative 0 ;# set to 1 to force conservative mode even if ;# script wasn't run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg } } set timeout -1 spawn $env(SHELL) match_max 100000 send -- "ssh pix@$ip\r" expect "assword:" send -- "$pass\r" expect "Type help or '?' for a list of available commands." send -- "enable\r" expect -exact "enable\r Password: " send -- "$enable\r" expect "#" send -- "write net\r" expect "\[OK\]" send -- "exit\r" send -- "exit\r"