Guest User

Untitled

a guest
Mar 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. ini_set('max_execution_time', 0);
  3. ini_set('memory_limit', -1);
  4.  
  5. $host = 'google.com';
  6. $ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);
  7.  
  8. foreach ($ports as $port)
  9. {
  10. $connection = @fsockopen($host, $port, $errno, $errstr, 2);
  11.  
  12. if (is_resource($connection))
  13. {
  14. echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";
  15.  
  16. fclose($connection);
  17. }
  18. else
  19. {
  20. echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n";
  21. }
  22. }
Add Comment
Please, Sign In to add comment