Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.29 KB | None | 0 0
  1. <?php
  2.  
  3. set_time_limit(0);
  4. class Diesel{
  5.  
  6.     public $user;
  7.     public $pass;
  8.     public $post;
  9.  
  10.     public function login(){
  11.  
  12.     $authArray=array(
  13.         'ips_username' => $this->user,
  14.         'ips_password' => $this->pass,
  15.         'submit' => 'Войти'
  16.     );
  17.  
  18.     $result=$this->request('http://diesel.elcat.kg/index.php?act=Login&CODE=01',                                                                                                                                                             $authArray,'POST');
  19.  
  20.     }
  21.  
  22.     public function findDeleteLink(){
  23.         $res= $this->request($this->post."&st=9999",false,'GET');
  24.         if(preg_match_all('/\<table\s+class(.*)\s+\<\/table\>/isU',$res,$pages))                                                                                                                                                             {
  25.             foreach($pages[0] as $k=>$v){
  26.             if(preg_match('/onmousedown=\"ins\(\''.$this->user.'\'\);\s+return\s                                                                                                                                                             +false\"\>\<b\>'.$this->user.'\<\/b\>\<\/a\>/',$v,$out)){
  27.                 if(preg_match('/\<div\s+class=\"postcolor\"\s+id=\'post\-(.*)\'\                                                                                                                                                             >\s+up\s+\<\!\-\-IBF\.ATTACHMENT_/isU',$v,$out2)){
  28.                 if(preg_match('/delete_post\(\'(.*)\'\)\"\>/isU',$v,$result)){
  29.                     return $result[1];
  30.                     }
  31.                 }
  32.             }
  33.             }
  34.         }
  35.     return false;
  36.      }
  37.  
  38.      public function deleteLink($link){
  39.         if($link!=false){
  40.         $res=htmlspecialchars_decode($link);
  41.         $out=$this->request($res,false,'GET');
  42.             if(preg_match('/\<p\>Сообщение\s+удалено\<br/',$out)){
  43.                 return true;
  44.         }
  45.     }
  46.     }
  47.  
  48.     public function newUp(){
  49.     $parse=$this->request($this->post.'&st=99999','','GET',false);
  50.     preg_match('/name=\"f\" value=\"(.*)\"/',$parse,$f);
  51.     preg_match('/name=\"t\" value=\"(.*)\"/',$parse,$t);
  52.     preg_match('/name=\"auth_key\" value=\"(.*)\"/',$parse,$auth_key);
  53.     $action='http://diesel.elcat.kg/index.php';
  54.     $f=$f[1];
  55.     $t=$t[1];
  56.     $auth_key=$auth_key[1];
  57.  
  58.     $upArray=array(
  59.         'act'   => 'Post',
  60.         'CODE'  => '03',
  61.         'f'             => $f,
  62.         't'             => $t,
  63.         'st'    => '99999',
  64.         'auth_key' => $auth_key,
  65.         'fast_reply_used'=> 1,
  66.         'Post'  => 'up',
  67.         'submit' => 'Отправить'
  68.  
  69.         );
  70.  
  71.     $result=$this->request($action,$upArray,'POST');
  72.     return $result;
  73.     }
  74.  
  75.     public function request($url,$params='',$method,$close=true){
  76.         $ch = curl_init();
  77.         curl_setopt($ch,CURLOPT_URL, $url);
  78.     if($method=='POST'){
  79.         curl_setopt($ch,CURLOPT_POST,1);
  80.         curl_setopt($ch,CURLOPT_POSTFIELDS, $params); // post data
  81.     }
  82.     curl_setopt($ch, CURLOPT_REFERER, $url);
  83.         curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64)                                                                                                                                                              AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 OPR/48                                                                                                                                                             .0.2685.52");
  84.         curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
  85.         curl_setopt($ch,CURLOPT_COOKIEJAR, "cookie-1.txt");
  86.         curl_setopt($ch,CURLOPT_COOKIEFILE, "cookie-1.txt");
  87.         curl_setopt($ch,CURLOPT_VERBOSE, false);
  88.     curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
  89.     curl_setopt($ch,CURLOPT_FOLLOWLOCATION, true);
  90.          $result = curl_exec($ch);
  91.     if($close==true){
  92.         curl_close($ch);
  93.     }
  94.         return $result;
  95.     }
  96. }
  97.  
  98. $test=new Diesel();
  99. $test->user='upzap';
  100. $test->pass='123456';
  101. $test->login();
  102. $test->post='http://diesel.elcat.kg/index.php?showtopic=292062127'; // тема
  103. echo $link=$test->findDeleteLink();
  104. $test->deleteLink($link);
  105. sleep(5);
  106. $test->newUp();
  107. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement