first commit
This commit is contained in:
parent
985a5c928c
commit
f40a84879c
551 changed files with 72374 additions and 24 deletions
41
dvwa/vulnerabilities/exec/source/impossible.php
Normal file
41
dvwa/vulnerabilities/exec/source/impossible.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
if( isset( $_POST[ 'Submit' ] ) ) {
|
||||
// Check Anti-CSRF token
|
||||
checkToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );
|
||||
|
||||
// Get input
|
||||
$target = $_REQUEST[ 'ip' ];
|
||||
$target = stripslashes( $target );
|
||||
|
||||
// Split the IP into 4 octects
|
||||
$octet = explode( ".", $target );
|
||||
|
||||
// Check IF each octet is an integer
|
||||
if( ( is_numeric( $octet[0] ) ) && ( is_numeric( $octet[1] ) ) && ( is_numeric( $octet[2] ) ) && ( is_numeric( $octet[3] ) ) && ( sizeof( $octet ) == 4 ) ) {
|
||||
// If all 4 octets are int's put the IP back together.
|
||||
$target = $octet[0] . '.' . $octet[1] . '.' . $octet[2] . '.' . $octet[3];
|
||||
|
||||
// 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
|
||||
$html .= "<pre>{$cmd}</pre>";
|
||||
}
|
||||
else {
|
||||
// Ops. Let the user name theres a mistake
|
||||
$html .= '<pre>ERROR: You have entered an invalid IP.</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
// Generate Anti-CSRF token
|
||||
generateSessionToken();
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue