|
Posted by Daemon on 01/01/06 11:14
Hello,
I am trying to create a script that will create a loop threw ascii
characters 32 - 126, but be limited to the number in a varible,
controlling how many returns. I figgured a control of how many array
keys would be a good spot, say I only want strings that start with 3
characters and end at 5 charcters.
And I wanted to use an array for all possible ascii characters. So far,
the code I have is a bit of a mess and was hoping for some one that has
more knowledge in php to lead me in the right direction to how to
accomplish my task at hand.
<?php
$ascii_chr_range = array('0' => '32', '1' => '33', '2' => '34', '3' =>
'35', '4' => '36', '5' => '37', '6' => '38', '7' => '39', '8' => '40',
'9' => '41', '10' => '42', '11' => '43', '12' => '44', '13' => '45',
'14' => '46', '15' => '47', '16' => '48', '17' => '49', '18' => '50',
'19' => '51', '20' => '52', '21' => '53', '22' => '54', '23' => '55',
'24' => '56', '25' => '57', '26' => '58', '27' => '59', '28' => '60',
'29' => '61', '30' => '62', '31' => '63', '32' => '64', '33' => '65',
'34' => '66', '35' => '67', '36' => '68', '37' => '69', '38' => '70',
'39' => '71', '40' => '72', '41' => '73', '42' => '74', '43' => '75',
'44' => '76', '45' => '77', '46' => '78', '47' => '79', '48' => '80',
'49' => '81', '50' => '82', '51' => '83', '52' => '84', '53' => '85',
'54' => '86', '55' => '87', '56' => '88', '57' => '89', '58' => '90',
'59' => '91', '60' => '92', '61' => '93', '62' => '94', '63' => '95',
'64' => '96', '65' => '97', '66' => '98', '67' => '99', '68' => '100',
'69' => '101', '70' => '102', '71' => '103', '72' => '104', '73' =>
'105', '74' => '106', '75' => '107', '76' => '108', '77' => '109', '78'
=> '110', '79' => '111', '80' => '112', '81' => '113', '82' => '114',
'83' => '115', '84' => '116', '85' => '117', '86' => '118', '87' =>
'119', '88' => '120', '89' => '121', '90' => '122', '91' => '123', '92'
=> '124', '93' => '125', '94' => '126');
$gen_string = array();
$gen_string_max = '2';
array_flip($ascii_chr_range);
settype($gen_string, "string");
while (count($gen_string) <= $gen_string_max) {
for ($i = $ascii_chr_range['0']; $i <= end($ascii_chr_range); $i++) {
echo chr($i) . ' corrisponds with ASCII value ' . $i . '<br/>' . "\n";
echo "\t" . 'Comparing ' . $i . ' to ' . end($ascii_chr_range)
..'<br/>' . "\n";
if ($i == end($ascii_chr_range)) {
echo "\t" . 'Changing varible' . $gen_string[1] . ' to ' . $i .
'<br/>' . "\n";
$gen_string[1] = chr($gen_string{strlen($gen_string) - 1} + 1);
//$i = $ascii_chr_range['0'];
die();
}
else {
echo "\t" . 'Last Key in string $gen_string is ' . $i . '<br/>' .
"\n";
$gen_string[0] = chr($i);
}
}
print_r($gen_string);
}
?>
Again, it's proper, and this is my first attempt at a brute force, but I
believe its plossible.
Basically, create a loop determined by comparing the $gen_string_max to
the number of $gen_string array keys. Then create a loop of pssobile
ascii values in the array, and limit the returns to the end. I figgure I
could reset the varible before the next roll over of the script. This I
believe is my fault in the script, as its possible it wont count the
last value in the array as a return, instead reset it as soon as its
found. I'm guessing there has to be other methods...
I also wrote a script Canadian SINs which is posted at
http://hackcanada.com which is a form of brute forcing...
Any help would be appreciated!!
~ Daemon
Navigation:
[Reply to this message]
|