-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhigh.php
More file actions
37 lines (31 loc) · 771 Bytes
/
high.php
File metadata and controls
37 lines (31 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
if( isset( $_POST[ 'Submit' ] ) ) {
// Get input
$target = trim($_REQUEST[ 'ip' ]);
// Set blacklist
$substitutions = array(
'&' => '',
';' => '',
'| ' => '',
'-' => '',
'$' => '',
'(' => '',
')' => '',
'`' => '',
'||' => '',
);
// Remove any of the characters in the array (blacklist).
$target = str_replace( array_keys( $substitutions ), $substitutions, $target );
// Determine OS and execute the ping command.
if( stristr( php_uname( 's' ), 'Windows NT' ) ) {
// Windows
$cmd = shell_exec( 'ping ' . escapeshellarg($target) );
}
else {
// *nix
$cmd = shell_exec( 'ping -c 4 ' . escapeshellarg($target) );
}
// Feedback for the end user
$html .= "<pre>{$cmd}</pre>";
}
?>