Anyway, so I, inspired by the awesome book, decided that I would write my own brute-forcing program! And, after almost 12 hours of coding, I did it
How brute-forcing works:
Imagine you want to prank a friend, but in order to do that you need to break into his locker, and don't let him notice you did . You can't ask him the padlock combination, nor you have any clue of what it is. All you know is that the combination is 4 numbers long, and goes from 1 to 9 (each number). So how do you start "cracking" the combination? You add from right to left. Like:
1111 / 1112 / 1113 / ... / 1119 / 1120 / 1121 / .. / 1198 / 1199 / 1200
By doing this you will, depending on the combination, some day/month/year find out what it is. Worst case scenario, you'd have to try 6561 combinations.
Now, you may be saying, but there are passwords that use numbers, letters, symbols, spaces and etc. I then say to you, it's the same deal. Why? Because letters, symbols and etc are just numbers with a costume. You can represent any symbol, letter, etc with a number, then it's the same deal as with the padlock. For instance, imagine you again want to prank your friend. This time, you will log-in to his Facebook, and make it look like he has attraction for people of the same sex as him. How would you do it? Assuming that your friend is dumb and only use letters on his passwords, and you know that his password is 5 characters long, you would then try out combinations this way:
AAAAA / AAAAB / AAAAC / .. / AAAAY / AAAAZ / AAABA / AAABB / .. / AAAZY / AAZZ / ABAA
It would be a little harder than cracking the padlock. If your friend only uses uppercase letters, th is 26 possible characters. Wit a 5 characters long password, in the worst case scenario it would take you 11.881.376 combinations to discover it.
How to use my code:
First, you need to know how to work with tables, loops and have a basic understanding on combinatorics.
For my code to work, it needs to know 2 things:
- The characters that can be used on the combinations
- The maximum length of the combinations (it will start at 1, then go to the maximum specified)
chars = { "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"}
tableName = {0}
function tableAdd (tabl)
if tabl[1] < # chars then tabl[1]=tabl[1]+1 else
for i = 1, # tabl do
if tabl[1] == # chars or tabl[i]+1 > (# chars + 1) then
tabl[i] = 1
if i+1 > # tabl then tabl[i+1] = 1 else tabl[i+1]=tabl[i+1]+1 end
end
end
end
end
function tableToChars (tabl)
local result = {0}
setmetatable(result,{__len=function() return # tabl end})
for i, v in pairs(tabl) do
result[i] = chars[v]
end
return (string.reverse(table.concat(result)))
end
Now, first you need to write your own function to try the combinations. But first you need to know what the functions do:
"tableAdd" Adds one to last index of the table. Like (0-0-1 / 0-0-9 / 0-1-0 / 0-1-1 / .. / 0-1-9 / 0-2-0 /).
"tableToChars" Converts the numbers into characters (1 = A, 2 = B... and so forth)
A simple algorithm that shows that this works is a loop.
for i = 1, 5000 do tableAdd(tableName) print(tableToChars(tableName)) end
It will output the first 5000 combinations, something like this:
Spoiler
Have fun












