Advertisement
Guest User

xxxx

a guest
Sep 20th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. <?php
  3.  
  4. if( isset( $_POST[ 'submit'] ) ) {
  5.  
  6. $target = $_REQUEST[ 'ip' ];
  7.  
  8. // Remove any of the charactars in the array (blacklist).
  9. $substitutions = array(
  10. '&&' => '',
  11. ';' => '',
  12. );
  13.  
  14. $target = str_replace( array_keys( $substitutions ), $substitutions, $target );
  15.  
  16. // Determine OS and execute the ping command.
  17. if (stristr(php_uname('s'), 'Windows NT')) {
  18.  
  19. $cmd = shell_exec( 'ping ' . $target );
  20. echo '<pre>'.$cmd.'</pre>';
  21.  
  22. } else {
  23.  
  24. $cmd = shell_exec( 'ping -c 3 ' . $target );
  25. echo '<pre>'.$cmd.'</pre>';
  26.  
  27. }
  28. }
  29.  
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement