#include #include #include #define MAXLEN 16 char sbrute[MAXLEN]; static const char chars[] = "abcdefghijklmnopqrstuvwxyz0123456789"; /* ?php */ /*********************************************/ /* copyright BIITER 2006 */ /* mybiiter[at]gmail.com */ /* http://biiter.com */ /* */ /* recursive bruteforce string generator */ /*********************************************/ /* // optimized for speed // use at your own risk // simple as possible [more comments are not needed] set_time_limit(0); function brute($length,$chars,&$brute){ global $brute_str; if($length > 0) $length--; $chlen = strlen($chars); for($i=0;$i<$chlen;$i++){ $brute_str[$length] = $chars[$i]; if($length == 0) echo $brute_str; if($length > 0) brute($length,$chars,$brute); } } */ void brute(int length) { int chlen = strlen(chars); length--; int i; for (i = 0; i < chlen; i++) { sbrute[length] = chars[i]; if (length) { brute(length); } else { puts(sbrute); } } } void main (void) { int length = 7; memset(sbrute, chars[0], length); sbrute[length] = 0x00; brute(length); } /* $chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $length = 7; $brute_str = str_repeat($chars[0],$length); $brute = array(); brute($length,$chars,$brute); ?> */