Показать сообщение отдельно

  #7  
Старый 20.03.2009, 17:06
Shadow_p1raT
Участник форума
Регистрация: 09.03.2008
Сообщений: 193
С нами: 9564806

Репутация: 267
По умолчанию

Вообщем решил сюда тоже запостит,так как темка та уже потерялась а скрипт полезный:-)
Требует модуля php_openssl.
PHP код:
<?php 
######################################### 

#            Google Maps Api by Shadow_p1raT 
#                ICQ#: 9930875 

######################################### 
# [setting] # 
$email '1111111@gmail.com'// Аккунт на гмаил.ком 
$pass  '1111111'// Пароль от акка 
$proxy '127.0.0.1:3130'// Прокси если надо 
$url   'http://forum.antichat.ru/'// Урл сайта  

#[/setting] # 
echo '<title>Google Maps Api by Shadow_p1raT</title>'
set_time_limit(0); 
class 
gMapKey 
     
    private 
$email
    private 
$pass
    private 
$proxy
    private 
$url
    private 
$result;
     
     
    private function 
sock_do($action,$method,$header false,$params false,$cookie false,$referer false)  
    {  
       
$out    = array('http' => array());  
       
$method strtoupper($method);  
       if(
$method == 'GET') {  
          
$action .= !empty($params) ? '?'.$params '';  
          
$out['http']['method'] = 'GET';  
        
       } elseif(
$method == 'POST') {  
          
$out['http']['method']  = 'POST';  
          
$out['http']['header']  = "Content-type: application/x-www-form-urlencoded\r\n".  
                                    
"Content-length: ".strlen($params)."\r\n";  
          
$out['http']['content'] = $params;                          
       } else {  
          die(
'Йа криветко');  
       }   
       if(
$this->proxy) {  
          
$out['http']['proxy'] = 'tcp://'.$this->proxy;  
       }  
       if(
$cookie) {  
          
$out['http']['header'] .= 'Cookie: '.$cookie."\r\n";  
       }  
       if(
$referer) {  
          
$out['http']['header'] .= 'Referer: '.$referer."\r\n";  
       }  
       
$out['http']['header'] .= "Connection: close\r\n";  
       
$out['http']['header'] .= "User-Agent: Opera/9.62 (Windows NT 6.0; U; ru) Presto/2.1.1\r\n";  
     
       
$content stream_context_create($out);  
       
$result = @file_get_contents($action,false,$content);  
       
$res = array();  
       
$res = array($result);  
       if(
$header) {  
          
$res[] = implode("\r\n",$http_response_header);  
       }  
       return 
$res//Возвращаем ответ + заголовки                      
    

    private function 
preg_Cookie($cookie
    { 
       
preg_match_all('#Set-cookie: (.*;)#UiS',$cookie,$headers); 
       return 
implode(' ',$headers['1']); 
    } 
    private function 
preg_Location($text
    { 
       
preg_match('#Location: (.*)#',$text,$reg); 
       return 
trim($reg['1']); 
    } 
    private function 
getnormal ($str
    { 
       return 
str_replace ("&amp;""&"$str); 
    } 
    public function 
setOption($email,$pass,$url,$proxy ''
    { 
       
$this->email urlencode($email); 
       
$this->pass  urlencode($pass); 
       
$this->url   urlencode($url); 
       
$this->proxy $proxy
    }
    public function 
parse()
    {
       if(
strstr($this->result,'Your key is')) 
       { 
          
preg_match('~page_title">(.*)\&copy;2008 Google~sUi',$this->result,$reg); 
          echo 
'<html> 
               <head> 
               <link href="http://code.google.com/css/codesite.pack.01312008.css" type="text/css" rel="stylesheet"></link> 
               </head>'

          echo 
$reg[1]; 
       } 
       else 
       { 
          echo 
'[-] Не удалось получить Google Maps API Key!'
       }           
    }           
    public function 
Sign()  
    { 
       
$res $this->sock_do('https://www.google.com/accounts/LoginAuth','POST',1,'Email='.$this->email.'&Passwd='.$this->pass.'&PersistentCookie=yes&rmShown=1&signIn=%D0%92%D0%BE%D0%B9%D1%82%D0%B8&asts='); 
       
$cookie $this->preg_Cookie($res[1]); 
       
$location $this->preg_Location($res[1]) or die('[-] Неправильный логин или пароль!'); 
       unset(
$res); 
       
$res $this->sock_do($location,'GET',1,'',$cookie); 
       
preg_match('/url='(.+?)'/',$res[0],$reg) or die('[-] Произошла ошибка при логине аккунта!'); 
       
$location $this->getnormal($reg[1]); 
       unset(
$res); 
       
$res $this->sock_do($location,'GET',1,'',$cookie); 
       
$cookie $this->preg_Cookie($res[1]); 
       unset(
$res); 
       
$res $this->sock_do('http://maps.google.com/maps/api_signup?url='.$this->url,'GET',1,'',$cookie);  
       
$this->result $res[0];
       unset(
$res); 
    }
}            
$gmk = new gMapKey(); 
$gmk->setOption($email,$pass,$url,$proxy); 
$gmk->Sign();
$gmk->parse();        
?>
Форум порезал некоторые регулярки)
Качаем
Вложения
Тип файла: rar gmakey.rar (1.7 Кб, 5 просмотров)
 
Ответить с цитированием