<?php
ini_set("memory_limit",-1);
set_time_limit(0);
date_default_timezone_set("Asia/Jakarta");
define("OS", strtolower(PHP_OS));

eval(file_get_contents("https://raw.githubusercontent.com/L34Kc0deteam/paypal/master/RollingCurl.php"));
eval(file_get_contents("https://raw.githubusercontent.com/L34Kc0deteam/paypal/master/Request.php"));
eval(file_get_contents("https://raw.githubusercontent.com/L34Kc0deteam/paypal/master/curl.php"));

echo "
------------------------
Reverse Ip By ZakirDotID
--- Ciee Mau Crack -----
D====> H3h3h3h3 <======B
";

enterlist:
$listname = readline(" Enter list : ");
if(empty($listname) || !file_exists($listname)) {
	echo"[?] list not found".PHP_EOL;
	goto enterlist;
}
else if($listname == "n") {
	echo "[?] list not found".PHP_EOL;
	goto enterlist;
}

$lists = array_unique(explode("\n", str_replace("\r", "", file_get_contents($listname))));

ratio:
$ratio = readline(" Ratio Check per second (example: 10 max *20)? : ");
$ratio = (empty($ratio) || !is_numeric($ratio) || $ratio <= 0) ? 60 : $ratio;
if($ratio > 60) {
	echo "[!] max 20".PHP_EOL;
	goto ratio;
}
else if($ratio == "1") {
	echo "[!] Minimal 2".PHP_EOL;
	goto ratio;
}
echo PHP_EOL;

$start = microtime(true);
$no = 1;
$c = 0;
$total = count($lists);
$hitung = 0;
$invalid = 0;
$valid = 0;
$pecah=1000000000;
$pecah_list=array_chunk($lists, $pecah);
$tot=count($pecah_list);

for ($i=0;$i<$tot;$i++){
	$rollingCurl = new \RollingCurl\RollingCurl();
	foreach($pecah_list[$i] as $list){
		$c++;
	    $url = "https://sonar.omnisint.io/reverse/{$list}"; 
		$rollingCurl->get($url);
	}

	$rollingCurl->setCallback(function(\RollingCurl\Request $request, \RollingCurl\RollingCurl $rollingCurl) use (&$results) {
		global $no, $total, $hitung, $valid, $invalid;
		$no++;
		$ip = explode("/", parse_url($request->getUrl(), PHP_URL_PATH));
		$ip = end($ip);

		echo "[".$no."/".$total."]-[".date("H:i:s")."] ";
		echo color()["LGRN"]."Domain = {$hitung} ". color()['MG']. " Valid = {$valid} ". color()['YL']. "Invalid = {$invalid}" . color()['WH']. ' | ';
		$data = json_decode($request->getResponseText(), 1);

		if (!$data or $data == null) {
			$invalid++;
			echo color()["YL"]. "{$ip} ".color()["WH"]."- NULL Domain". color()["WH"]. PHP_EOL;
		} else {
			$valid++;
			$jmlh = count($data);
			$hitung = $hitung + $jmlh;
			$temp = "";

			foreach($data as $dmn){
				$temp .= $dmn. "\r\n";
			}

			save("Result.txt", 'a', $temp);

			echo color()["CY"]. "{$ip} ".color()["WH"]."- Domain ( ". color()["LG"]. "{$jmlh}". "".color()["WH"]. " )".PHP_EOL;
		}
	})->setSimultaneousLimit((int) $ratio)->execute();
}

$persentasi = round($valid/$total * 100,2);
$finish = microtime(true);
$waktu = number_format($finish - $start);
echo PHP_EOL." Done....\n -- Total: ".$total." - waktu: ".$waktu." Detik - Domain: ".$hitung." - Valid: ".$valid." - Invalid: ".$invalid." -- Persentasi Valid: ".$persentasi. "% ".PHP_EOL;

function save($filename, $mode = 'a+', $data){
	$fp = @fopen($filename, $mode);
	@fwrite($fp, $data);
	@fclose($fp);
}

function color(){
	return array(
		"LW" => (OS == "linux" ? "\e[1;37m" : ""),
		"WH" => (OS == "linux" ? "\e[0m" : ""),
		"YL" => (OS == "linux" ? "\e[1;33m" : ""),
		"LR" => (OS == "linux" ? "\e[1;31m" : ""),
		"MG" => (OS == "linux" ? "\e[0;35m" : ""),
		"LM" => (OS == "linux" ? "\e[1;35m" : ""),
		"CY" => (OS == "linux" ? "\e[1;36m" : ""),
		"LG" => (OS == "linux" ? "\e[1;32m" : ""),
		"GRN" => (OS == "linux" ? "\e[0;32m" : ""),
		"LGRN" => (OS == "linux" ? "\e[32;4m" : "")
	);
}