Question

I was curious to see if the Arduino Leonardo's keyboard and mouse libraries could possibly be used as a windows user password brute force hacker. Using my limited hobby coding and arduino skills i began writing a program for this.

The problem at first seemed to be that the serial output was spewing random letters/numbers when it was supposed to be spouting common passwords. Took me a minute to realize these ARE the common passwords. Well, the last letter of each of them.

The Code:

// tests most common paswords, if one of these works your idiot alert should be ringing
char myStrings[26]={ 'password', '123456', '12345678',
'1234', 'qwerty','12345','password', 'dragon', 'pussy',
'baseball', 'football','monkey', 'letmein', '696969',
'abc123', 'mustang','michael', 'shadow', 'master',
'jennifer', 'harley','1234567', 'jordan',
'2000', '111111',
'COMMON PASSWORDS EXHAUSTED: ATTEMPTING BRUTE FORCE'};


//the letters... yep
char myLetters[26]={'a', 'b', 'c',
'd', 'e','f','g', 'h', 'i',
'j', 'k','l', 'm', 'n',
'o', 'p','q', 'r', 's',
't', 'u','v', 'w',
'x', 'y','z'};


//establishes serial connection
void setup(){
Serial.begin(9600);
}


void loop(){
for (int i = 0; i < 27; i++){
   Serial.println(myStrings[i]);
   }

   Serial.println("Common Finish"); // the common passwords have been attempted

   for (int o = 0; o < 26; o++){
   Serial.println(myLetters[o]);
   delay(500);
   }
   Serial.println("Letter Finish"); // the letters have been finished

   Serial.println("rinse wash repeat."); //the loop n' stuff

}

Image of arduino serial monitor:

Image of arduino serial monitor

I'd appreciate any insight on how i am misusing arrays or strings. Thanks.

No correct solution

OTHER TIPS

'...' is for single characters. Strings use "...".

And subsequently your variable declaration is wrong, since it is an array of characters.

But you're doing it wrong in the first place.

A char only represents a single character, so myStrings is actually just an array of 26 individual letters/numbers. Everything else in each string is being ignored. It's also important to note that you should only have one character at a time when using single quotes; e.g. 'a' is ok, but 'abc' isn't going to work properly.

To use a string literal (text that never has to change while the sketch is running), you can use the const char * data type instead of just char, and enclose the text in double quotes, "like this".

You could re-write your array of strings to look like this:

const char *myStrings[26] = {"password", "123456", "12345678",
    "1234", "qwerty","12345","password", "dragon", "pussy",
    "baseball", "football","monkey", "letmein", "696969",
    "abc123", "mustang","michael", "shadow", "master",
    "jennifer", "harley","1234567", "jordan",
    "2000", "111111",
    "COMMON PASSWORDS EXHAUSTED: ATTEMPTING BRUTE FORCE"};

Each individual string in that array is itself an array of char's. You can read more about it in the string documentation on the Arduino website.

Usage
If you're only wanting to output these strings to serial, then you would still access it the same way. For example, this loop should still work:

for (int i = 0; i < 27; i++){
    Serial.println(myStrings[i]);
}

However, if you want to compare two strings of that type then you can't use the usual equality operator (==). You would need to use strcmp().

String object
An alternative is to use the String object to store your strings. It's a lot easier to use, and it lets you modify the string data at runtime. However, it uses up more memory (which is quite limited on Arduino). If you want to explore that avenue, you can check out the String object documentation on the Arduino website.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top