Update exectool.php
This commit is contained in:
parent
e11c6ef898
commit
88ffd1366f
|
@ -2,7 +2,8 @@
|
||||||
/**
|
/**
|
||||||
* @file exectool.php
|
* @file exectool.php
|
||||||
* @date 2018-07-22
|
* @date 2018-07-22
|
||||||
* @author forked from https://github.com/scipag/PHPUtilities
|
* @auther Go Namhyeon <gnh1201@gmail.com>
|
||||||
|
* @forked from https://github.com/scipag/PHPUtilities
|
||||||
* @brief ExecTool helper
|
* @brief ExecTool helper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -104,8 +105,9 @@ if(!function_exists("exec_test")) {
|
||||||
*/
|
*/
|
||||||
if(!function_exists("exec_command")) {
|
if(!function_exists("exec_command")) {
|
||||||
function exec_command($command, $method) {
|
function exec_command($command, $method) {
|
||||||
if ($method == "") {
|
$return = false;
|
||||||
|
|
||||||
|
if ($method == "") {
|
||||||
// ob_start() will turn on output buffering to collect all output from
|
// ob_start() will turn on output buffering to collect all output from
|
||||||
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
|
// exec_test() and ob_end_clean() will clean the buffer afterwards ("garbage collection")
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -114,13 +116,14 @@ if(!function_exists("exec_command")) {
|
||||||
|
|
||||||
if (is_array($methodArray)) {
|
if (is_array($methodArray)) {
|
||||||
$method = $methodArray[0];
|
$method = $methodArray[0];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
echo "[!] No method available";
|
echo "[!] No method available";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
switch ($method) {
|
switch ($method) {
|
||||||
case "system":
|
case "system":
|
||||||
system("$command 2>&1");
|
system("$command 2>&1");
|
||||||
|
@ -169,5 +172,9 @@ if(!function_exists("exec_command")) {
|
||||||
echo "[!] No method defined";
|
echo "[!] No method defined";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$return = ob_get_clean();
|
||||||
|
|
||||||
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user