Newer
Older
CHaS / Recursive_PEaS.php
root on 7 May 2019 709 bytes Initial commit
<?php
$handle = fopen("URLs.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
    	$url = rtrim($line);
    	$cleanUrl = clean($line);
    	echo "scanning: ".$url."\nFolder: ".$cleanUrl."\n";
    	system("perl /opt/CHaS/PEaS.pl /location/to/create/folder/of/output/$cleanUrl $url");
    }

    fclose($handle);
} else {
    // error opening the file.
} 


function clean($string) {
   $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
   $string = preg_replace('/[^A-Za-z0-9\-]/', '_', $string); // Removes special chars.

   return preg_replace('/_+/', '_', $string); // Replaces multiple hyphens with single one.
}
?>