Created
December 12, 2019 00:06
-
-
Save aeharvlee/a5f8262b6d68e01269ec6bf29a19dc1f to your computer and use it in GitHub Desktop.
Low Command Injection Source
This file contains 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[ 'Submit' ] ) ) { | |
// Get input | |
$target = $_REQUEST[ 'ip' ]; | |
// Determine OS and execute the ping command. | |
if( stristr( php_uname( 's' ), 'Windows NT' ) ) { | |
// Windows | |
$cmd = shell_exec( 'ping ' . $target ); | |
} | |
else { | |
// *nix | |
$cmd = shell_exec( 'ping -c 4 ' . $target ); | |
} | |
// Feedback for the end user | |
echo "<pre>{$cmd}</pre>"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment