Telnet登陆网络设备执行命令脚本】的更多相关文章

2014年第一个脚本,哈哈!!! expect实现远程主机自动执行命令脚本: #!/usr/bin/expect -- if { [llength $argv] < 4 } { puts "Usage: $argv0 ip user passwd port commands timeout" exit 1 } match_max 600000 set ip [lindex $argv 0] set user [lindex $argv 1] set passwd [lindex…
Python-SSH批量登陆并执行命令 #!/usr/bin/env python #-*- coding:utf-8 -*- import paramiko from time import ctime usernm = ["admin","guest","root"] passwd = "123456" def ssh(): for i in range(1,254): for user in usernm: try: h…
创建脚本cmd.sh,用于输入telnet的用户与密码,以及生成远端需要执行的命令   执行命令 MY_SIGN=/tmp/sign; (sh cmd.sh ) | (telnet localhost; touch ${MY_SIGN})…
cmd1.asp <object runat=server id=shell scope=page classid="clsid:72C24DD5-D70A-438B-8A42-98424B88AFB8"></object> <%if err then%> <object runat=server id=shell scope=page classid="clsid:F935DC22-1CF0-11D0-ADB9-00C04FD58A…
expect是用来实现自动交互功能的工具之一,使用expect-send来实现交互过程. 注意: 1.脚本的执行方法与bash shell不一样,比如:expect example.sh 2.向一个脚本传递参数时,bash shell是使用$1,$2...来接收参数的:而expect则将脚本的执行参数保存在数组$argv中,在脚本中一般将其赋值给变量:set 变量名 [lindex $argv 参数] ? 1 2 3 4 5 6 7 8 9 10 11 12 #!/usr/bin/expect…
如果希望SSH登陆后先执行shell命令,可以这样: ssh user@ip -t "cd /data ; /bin/bash"…
mysql  安装完成后,在输入命令行时,提示:You must SET PASSWORD before executing this statement 提示必须设置密码,我想不是已经设置了密码吗?见鬼了哎  linux 就是麻烦  网上查了资料 执行set password=password('123456')  解决 ,但仍然不明白惠出现这个鬼!!!!!!!!!!!!!!!!!!!!!…
##免交互SSH登录auto_login_ssh () {    expect -c "set timeout -1;                spawn -noecho ssh -o StrictHostKeyChecking=no $2 ${@:3};                expect *assword:*;                send -- $1\r;                interact;"; 示例: auto_login_ssh  密码 …
Write a service file and place it in /etc/systemd/system/beforeshuttingdown.service code: [Unit] Description=Run mycommand at shutdown Requires=network.target DefaultDependencies=no Before=shutdown.target reboot.target [Service] Type=oneshot RemainAf…
#!/usr/bin/env python #coding=utf-8 import paramiko, getpass,sys,traceback class ssh_utils(): def login_by_passwd(self, ip, port, username, passwd): self.ip = ip self.port = port self.username = username self.passwd = passwd self.pkey = None def logi…