Advertisement
RieqyNS13

shout bot :peace

Apr 15th, 2013
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.75 KB | None | 0 0
  1. <?php
  2. class rieqyns13{
  3.     var $user;
  4.     var $pass;
  5.     var $cookie;
  6.     var $user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)";
  7.     function curl($url, $data="", $header=""){
  8.         $ch = curl_init();
  9.         if($data != ""){
  10.             curl_setopt($ch, CURLOPT_POST, true);
  11.             curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  12.         }
  13.         if($header != ""){
  14.             curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  15.         }
  16.         curl_setopt($ch, CURLOPT_URL, $url);
  17.         curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
  18.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19.         curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie);
  20.         curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie);
  21.         $exec = curl_exec($ch);
  22.         curl_close($ch);
  23.         return $exec;
  24.     }
  25.     function login(){
  26.             $data = array("action" => "do_login", "username" => $this->user, "password" => $this->pass, "loginsubmit" => "Login!");
  27.             $login = $this->curl("http://devilzc0de.org/forum/index.php", $data, "");
  28.             return $login;
  29.     }
  30.     function get_shout(){
  31.         $get = $this->curl("http://devilzc0de.org/forum/xmlhttp.php?action=show_shouts&last_id=");
  32.         $strip = strip_tags($get);
  33.         $exp = explode("^--^", $get);
  34.         $exp2 = explode("</span><br />", $exp[2]);
  35.         $preg = preg_split("/(--)/", $exp2[0]);
  36.         $user = strip_tags($preg[0]);
  37.         $re_user = str_replace("&raquo; &nbsp;&nbsp;(report)", "", $user);
  38.         $data = explode("title=", $preg[1]);
  39.         $shout = strip_tags($data[0]);
  40.         if(count($data)>1){
  41.                 $data_dc[2] = strip_tags(":".str_replace(array('"', '/>'), "", $data[1])); //smiles content
  42.         }
  43.         $data_dc[0] = trim(substr($re_user, 0, -15)); //user
  44.        
  45.         $data_dc[1] = $shout; //content
  46.         return $data_dc;
  47. }
  48.     function smiles(){
  49.         $smile = $this->curl("http://devilzc0de.org/forum/misc.php?action=smilies&popup=true&editor=clickableEditor");
  50.         $remove_html = strip_tags($smile);
  51.         $pecah = explode("Click a smilie to insert it into your message", $remove_html);
  52.         $hapus =  str_replace(array("[", "]", "close window", "\n", "\r", "\r\n"), " ", $pecah[1]);
  53.         $hapus2 = preg_replace("/\s+/", " ", $hapus);
  54.         $smiles = explode(" ",trim($hapus2));
  55.         return $smiles;
  56. }
  57.  
  58.     function simsimi($str){
  59.         //$str2 = str_replace(":", "", $this->get_shout()[2]);
  60.         $header = array("Host: www.simsimi.com",
  61.         "User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0",
  62.         "Accept: application/json, text/javascript, */*; q=0.01",
  63.         "Accept-Language: id,en-us;q=0.7,en;q=0.3",
  64.         "Accept-Encoding: gzip, deflate",
  65.         "Content-Type: application/json; charset=utf-8",
  66.         "X-Requested-With: XMLHttpRequest",
  67.         "Referer: http://www.simsimi.com/talk.htm",
  68.         "Cookie: JSESSIONID=C0FC34FC18759A066A96F8AF45C118E4; __utma=119922954.1103205367.1366419001.1366419001.1366419001.1; __utmb=119922954.2.10.1366419001; __utmc=119922954; __utmz=119922954.1366419001.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sagree=true",
  69.         "Connection: keep-alive",
  70.         "HTTP/1.1 200 OK");
  71.         $simi = $this->curl("http://www.simsimi.com/func/req?msg=".urlencode($str)."&lc=id&sagree=true", "", $header);
  72.         $dec = json_decode($simi, true);
  73.         if(empty($dec)){
  74.                 $simi = "apa itu gan ? ane gak pernah denger";
  75.                 return $simi;
  76.         }else{
  77.                 $simic = $dec['response'];
  78.                 $preg = preg_replace("/simsimi|simi|Simi|sim/", "ane", $simic);
  79.                 return $preg;          
  80.         }
  81. }
  82.     function post($post){
  83.         $data = array("action" => "add_shout", "shout_data" => $post);
  84.         $post = $this->curl("http://devilzc0de.org/forum/xmlhttp.php", $data);
  85.         return $post;
  86.     }
  87.     function log($str){
  88.         $fp = fopen("log_dc.txt", "a");
  89.         fwrite($fp, $str."\n");
  90.         fclose($fp);
  91.     }
  92.     function bot(){
  93.         $smiles_o = null;
  94.         $login = $this->login();
  95.         if(!empty($this->get_shout()[2])){
  96.             $smile = str_replace(":", "", $this->get_shout()[2]);
  97.             $smile_o = $this->get_shout()[2];
  98.         }
  99.         if($login){
  100.             a:
  101.             if($this->get_shout()[0] == $this->user){
  102.                 echo "tidak dapat membalas username yang sama\n";
  103.                 goto a;
  104.             }elseif($this->get_shout()[0] != $this->user){
  105.             $user = $this->get_shout()[0];
  106.             $shout = trim($this->get_shout()[1]);
  107.             $simi = $this->simsimi($shout." ".$smile);
  108.             $smile = $this->smiles()[rand(0, count($this->smiles())-1)];
  109.             $post = "[i]".$user." : ".$shout." ".$smile_o."[/i] > ".$simi." ".$smile."\n";
  110.             $send = $post." (".$this->post($post).")";
  111.             $this->log($send);
  112.             echo $send;
  113.             }
  114.         }
  115.     }
  116. }
  117. $bot = new rieqyns13;
  118. $bot->user = "username";
  119. $bot->pass = "passwiord";
  120. $bot->cookie = "cookie.txt";
  121. $a=50;
  122. while($a--){
  123.     $bot->bot();
  124.     Sleep(2);
  125. }
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement