Browse Source

'get-conf.sh' hinzufügen

Daniel Wenzel 3 years ago
parent
commit
122316f13b
1 changed files with 30 additions and 0 deletions
  1. 30 0
      get-conf.sh

+ 30 - 0
get-conf.sh

@@ -0,0 +1,30 @@
+#!/usr/bin/expect -f
+
+set timeout 20
+set TP_HOST [lindex $argv 0]
+set TP_IP [lindex $argv 1]
+set TP_USER [lindex $argv 2]
+set TP_PASS [lindex $argv 3]
+
+
+spawn ssh -o "StrictHostKeyChecking no" $TP_USER@$TP_IP
+
+expect "*assword: "
+send "$TP_PASS\r"
+
+expect "*>"
+send "enable\r"
+
+expect "*#"
+send "enable-admin\r"
+
+expect "*#"
+send "copy startup-config tftp ip-address 172.30.1.221 filename $TP_HOST\r"
+
+expect "*#"
+send "exit\r"
+
+expect "*>"
+send "exit\r"
+
+exit