A voir également:
- Rapport erreur_bash et expect
- Plan rapport de stage - Guide
- Rapport erreur windows - Guide
- Impossible d'afficher le rapport de tableau croisé dynamique sur un rapport existant - Forum Excel
- Thème rapport de stage comptabilité - Forum Word
- Rapport sur le dark web - Accueil - Protection
3 réponses
Petit récap :
le fichier de démarrage :
#!/bin/bash
#
for switch in `cat /home/switch/iplist.txt | awk '{print $1}'`
do /home/commandes.sh $switch
if ???
then `cat /home/switch/iplist.txt | awk '{print $2}'` >>/home/erreur.txt
fi
done
iplist.txt contient uniquement des adresses IP
et commandes.sh :
#!/usr/bin/expect -f
#
set switch [lindex $argv 0]
spawn ssh user@$switch
expect "#"
expect " # "
send "mdp\r"
expect " # "
send "en\r"
send "mdp2\r"
send "conf t\r"
send "no username user\r"
send "enable secret mdp3\r"
send "no aaa new-mo\r"
send "username userrw privilege 15 secret mdp4\r"
send "username userro privilege 7 secret mdp5\r"
send "aaa new-model\r"
send "aaa authentication login default group radius local\r"
send "aaa authorization console\r"
send "aaa authorization exec default group radius local\r"
send "radius-server host 192.168.0.14 auth-port 1645 acct-port 1646\r"
send "radius-server timeout 3\r"
send "radius-server directed-request\r"
send "radius-server key CiscoRadius\r"
send "radius-server vsa send authentication\r"
send "ip http authentication aaa\r"
send "ip http secure\r"
send "exit\r"
send "copy running-config startup-config\r"
send "\r"
send "\r"
send "exit\r"
expect "closed"
exit
expect eof
Merci de votre aide
le fichier de démarrage :
#!/bin/bash
#
for switch in `cat /home/switch/iplist.txt | awk '{print $1}'`
do /home/commandes.sh $switch
if ???
then `cat /home/switch/iplist.txt | awk '{print $2}'` >>/home/erreur.txt
fi
done
iplist.txt contient uniquement des adresses IP
et commandes.sh :
#!/usr/bin/expect -f
#
set switch [lindex $argv 0]
spawn ssh user@$switch
expect "#"
expect " # "
send "mdp\r"
expect " # "
send "en\r"
send "mdp2\r"
send "conf t\r"
send "no username user\r"
send "enable secret mdp3\r"
send "no aaa new-mo\r"
send "username userrw privilege 15 secret mdp4\r"
send "username userro privilege 7 secret mdp5\r"
send "aaa new-model\r"
send "aaa authentication login default group radius local\r"
send "aaa authorization console\r"
send "aaa authorization exec default group radius local\r"
send "radius-server host 192.168.0.14 auth-port 1645 acct-port 1646\r"
send "radius-server timeout 3\r"
send "radius-server directed-request\r"
send "radius-server key CiscoRadius\r"
send "radius-server vsa send authentication\r"
send "ip http authentication aaa\r"
send "ip http secure\r"
send "exit\r"
send "copy running-config startup-config\r"
send "\r"
send "\r"
send "exit\r"
expect "closed"
exit
expect eof
Merci de votre aide