Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- set_time_limit(0);
- $host = 'stackoverflow.com';
- $ports =
- array(
- 1,
- 5,
- 7,
- 18,
- 20,
- 21,
- 22,
- 23,
- 25,
- 29,
- 37,
- 42,
- 43,
- 49,
- 53,
- 69,
- 70,
- 79,
- 80,
- 103,
- 108,
- 109,
- 110,
- 115,
- 118,
- 119,
- 137,
- 139,
- 143,
- 150,
- 156,
- 161,
- 179,
- 190,
- 194,
- 197,
- 389,
- 396,
- 443,
- 444,
- 445,
- 458,
- 546,
- 547,
- 563,
- 569,
- 1080
- );
- foreach ($ports as $port)
- {
- $fp=fsockopen($host, $port);
- if ($fp)
- {
- echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";
- fclose($fp);
- flush();@ob_flush();
- }
- else
- {
- echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n";
- fclose($fp);
- flush();@ob_flush();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement