| 1 | // BruteForCer - A combination sequence generator |
| 2 | // Harvie 2oo7 |
| 3 | /* |
| 4 | * I hope, that this can show you that BF is the most suxing idea. |
| 5 | * You can use GREP pipe, if you know part of password. |
| 6 | * Brutforcing is the only way to be the real hacker. (Please don't pwn me ;) |
| 7 | * More info? UTFS! |
| 8 | */ |
| 9 | |
| 10 | #include <stdio.h> |
| 11 | |
| 12 | void inc(char *comb, int i, int maxno) { |
| 13 | if (comb[i] == -1) { |
| 14 | comb[i] = 0; |
| 15 | return; |
| 16 | } |
| 17 | comb[i] = (comb[i] + 1) % maxno; |
| 18 | if (comb[i] == 0) |
| 19 | inc(comb, i + 1, maxno); |
| 20 | } |
| 21 | |
| 22 | int main() { |
| 23 | int i, j; |
| 24 | int minlen = 0; |
| 25 | int maxlen = 10; // Lenght of string |
| 26 | // char full = 0; //0=Alphabet, 1=All possibilities |
| 27 | // char alpha[] = "01"; |
| 28 | char alpha[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 "; // Alphabet |
| 29 | int alphmax = sizeof(alpha) - 1; // printf("%d\n", |
| 30 | // alphmax); |
| 31 | |
| 32 | char comb[maxlen]; |
| 33 | for (i = 0; i <= maxlen; i++) { |
| 34 | comb[i] = -1; |
| 35 | if (i < minlen) |
| 36 | comb[i] = 0; |
| 37 | } |
| 38 | while (comb[maxlen] == -1) { |
| 39 | for (i = maxlen - 1; i >= 0; i--) |
| 40 | if (comb[i] != -1) |
| 41 | putchar(alpha[comb[i]]); |
| 42 | putchar('\n'); |
| 43 | inc(comb, 0, alphmax); |
| 44 | } |
| 45 | |
| 46 | return 0; |
| 47 | } |