Файл: blackenergy/blackenergy/blackenergy/funcs.php
Строк: 118
<?php
    
    function HideMeProxyGet()
    {
        $regexp = "<td>([0-9]{1,3}.){3}[0-9]{1,3}</td><td>([1-9])([0-9]+?)</td><td>(.*)</td><td>(.*)</td>";
        $link = "http://hideme.ru/proxy-list/http";
        $text = file_get_contents($link);
        $count = preg_match_all("/$regexp/siU",$text,$matches);
            if ($count)
            {
                $output_data = array();
                foreach ($matches[0] as $match)
                {
                    $input_data = explode("</td><td>",$match);
                    $hjk = preg_match_all("/([0-9]{1,3}.){3}[0-9]{1,3}/",$input_data[0],$r);
                    $ip=$r[0][0];
                    $output_data[] = $ip.":".$input_data[1];
                }
                $output_data = implode("n",$output_data);
            return $output_data."n";
            } else return false;
    }
    
    function Samair_ForOne($n=1)
    {
        $c = sprintf("%02d",$n);
        $link = "http://www.samair.ru/proxy/time-$c.htm";
        $text = file_get_contents($link);
        //Получаем замены
        $replaces_regexp = "<script type="text/javascript">n([a-z]=[0-9];)(.*)</script>";
        $repls_count = preg_match_all("/$replaces_regexp/siU",$text,$matches);
        $repls_pre = trim($matches[1][0]);
        $repls_pre = trim($repls_pre,";");
        $repls_pre = explode(";",$repls_pre);
        $repls = array();
        foreach ($repls_pre as $repl)
        {
            $x = explode("=",$repl);
            $repls[$x[0]] = $x[1];
        }
        $repls_pre = trim($matches[2][0]);
        $repls_pre = trim($repls_pre,";");
        $repls_pre = explode(";",$repls_pre);
        foreach ($repls_pre as $repl)
        {
            $x = explode("=",$repl);
            $repls[$x[0]] = $x[1];
        }
        //Конец получения
        $regexp = "<td>([0-9]{1,3}.){3}[0-9]{1,3}<script type="text/javascript">document.write(":"([+a-z]+?))</script></td>";
        $count = preg_match_all("/$regexp/siU",$text,$matches);
        $output_data = array();
        
        if ($count)
        {
            for ($i=0;$i<$count;$i++)
            {
                $hjk = preg_match_all("/([0-9]{1,3}.){3}[0-9]{1,3}/",$matches[0][$i],$r);
                $ip=$r[0][0];
                $port = strtr(str_replace("+","",$matches[2][$i]),$repls);
                $output_data[] = $ip.":".$port;
            }
            return implode("n",$output_data);
        } else return false;
    }
    
    function Samair($count=5)
    {
        $output_data="";
        for ($i=1;$i<$count+1;$i++)
        {
            $output_data.=Samair_ForOne($i);
            $output_data.="n";
        }
        return $output_data;
    }
    
    function Spys_One($n=1)
    {
        $n--;
        $link = "http://spys.ru/proxylist$n/";
        $text = file_get_contents($link);
        $repls_regexp = "<script type="text/javascript">([a-z0-9]{1,}=[^a-z0-9]{1,};)(.*)</script>";
        $repls_count = preg_match_all("/$repls_regexp/siU",$text,$matches);
        $str = trim($matches[1][0].$matches[2][0],";nr ");
        $repls = array();
        foreach (explode(";",$str) as $a)
        {
            $d = explode("=",$a);
            if (strlen($d[0])==4)
            {
                eval("$repls["{$d[0]}"]={$d[1]};");
            } else {
                eval("$repls["{$d[0]}"]=".strtr($d[1],$repls).";");
            }
        }
        $regexp = '<font class=spy14>([0-9]{1,3}.){3}[0-9]{1,3}<script type="text/javascript">document.write("<font class=spy2>:<(.*)font>"(.*))</script></font>';
        $count = preg_match_all("/$regexp/siU",$text,$pmatches);
        if ($count)
        {
        $output_data = array();
        for ($i=0;$i<$count;$i++)
        {
            $port = "";
            $line = $pmatches[3][$i];
            $line = trim($line,"+");
            $line = explode("+",$line);
            foreach ($line as $block)
            {
                $block = strtr($block,$repls);
                eval("$port.=$block;");
            }
            $hjk = preg_match_all("/([0-9]{1,3}.){3}[0-9]{1,3}/",$pmatches[0][$i],$r);
            $ip=$r[0][0];
            $output_data[] = $ip.":".$port;
        }
        return implode("n",$output_data);
        } else return false;
        
    }
    
    function Spys($count=2)
    {
        $output_data="";
        for ($i=1;$i<$count+1;$i++)
        {
            $output_data.=Spys_One($i);
            $output_data.="n";
        }
        return $output_data;
    }
    
    function StdGet($text)
    {
        $regexp = "([0-9]{1,3}.){3}[0-9]{1,3}:([1-9])([0-9]+?)";
        $count = preg_match_all("/$regexp/siU",$text,$result);
        if ($count) return implode("n",$result[0])."n"; else return false;
    }
    
    function AnonProxy()
    {
        $link = "http://anonproxy.boom.ru/proxy.html";
        $text = file_get_contents($link);
        return StdGet($text);
    }
    
    function AliveProxy()
    {
        $link = "http://www.atomintersoft.com/products/alive-proxy/proxy-list";
        $text = file_get_contents($link);
        return StdGet($text);
    }
    
    function FineProxy($count=10)
    {
        $ret = "";
        for ($i=0;$i<$count;$i++)
        {
            $u=$i+1;
            $link = "http://fineproxy.ru/index.php/page/$u/";
            $text = file_get_contents($link);
            $ret .= StdGet($text);
        }
        return $ret;
    }
    
?>