MrPaan

jalil buat

Nov 16th, 2013
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. checkport_range("www.google.com", 1, 255);
  4.  
  5. function checkport($host, $port_array) {
  6.  
  7.   foreach ( $port_array as $port ) {
  8.     if(($port % 1) != 0 || $port > 65535) die ("Invalid port number");
  9.     $fp = @fsockopen($host, $port, $errno, $errstr, 2);
  10.     echo $host.':'.$i.' = ';
  11.     if ( !$fp ) {
  12.       echo "Port close\n";
  13.     } else {
  14.       echo "Port open\n";
  15.     }
  16.   }
  17.  
  18. }
  19.  
  20. function checkport_range($host, $start_range, $end_range) {
  21.  
  22.   for ( $i = $start_range; $i < $end_range; $i++ ) {
  23.     if(($i % 1) != 0 || $i > 65535) die ("Invalid port number");
  24.     $fp = @fsockopen($host, $i, $errno, $errstr, 2);
  25.     echo $host.':'.$i.' = ';
  26.     if ( !$fp ) {
  27.       echo "Port close\n";
  28.     } else {
  29.       echo "Port open\n";
  30.     }
  31.   }
  32.  
  33. }
  34.  
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment