Last active
June 13, 2017 02:37
-
-
Save indrakaw/58e03e06402253401b72e2d2ee64f7b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cmd=$1 | |
dir=$2 | |
curl -d "cmd=${cmd}&dir=${dir}&key=SuperSecretKEY" -X POST http://papan-tulis.xyz/api/exec.php?$3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['cmd']) && $_POST['key']=="SuperSecretKEY") { | |
$encoded = (isset($_GET['encoded'])) ? true : false ; | |
$cmd = ($encoded) ? urldecode($_POST['cmd']) : $_POST['cmd']; | |
$opt_path = '/home/papantul/api/output.txt'; | |
$home = '/home/papantul/'; | |
if (isset($_POST['dir']) && !empty($_POST['dir'])) { | |
$dir = ($encoded) ? urldecode($_POST['dir']) : $_POST['dir']; | |
} else { | |
$dir = "~"; | |
} | |
$dir = str_replace("~",$home,$dir); | |
chdir($dir); | |
// echo $dir; | |
if (isset($_GET['shell'])) { | |
shell_exec("$cmd > $opt_path"); | |
} else { | |
exec("$cmd > $opt_path"); | |
} | |
if (file_exists($opt_path)) { | |
echo file_get_contents($opt_path); | |
exec("rm $opt_path"); | |
} | |
//var_dump($outputAndErrors); | |
//var_dump($return_value); | |
} else { | |
echo "Nyaa~"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment