Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('max_execution_time', 0);
- ini_set('memory_limit', -1);
- $host = $_GET['host'];
- $ports = array();
- for ($i = 1; $i < 256 * 256; $i++)
- {
- $ports[] = $i;
- }
- echo "<ul>";
- foreach ($ports as $port)
- {
- $connection = @fsockopen($host, $port, $errno, $errstr, 2);
- if (is_resource($connection))
- {
- echo '<li style="color:green">' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</li>' . "\n";
- fclose($connection);
- }
- else
- {
- echo '<li>' . $host . ':' . $port . ' is not responding.</li>' . "\n";
- }
- }
- echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement