找回密碼
 註冊
搜索
查看: 1132|回復: 0

[教學] port_scanner.php

[複製鏈接]
發表於 2022-4-4 23:15:05 | 顯示全部樓層 |閱讀模式
 
Push to Facebook
  1. <?php
  2. ini_set('max_execution_time', 0);
  3. ini_set('memory_limit', -1);

  4. $host = 'google.com';
  5. $ports = array(21, 25, 80, 81, 110, 143, 443, 587, 2525, 3306);

  6. foreach ($ports as $port){
  7.     $connection = @fsockopen($host, $port, $errno, $errstr, 2);
  8.     if (is_resource($connection)){
  9.         echo '<h2>' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.</h2>' . "\n";
  10.         fclose($connection);
  11.     } else{
  12.         echo '<h2>' . $host . ':' . $port . ' is not responding.</h2>' . "\n";
  13.     }
  14. }
複製代碼

文章出處
https://gist.github.com/akalongman/b50bc11a9303adb6f2db
 
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|小黑屋|TShopping

GMT+8, 2025-6-16 03:26 , Processed in 0.023858 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回復 返回頂部 返回列表