Навигация по разделуВсе категорииБолталкаЗаметкиPHP
Свернуть категорию PHPДобавить в категорию
PHP 5 class validates Socks4 , Socks5 and Proxy lists.
Add to favorites 
Добавлено : 2008-07-29 10:14:10 . Пользователем : BOSS . Все предложения : BOSS . Просмотров - 1686
This simple PHP 5 class validates Socks4 , Socks5 and Proxy lists.



<?php

// PHP anonymity checker
//
// (c) Involutive 2008 http://www.involutive.com
// author: Paolo Ardoino < paolo@involutive.com >
//
// 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();
public $opts = array("user_agent" => "", "url_referer" => "", "url" => "http://www.google.com", "needle" => "groups");

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
(c) 2007 Involutive http://www.involutive.com
";
echo " Author: Paolo Ardoino < paolo@involutive.com >
";

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
";
} else {
$anon["status"] = 1;
$cnt_good++;
echo "working
";
}
curl_close ($ch);
unset($ch);
}
unset($anon);
}
}

echo "Done.
";
}
}

?>

Ключевые слова : socks4socks5proxyproxy cheker

Для добавления вашего коментария вы должны авторизоваться , если вы не зарегистрированы то зарегистрируйтесь .


Shop4guru © v.3.1.1, Copyright © 2005-2008, 4gu.ru Ltd. Русская версия: Shop4guru ™