//同时扫描1~1000个端口。要改成扫描特定端口也可以,声明个数组遍历就OK。
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace 端口测试
{
class Program
{
static void Main(string[] args)
{
Console.Write("请输入域名:");
string hostName = Console.ReadLine();
try
{
IPHostEntry hostinfo = Dns.GetHostEntry(hostName);
IPAddress[] address = hostinfo.AddressList;
for (int i = 0; i < address.Length; i++)
Console.WriteLine(address[i]);
}
catch
{
Console.WriteLine("未知的域名");
}
try
{
Thread thread;
PortScanner Scanner = new PortScanner(hostName);
Console.WriteLine("扫描中,请等待。。。");
for (int i = 0; i < 1000; i++)
{
thread = new Thread(new Threa
多线程端口扫描源码(C#)
最新推荐文章于 2025-07-06 09:07:24 发布