|
Posted by Hans Worst on 10/02/06 04:10
"Kimmo Laine" <spam@outolempi.net> schreef in bericht
news:_t5Ug.24461$yn7.16238@reader1.news.jippii.net...
> "Hans Worst" <hans@worst.invalid> wrote in message
> news:noSdnZa8GfspSr3YnZ2dnUVZ8sidnZ2d@scarlet.biz...
>>
>> "Bob Stearns" <rstearns1241@charter.net> schreef in bericht
>> news:PU3Ug.2834$xt3.194@newsfe07.lga...
>>> Hans Worst wrote:
>>>
>>>> You know them brute force password crackers... Just give the min/max
>>>> passwordlength and the character scope in which they have to search.
>>>>
>>>> min length: 1
>>>> max length: 7
>>>> scope:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890!@#$%^&*()_
>>>>
>>>> Can anybody help me with a compact code for generating all
>>>> possibilities?
>>> You do realize that at the maxlength there are 10,030,613,004,288
>>> combinations, at that a generation and test rate of 1,000,000 per
>>> second, it would take over 100 days to test them all?
>>>
>>> There is a more complicated way, which lets max length be a variable,
>>> but this is short and easy:
>>>
>>> for($i1=0; $i1<strlen($scope); $i1++) {
>>> $key = substr($scope, $i1, 1);
>>> print $key;
>>> for($i2=0; $i2<strlen($scope); $i2++) {
>>> $key = substr($key,0,1) . substr($scope, $i2, 1);
>>> print $key;
>>> for($i3=0; $i3<strlen(scope); $i++) {
>>> $key = substr($key,0,2) . substr($scope, $i3, 1);
>>> print $key;
>>> }
>>> }
>>> }
>>>
>>> Make further loops inside the ones already present to increase the key
>>> length beyond 3. Note that each loop increases the run time and output
>>> lines by a factor of 72
>> Bob,
>>
>> Thanks for the example but there is something wrong - I cannot find what
>> though...
>>
>> I put $scope = "abcdefghijklmnopqrstuvwxyz";
>> and I put <BR>'s after every print
>> The script outputs a aa aaa aaa aaa aaa aaa aaa
>>
>
> try indexing the keys as well:
>
> for($i1=0; $i1<strlen($scope); $i1++) {
> $key1 = $scope{$i1};
> print $key1;
> for($i2=0; $i2<strlen($scope); $i2++) {
> $key2 = $key1 . $scope{$i2};
> print $key2;
> for($i3=0; $i3<strlen(scope); $i++) {
> $key3 = $key2 . $scope{$i3};
> print $key3;
> }
> }
> }
I still only get aaaaaaaaaaaaaaaaaaaaaaaa...
[Back to original message]
|