Does anyone know how to use this in browser?
Here is the code:
Here is the code:
PHP Code
<?php
/**
8888888b. .d8888b. .d8888b. .d8888b. 888 Y88b d88P 888 .d8888b.
888 Y88b d88P Y88b d88P Y88b d88P Y88b 888 Y88b d88P 888 d88P Y88b
888 888 888 888 .d88P Y88b. 888 Y88o88P 888 .d88P
888 d88P 888d888 888 888 888 888 8888" 888d888 "Y888b. 888888 Y888P 888 8888"
8888888P" 888P" 888 888 `Y8bd8P' "Y8b. 888P" "Y88b. 888 888 888 "Y8b.
888 888 888 888 X88K 888 888 888 "888 888 888 888 888 888
888 888 Y88b d88P .d8""8b. Y88b d88P 888 Y88b d88P Y88b. 888 888 Y88b d88P
888 888 "Y8888P" 888 888 "Y8888P" 888 "Y8888P" "Y888 888 888 "Y8888P"
(¯`·.¸¸.·´¯`·.¸¸.-> PHP WebDAV Scanner by Pr0x3rStYl3 <-.¸¸.·´¯`·.¸¸.·´¯)
WARNING! - I am not responsible for any use made with this script.
**/
set_time_limit(0);
ignore_user_abort(TRUE);
class Webdav_Scanner
{
function IPtoLIST($IP1,$IP2)
{
for ($lIP = ip2long($IP1) ; $lIP <= ip2long($IP2) ; $lIP++)
{
$aIPList[] = long2ip($lIP);
}
return $aIPList;
}
function Scan($IP1,$IP2,$logfile)
{
$start = time();
$IPList = $this->IPtoLIST($IP1,$IP2);
$return = false;
$workingc = 0;
$scanned = 0;
if($logfile !== "")
{
$this->log("\nStart scanning at ".date("F j, Y, g:i a")." - from ".$IP1." to ".$IP2."\n\nWebdavs Found:\n",$logfile);
}
foreach ($IPList as $ip)
{
$scanned += 1;
if (($scanned % 2550) == 0)
{
$count1 = $scanned / count($IPList);
$count2 = $count1 * 100;
$count = number_format($count2, 0);
$this->log("Scanned by far: ".$scanned." of ".count($IPList)." (".$count."%) at ".date("F j, Y, g:i a"),$logfile);
}
$fp = @fsockopen($ip,80,$errno,$errstr,0.5);
if($fp)
{
$workingw = $this->Process($ip,$logfile);
if ($workingw !== false)
{
$return = $workingw;
$workingc += 1;
}
fclose($fp);
}
}
if($logfile !== "")
{
$end = time();
$diff = $end - $start;
$time = date("H:i:s", $diff);
$this->log("\n\nEnd of scanning at ".date("F j, Y, g:i a")." - ".$workingc." webdavs found - It took ".$time,$logfile);
}
return $return;
}
function Process($IP,$logfile)
{
$working = false;
$search_for = array("testpage", "There is either no index document or the directory is read-protected.");
$url = "http://".$IP."/webdav/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,3);
curl_setopt($ch,CURLOPT_USERAGENT,'www.booter.co');
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$res = curl_exec($ch);
curl_close($ch);
if ($this->Search_Array($res,$search_for))
{
$working[] = "http://".$IP."/webdav";
if($logfile !== "")
{
$this->log("\nFound: http://".$IP."/webdav\n",$logfile);
}
}
return $working;
}
function Search_Array($string, $array)
{
$field_values = array_values($array);
foreach ($field_values as $field_value)
{
if (strpos($string, $field_value) !== false)
{
return true;
}
}
return false;
}
function log($data,$logfile)
{
if($data !== "")
{
$fh = fopen($logfile, file_exists($logfile) ? 'a' : 'w') or die("Can't open ".$logfile." to write logs");;
fwrite($fh, $data."\n");
fclose($fh);
}
}
}
$sIP1 = "127.0.0.1";
$sIP2 = "127.0.0.10";
$logfile = time()."-webdav.log";
$Scanner = new Webdav_Scanner();
$Working_webdavs = $Scanner->Scan($sIP1,$sIP2,$logfile); // Scan IP's with logs - The script folder must be writable!
if($Working_webdavs == false)
{
echo "Sorry, I can't find any webdavs in this IP range.";
}else{
echo "<pre>";
print_r($Working_webdavs);
echo "</pre>";
}
exit;
?>