PHP proxy check that also checks proxy that also checks it’s anonimity (using curl_multi)

Friday, April 16, 2010 16:04
Posted in category Blackhat

Based on the requests from some others, they wanted a script that not only checked for useful proxies but to see how anonymous they are.  The first one you upload to some server, it rates the proxy based on the header information passed.  3 being highly anonymous to 1 being a transparent proxy.

<?php
//proxy levels
//Level 3 Elite Proxy, connection looks like a regular client
//Level 2 Anonymous Proxy, no ip is forworded but target site could still tell it's a proxy
//Level 1 Transparent Proxy, ip is forworded and target site would be able to tell it's a proxy

if(!$_SERVER['HTTP_X_FORWARDED_FOR'] && !$_SERVER['HTTP_VIA'] && !$_SERVER['HTTP_PROXY_CONNECTION']){
 echo '3';
} elseif(!$_SERVER['HTTP_X_FORWARDED_FOR']){
 echo '2';
} else echo '1';
?>

This next script can be run from anywhere:

<?php
function checkProxies($proxies){
 //$proxies is an array of proxies in format ip:port,username:password
 $url = 'http://www.someplace.tld/proxycheck.php'; //url to query

 $count = count($proxies); //number of items in array
 echo 'Number of proxies in list: ' . $count . '<br />';

 $curl_arr = array();
 $master = curl_multi_init(); //create multi curl resource

 for($i = 0; $i < $count; $i++) {
 $proxy = $proxies[$i]; //grab proxy from array
 $curl_arr[$i] = curl_init(); // create new curl resource
 curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, TRUE); //return the data don't output it outright
 curl_setopt($curl_arr[$i], CURLOPT_HEADER, FALSE); //do not output the header info
 curl_setopt($curl_arr[$i], CURLOPT_URL, $url); //set our url to query
 curl_setopt($curl_arr[$i], CURLOPT_CONNECTTIMEOUT, 10); //set how long we'll give the proxy to respond in seconds in this instance 10 seconds

 $cproxy = explode(',', $proxy); //split the proxy into an array $cproxy[0] will be ip:port $cproxy[1] will be username:password
 curl_setopt($curl_arr[$i], CURLOPT_PROXY, $cproxy[0]); //set our proxy ip:port

 if($cproxy[1]) { //test for username pass
 curl_setopt($curl_arr[$i], CURLOPT_PROXYUSERPWD, $cprosy[1]); //set username:password
 }
 curl_multi_add_handle($master, $curl_arr[$i]); //add the current curl resource handle to the master
 }

 $running = null;
 do {
 curl_multi_exec($master,$running); //while there are running connections just keep looping
 } while($running > 0);

 echo 'Results: <br />';
 $a = 0; //output array counter
 for($i = 0; $i < $count; $i++) {
 $rawdata = curl_multi_getcontent($curl_arr[$i]); //get returned data from curl handle

 if($rawdata == '3'){
 //process elite proxy
 echo 'Elite Proxy found: ' . $proxies[$i] . '<br /><br />';
 $proxylist[$a] = $proxies[$i]; //it's a good proxy add it to our list
 $a++;
 } elseif($rawdata == '2'){
 //process anonymous proxy
 echo 'Anonymous Proxy found: ' . $proxies[$i] . '<br /><br />';
 $proxylist[$a] = $proxies[$i]; //it's a good proxy add it to our list
 $a++;
 } elseif($rawdata == '1') {
 //process transparent proxy
 echo 'Transparnet proxy: ' . $proxies[$i] . ' - Skipping. <br /><br />';
 } else echo 'Bad Proxy, nothing returned: ' . $proxies[$i] .  ' - Skipping. <br /><br />';

 }
 echo 'Number of good proxies: ' . count($proxylist);

 curl_multi_close($master); //destory the multi curl resource
 return $proxylist; //return an array of useable proxies

}

//start of main code
set_time_limit(0);
$proxies = file('proxies.txt'); //loads a file into an array each line being a new element
$proxies = checkProxies($proxies); //$proxies will be a returned array of usable proxies

?>

Enjoy.

You can leave a response, or trackback from your own site.
Hotmail


11 Responses to “PHP proxy check that also checks proxy that also checks it’s anonimity (using curl_multi)”

  1. Soviet says:

    June 9th, 2010 at 11:05 am

    http://rel” rel=”nofollow”>??…..…

    ?????? ??? ?? ????????? ????????????…

  2. ALEJANDRO says:

    June 25th, 2010 at 1:16 pm

    Pillspot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Pillspot.org. Herbal-supplements@buy.online” rel=”nofollow”>.…

    Categories: Mental HealthAntidepressants.Antiviral.Womens Health.Pain Relief.Stop SmokingBlood Pressure/Heart.Antidiabetic.Stomach.Eye Care.Anti-allergic/Asthma.Skin Care.Vitamins/Herbal Supplements.Anxiety/Sleep Aid.Antibiotics.Mens Health.Weight…

  3. 1 says:

    August 29th, 2010 at 1:43 am

    18 Display Case airplanes water/ http://04FORDPARTS.US/tag/1 : 1…

    1…

  4. promotion says:

    August 29th, 2010 at 4:18 am

    promotion http://zinternaljldarn.ANTIQUEFURNINISHING.INFO/tag/promotion Supplements nespresso/ : Supplements…

    nespresso…

  5. brochure says:

    August 29th, 2010 at 4:31 am

  6. breakfast says:

    August 29th, 2010 at 5:04 am

  7. bed says:

    August 29th, 2010 at 3:34 pm

  8. meters says:

    August 29th, 2010 at 3:38 pm

  9. machine says:

    August 29th, 2010 at 7:59 pm

  10. absorbers says:

    September 14th, 2010 at 9:00 pm

    absorbers http://azf.z1l.202i.ca : gmc…

    absorbers…

  11. Apple Introduces the iPad says:

    January 17th, 2011 at 7:57 pm

    The magic Bullet System 2…

Leave a Reply