文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>自动输入用户名和密码用于tenlnet的shell

自动输入用户名和密码用于tenlnet的shell

时间:2005-11-11  来源:sunyone

自动输入用户名和密码用于tenlnet的shell

用linux的朋友且经常用配置路由器的可有福了.

今天刚刚完成, 大家多提意见

#===========autotelnet.sh==============
#!/bin/bash
if (( $# != 1 ))
then
  echo " usage: $0 address "
  exit 1
fi
ip=$1
inp1=`cat param |grep "$ip" |awk '{ print $2 }'`
inp2=`cat param |grep "$ip" |awk '{ print $3 }'`
inp3=`cat param |grep "$ip" |awk '{ print $4 }'`

inputfile=in
outputfile=out
rm -fr $inputfile
rm -fr $outputfile
mknod $inputfile p
touch $outputfile

#file description 7 for out and 8 for in
exec 7<>;$outputfile
exec 8<>;$inputfile

telnet $ip <&8 >;&7 &

sleep 1; echo $inp1 >;>; $inputfile
sleep 1; echo $inp2 >;>; $inputfile
sleep 1; echo $inp3 >;>; $inputfile

tail -f $outputfile &

while true
do
  read str
  if [[ $str = "quit" || $str = "exit" ]]
  then echo $str >;>; $inputfile ; exit
  else echo $str >;>; $inputfile
  fi
done
#==================================

参数文件, 输入在出现正常提示符之前需要输入的所有内容, 用空格分开, 以ip地址或者hostname开头
#=====param============
localhost root password

#=====================

相关阅读 更多 +
排行榜 更多 +
僵尸运行3d城市逃生

僵尸运行3d城市逃生

冒险解谜 下载
顶尖猎人罗迪和凯茜

顶尖猎人罗迪和凯茜

冒险解谜 下载
火柴人飞爪忍者

火柴人飞爪忍者

冒险解谜 下载