a2a48f21697c528717de559058894a88f317da24
9 prepare_connect_commands
()
12 local skip
=yes cval found
=no MYDIR
=`dirname $0`
14 if [ "$skip" = "yes" -a "$line" = "# S-T-A-R-T" ]; then
18 if [ "$skip" = "no" -a "$line" = "# S-T-O-P" ]; then
22 [ "$skip" = "yes" ] && continue
24 [ -z "${line###*}" ] && continue
26 # First endpoint string/regexp match is sufficient for us.
27 cval
=`echo $line | cut -s -d' ' -f1`
28 if [ -z "${1##$cval}" ]; then
30 username
=`echo $line | cut -s -d' ' -f5`
31 [ "$username" != "-" ] && echo $username > "$SESSION"
33 access_password
=`echo $line | cut -s -d' ' -f6`
34 [ "$access_password" != "-" ] && echo "$access_password" >> "$SESSION"
35 printf "en\r\n" >> "$SESSION"
36 enable_password
=`echo $line | cut -s -d' ' -f7`
37 [ "$enable_password" != "-" ] && echo $enable_password >> "$SESSION"
40 done < "$MYDIR/switch.secrets.php"
41 [ "$found" = "yes" ] && return
45 SESSION
=`mktemp /tmp/fdry5.connector.XXXX`
46 [ -f "$SESSION" ] ||
exit 5
47 prepare_connect_commands
$ENDPOINT
50 printf 'skip-page-display\r\nshow running-config\r\n' >> "$SESSION"
54 cat "$WORKFILE" >> "$SESSION"
60 printf 'exit\r\nexit\r\n' >> "$SESSION"
61 nc
-w 30 -i 1 $ENDPOINT 23 < "$SESSION" > "$outfile"