#!/bin/bash

#1) apt-get install expect
#2) Впишите ip-адрес свитча, логин и пароль.


echo  'expect << EOF'                  >> ./result
echo  'spawn telnet 192.168.100.229'   >> ./result
echo  'expect login'                   >> ./result
echo  send '"'"admin\r"'"'             >> ./result
echo  'expect password'                >> ./result
echo  send '"'"31415926\r"'"'          >> ./result


a=0
b=0
c=0
d=0
e=0
f=0
g=0

       while [ $g -le 9 ]
       do
       while [ $f -le 9 ]
       do
       while [ $e -le 9 ]
       do
       while [ $d -le 9 ]
       do
       while [ $c -le 9 ]
       do
       while [ $b -le 9 ]
       do
       while [ $a -le 9 ]
       do


        echo send '"'"enable license fullL3 $a$b$c$d$e$f$g\r"'"' >> ./result


       let a=a+1
       done
       a=0
       let b=b+1
       done
       b=0
       let c=c+1
       done
       c=0
       let d=d+1
       done
       d=0
       let e=e+1
       done
       e=0
       let f=f+1
       done
       f=0
       let g=g+1
       done
       g=9


expect ERROR: >> ./result
expect EOF    >> ./result
