openssl rand hex
This commit is contained in:
22
scan.php
22
scan.php
@@ -361,23 +361,25 @@ switch ($_GET["op"]) {
|
|||||||
continue; // do NOT regenerate values
|
continue; // do NOT regenerate values
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intval($field_arr[3])==0) $len = 10; // default length
|
$gen_arr = explode("|",$field_arr[1]);
|
||||||
else $len = $field_arr[3];
|
|
||||||
|
|
||||||
if ($field_arr[1]=="openssl") {
|
if (intval($gen_arr[2])==0) $len = 10; // default length
|
||||||
if ($field_arr[2]=="hex") $command = "openssl rand -hex $len";
|
else $len = $gen_arr[2];
|
||||||
elseif ($field_arr[2]=="base64") $command = "openssl rand -base64 $len";
|
|
||||||
|
if ($gen_arr[0]=="openssl") {
|
||||||
|
if ($gen_arr[1]=="hex") $command = "openssl rand -hex $len";
|
||||||
|
elseif ($gen_arr[1]=="base64") $command = "openssl rand -base64 $len";
|
||||||
else $command = "openssl rand $len"; // raw
|
else $command = "openssl rand $len"; // raw
|
||||||
$output = shell_exec($command);
|
$output = shell_exec($command);
|
||||||
if ($output === null) $output = "OPENSSL_ERROR";
|
if ($output === null) $output = "OPENSSL_ERROR";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($field_arr[1]=="random") $base = rand(100000,999999);
|
if ($gen_arr[0]=="random") $base = rand(100000,999999);
|
||||||
elseif ($field_arr[1]=="time") $base = time();
|
elseif ($gen_arr[0]=="time") $base = time();
|
||||||
elseif ($field_arr[1]!="") $base = $field_arr[1]; // fix string
|
elseif ($gen_arr[0]!="") $base = $gen_arr[0]; // fix string
|
||||||
else $base = rand(100000,999999); // default
|
else $base = rand(100000,999999); // default
|
||||||
|
|
||||||
if (in_array($field_arr[2],$algos)) $base = hash($field_arr[2],$base);
|
if (in_array($gen_arr[1],$algos)) $base = hash($gen_arr[1],$base);
|
||||||
else $base = hash("md5",$base); // default alg
|
else $base = hash("md5",$base); // default alg
|
||||||
|
|
||||||
$output = substr($base,0,$len);
|
$output = substr($base,0,$len);
|
||||||
@@ -385,6 +387,8 @@ switch ($_GET["op"]) {
|
|||||||
$fields["$field_key"] = $output;
|
$fields["$field_key"] = $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//var_dump($fields); exit; // TEMP - test generated values
|
||||||
|
|
||||||
$payload = base64_encode(json_encode($fields, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT));
|
$payload = base64_encode(json_encode($fields, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT));
|
||||||
$arr = array("NAME" => $_GET["additional"], "ACTION" => $_GET["op"], "PAYLOAD" => $payload);
|
$arr = array("NAME" => $_GET["additional"], "ACTION" => $_GET["op"], "PAYLOAD" => $payload);
|
||||||
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
$json = json_encode($arr, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
|
||||||
|
@@ -1 +1 @@
|
|||||||
1.1.16
|
1.1.17
|
||||||
|
Reference in New Issue
Block a user