help me with a script

TheRogue

Junior Member
Joined
Mar 28, 2009
Messages
136
Reaction score
15
Code:
<?php
 
// PHP anonymity checker
//
//   (c) Involutive 2008 http://www.involutive.com
//   author: Paolo Ardoino < [email protected] >
//
//      Usage:
//              $anons = array(
//                      array("ip" => "1.2.3.4", "port" => 8080, "type" => "socks4"),
//                      array("ip" => "1.2.3.5", "port" => 8080, "type" => "socks5"),
//                      array("ip" => "1.2.3.6", "port" => 8080, "type" => "proxy")
//              );
//
//              $pa = new phpanon(array("anons" => $anons));
//              $pa->check();
//              $pa->done();
//
//              $anons is an array of triples ("ip" => ip, "port" => port, "type" => type)
//                      ip: ip address of the socks / proxy
//                      port: port of the socks / proxy
//                      type: socks5 (for socks5), socks4 (for socks4), proxy (for proxy)
//
//              Other options:
//                      "url" => "http://www.example.com" : connection test page
//                      "needle" => "someword" : some word contained in the page set by "url"
//                      "user_agent" => "Mozilla Firefox" : set an alternative user_agent
//                      "url_referer" => "http://www.mypage.com" : set a referer url
 
class phpanon {
    public $anons = array (
                           array("ip" => "67.160.54.36", "port" => 4493, "type" => "socks4"),
                           array("ip" => "67.174.139.134", "port" => 32687, "type" => "socks4"),
                           array("ip" => "67.175.1.24", "port" => 56253, "type" => "socks4")
                           );
                           
    public $opts = array("user_agent" => "Mozilla Firefox", "url_referer" => "http://www.mypage.com", "url" => "http://google.com", "needle" => "Compensation");
 
    function __construct($opts) {
 
        if(sizeof($opts["anons"]) > 0) {
            $this->anons = $opts["anons"];
        }
 
        if($opts["user_agent"] != "") {
            $this->opts["user_agent"] = $opts["user_agent"];
        }
 
        if($opts["url_referer"] != "") {
            $this->opts["url_referer"] = $opts["url_referer"];
        }
 
    }
 
    function check() {
        echo "PHP anonymity checker v0.2\n\t(c) 2007 Involutive http://www.involutive.com\n";
        echo "\tAuthor: Paolo Ardoino < [email protected] >\n";
 
        if(sizeof($this->anons) > 0) {
            for($i = 0, $cnt_good = 0, $cnt_gad = 0, $y = sizeof($this->anons); $i < $y; $i++) {
                $anon = &$this->anons[$i];
                if($anon["ip"] != "" && $anon["port"] != "" && $anon["type"]) {
                    echo "Checking ".$anon["ip"].":".$anon["port"]." [ type ".$anon["type"]." ] ... ";
                    $ch = curl_init($this->opts["url"]);
 
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_HEADER, 0);
                    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 
                    if($this->opts["user_agent"] != "") {
                        curl_setopt($ch, CURLOPT_USERAGENT, $this->opts["user_agent"]);
                    }
                    if($this->opts["url_referer"] != "") {
                        curl_setopt($ch, CURLOPT_REFERER, $this->opts["url_referer"]);
                    }
 
                    curl_setopt($ch, CURLOPT_PROXY, $anon["ip"].":".$anon["port"]);
                    if($anon["type"] == "socks4") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
                    else if($anon["type"] == "socks5") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
 
                    $html = curl_exec($ch);
                    if(curl_errno($ch) || $html == "" || strpos($html, $this->opts["needle"]) === FALSE) {
                        $anon["status"] = 0;
                        $cnt_gad++;
                        echo "not working\n";
                    } else {
 
                        $anon["status"] = 1;
                        $cnt_good++;
                        echo "working\n";
                    }
                    curl_close ($ch);
                    unset($ch);
                }
                unset($anon);
            }
        }
 
        echo "Done.\n";
    }
}
 
?>

can anyone help me with this one? i run it on the server and it gives me
Code:
php proxy.php
Content-type: text/html

<br />
<b>Parse error</b>:  syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/home/content/c/i/p/cipriantd/html/test/proxy.php</b> on line <b>31</b><br />
Runing it on the web, it doesnt output anything
 
It's working corectly.
In "Usage" is a smalll bug - you dont have in class "done()" method so you can't use it :)
regards Lukas
 
add "done" method to this classs or just dont use it. eg:

PHP:
$anons = array(
                array("ip" => "1.2.3.4", "port" => 8080, "type" => "socks4"),
                array("ip" => "1.2.3.5", "port" => 8080, "type" => "socks5"),
                array("ip" => "1.2.3.6", "port" => 8080, "type" => "proxy")
);

$pa = new phpanon(array("anons" => $anons));
$pa->check();
 
it gives me an error on this line
Code:
[COLOR=#000000][COLOR=#0000BB]$pa [/COLOR][COLOR=#007700]= new [/COLOR][COLOR=#0000BB]phpanon[/COLOR][COLOR=#007700](array([/COLOR][COLOR=#DD0000]"anons" [/COLOR][COLOR=#007700]=> [/COLOR][COLOR=#0000BB]$anons[/COLOR][COLOR=#007700]));[/COLOR][/COLOR]
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /home/content/c/i/p/cipriantd/html/test/proxy.php on line 36
but i cant see anything wrong
Is this script working for you? If so maybe it's my php server:-??
add "done" method to this classs or just dont use it. eg:

PHP:
$anons = array(
                array("ip" => "1.2.3.4", "port" => 8080, "type" => "socks4"),
                array("ip" => "1.2.3.5", "port" => 8080, "type" => "socks5"),
                array("ip" => "1.2.3.6", "port" => 8080, "type" => "proxy")
);

$pa = new phpanon(array("anons" => $anons));
$pa->check();
 
ok, i got it to work
Code:
<?php
 
// PHP anonymity checker
//
//   (c) Involutive 2008 http://www.involutive.com
//   author: Paolo Ardoino < [email protected] >
//
//      Usage:
//              $anons = array(
//                      array("ip" => "1.2.3.4", "port" => 8080, "type" => "socks4"),
//                      array("ip" => "1.2.3.5", "port" => 8080, "type" => "socks5"),
//                      array("ip" => "1.2.3.6", "port" => 8080, "type" => "proxy")
//              );
//
//              $pa = new phpanon(array("anons" => $anons));
//              $pa->check();
//              $pa->done();
//
//              $anons is an array of triples ("ip" => ip, "port" => port, "type" => type)
//                      i4p: ip address of the socks / proxy
//                      port: port of the socks / proxy
//                      type: socks5 (for socks5), socks4 (for socks4), proxy (for proxy)
//
//              Other options:
//                      "url" => "http://www.example.com" : connection test page
//                      "needle" => "someword" : some word contained in the page set by "url"
//                      "user_agent" => "Mozilla Firefox" : set an alternative user_agent
//                      "url_referer" => "http://www.mypage.com" : set a referer url
 
class phpanon {
    
    //un array cu valori folosit in functiile de mai jos
    public $opts = array("user_agent" => "Mozilla Firefox", "url_referer" => "http://www.mypage.com", "url" => "http://www.google.com", "needle" => "iGoogle");
 
    
    //constructor
    function __construct($opts) {
 
        if(sizeof($opts["anons"]) > 0) {
            $this->anons = $opts["anons"];
        }
 
        if($opts["user_agent"] != "") {
            $this->opts["user_agent"] = $opts["user_agent"];
        }
 
        if($opts["url_referer"] != "") {
            $this->opts["url_referer"] = $opts["url_referer"];
        }
 
    }
 
    
    //functia check
    function check() {
        echo "\nPHP anonymity checker v0.2\n\t(c) 2007 Involutive http://www.involutive.com";
        echo "\nAuthor: Paolo Ardoino < [email protected]> ";
 
        if(sizeof($this->anons) > 0) {
            for($i = 0, $cnt_good = 0, $cnt_gad = 0, $y = sizeof($this->anons); $i < $y; $i++) {
                $anon = &$this->anons[$i];
                if($anon["ip"] != "" && $anon["port"] != "" && $anon["type"]) {
                    echo "\nChecking ".$anon["ip"].":".$anon["port"]." [ type ".$anon["type"]." ] ... ";
                    $ch = curl_init($this->opts["url"]);
 
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_HEADER, 0);
                    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 
                    if($this->opts["user_agent"] != "") {
                        curl_setopt($ch, CURLOPT_USERAGENT, $this->opts["user_agent"]);
                    }
                    if($this->opts["url_referer"] != "") {
                        curl_setopt($ch, CURLOPT_REFERER, $this->opts["url_referer"]);
                    }
 
                    curl_setopt($ch, CURLOPT_PROXY, $anon["ip"].":".$anon["port"]);
                    if($anon["type"] == "socks4") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
                    else if($anon["type"] == "socks5") curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
 
                    $html = curl_exec($ch);
                    if(curl_errno($ch) || $html == "" || strpos($html, $this->opts["needle"]) === FALSE) {
                        $anon["status"] = 0;
                        $cnt_gad++;
                        echo "not working\n";
                    } else {
 
                        $anon["status"] = 1;
                        $cnt_good++;
                        echo "working \n";
                    }
                    curl_close ($ch);
                    unset($ch);
                }
                unset($anon);
            }
        }
 
        echo "Done. \n";
    }
    
    
}//sfarsitul definitiei clasei



//codul de mai jos se va executa cand se executa scriptul, codul de mai sus este numai definitia clasei

$anons = array(
      array("ip" => "69.127.2.157", "port" => 27861, "type" => "socks4"),
      array("ip" => "71.237.34.56", "port" => 49503, "type" => "socks4"),
      array("ip" => "204.188.202.210", "port" => 5841, "type" => "socks4")
);

$pa = new phpanon(array("anons" => $anons));
$pa->check();

 
?>
but none of the proxy seems to work :-w
 
Did you set up the "Other options" in the script correctly?
 
yes, i guess so, there's nothing to complicated about that, the above script si exactly the one i use
 
Back
Top