Skip to content

Instantly share code, notes, and snippets.

@parsibox
Created August 14, 2019 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parsibox/8b4581c5b73dd6e439ae20599876ffcc to your computer and use it in GitHub Desktop.
Save parsibox/8b4581c5b73dd6e439ae20599876ffcc to your computer and use it in GitHub Desktop.
uceprotect checker
<?php
if(!function_exists('curl_init')) {
die('cURL not available!');
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_REFERER, 'http://www.uceprotect.net/en/rblcheck.php');
curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__).'/1.php'); //initiates cookie file if needed
curl_setopt($curl, CURLOPT_COOKIEFILE, dirname(__FILE__).'/1.php'); // Uses cookies from previous session if exist
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, 'http://www.uceprotect.net/en/rblcheck.php?ipr=185.237.85.21');
$output_0 = curl_exec($curl);
$dom = new DOMDocument();
@$dom->loadHTML( $output_0);
$xpath = new DOMXPath($dom);
$table=$xpath->query("//input[@name='subchannel']")->item(0);
curl_setopt($curl, CURLOPT_URL, 'http://www.uceprotect.net/en/rblcheck.php');
curl_setopt($curl,CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, 'whattocheck=IP&ipr=185.237.85.21&subchannel='.$table->getAttribute("value"));
$output = curl_exec($curl);
if ($output === FALSE) {
echo 'An error has occurred: ' . curl_error($curl) . PHP_EOL;
} else {
if( preg_match("#asn-details.php(.*?)'#i" , $output , $match )){
print 'http://www.uceprotect.net/en/asn-details.php'.$match[1];
curl_setopt($curl, CURLOPT_URL, 'http://www.uceprotect.net/en/asn-details.php'.$match[1]);
$output_2 = curl_exec($curl);
if ($output_2 === FALSE) {
echo 'An error has occurred: ' . curl_error($curl) . PHP_EOL;
} else {
$document = new DOMDocument;
@$document->loadHTML($output_2);
$xpath = new DOMXPath($document);
$trs = $xpath->query('//tr');
$array = [];
$array_top = [];
foreach ($trs as $key => $tr) {
$td = $xpath->query('td', $tr);
foreach ($td as $value) {
$array[$key][] = $value->nodeValue;
}
if( isset( $array[$key][1] )){
if( $array[$key][1] > 3 ){
$array_top[]=$array[$key][0];
}
}
}
if( ! empty( $array_top)){
print'سلام لطفا این آی پی ها را بلاک کنید'.PHP_EOL.implode( ',' , $array_top );
}
}
}else{
print 'error';
echo $output;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment