91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 32KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-29
  • 語言: C#
  • 標(biāo)簽: C#??IP??端口掃描??

資源簡介

C# 實(shí)現(xiàn)的IP地址段端口掃描器,http://www.cnblogs.com/wk986/archive/2013/03/14/2960529.html

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.Threading;
using?System.Net;
using?System.Net.Sockets;

namespace?ScanDemo
{
????public?partial?class?Form1?:?Form
????{
????????#region?聲明變量
????????//已掃描端口數(shù)目
????????double?scannedCount?=?0;
????????//正在運(yùn)行的線程數(shù)目
????????int?runningThreadCount?=?0;
??????
???????
????????//最大工作線程數(shù)
????????static?int?maxThread?=?100;

????????//IP地址
????????string?host?=?null;
????????//端口
????????int?port?=?1234;


????????int?startIP=1;
????????int?endIP=255;
????????string?addresIP?=?“192.168.1.“;
????????#endregion

????????#region?窗體方法
?????????public?Form1()
????????{
????????????InitializeComponent();
????????}???????

????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????this.Text?=?string.Format(“wk986?掃描IP段指定端口?{0}-{1}:{2}“
????????????????addresIP+startIPendIPport);
????????}

#endregion

????????#region?掃描方法

????????public?void?Scan(string?m_host?int?m_port)
????????{
????????????//我們直接使用比較高級的TcpClient類
????????????TcpClient?tc?=?new?TcpClient();
????????????//設(shè)置超時時間
????????????tc.SendTimeout?=?tc.ReceiveTimeout?=?2000;

????????????try
????????????{
????????????????//同步方法

????????????????//IPAddress?ip?=?IPAddress.Parse(host);
????????????????//IPEndPoint?IPendp?=?new?IPEndPoint(ip?port);
????????????????//tc.Connect(IPendp);

????????????????//異步方法
????????????????IAsyncResult?oAsyncResult?=?tc.BeginConnect(m_host?m_port?null?null);
????????????????oAsyncResult.AsyncWaitHandle.WaitOne(1000?true);//1000為超時時間?

????????????????if?(tc.Connected)
????????????????{
????????????????????//如果連接上,證明此端口為開放狀態(tài)
????????????????????UpdateListBox(listBox1?m_host?+?“:“?+?m_port.ToString());
????????????????}
????????????}
????????????catch?(System.Net.Sockets.SocketException?e)
????????????{
????????????????//容錯處理
????????????????//MessageBox.Show(“Port?{0}?is?closed“?host.ToString());
????????????????//Console.WriteLine(e.Message);
????????????}
????????????finally
????????????{??????????????
????????????????tc.Close();
????????????????tc?=?null;????????????????
????????????????scannedCount++;
????????????????runningThreadCount--;

????????????}
????????}
????????#endregion

????????#region?按鈕
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?(!backgroundWorker1.IsBusy)
????????????{
????????????????listBox1.Items.Clear();
????????????????scannedCount?=?0;???????????????
????????????????runningThreadCount?=?0;
????????????????backgroundWorker1.RunWorkerAsync();
????????????}
????????}

????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????backgroundWorker1.CancelAsync();
????????}


????????private?void?button3_Click(object?sender?EventArgs?e)
??????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????7726??2013-03-14?22:34??IP端口掃描\ScanDemo\Form1.cs

?????文件???????5797??2013-03-14?21:41??IP端口掃描\ScanDemo\Form1.Designer.cs

?????文件???????6022??2013-03-14?21:41??IP端口掃描\ScanDemo\Form1.resx

?????文件???????3541??2013-03-14?22:13??IP端口掃描\ScanDemo\Form2.cs

?????文件???????7161??2013-03-14?22:05??IP端口掃描\ScanDemo\Form2.Designer.cs

?????文件???????5817??2013-03-14?22:05??IP端口掃描\ScanDemo\Form2.resx

?????文件????????489??2013-03-13?10:27??IP端口掃描\ScanDemo\Program.cs

?????文件???????1348??2013-03-12?16:55??IP端口掃描\ScanDemo\Properties\AssemblyInfo.cs

?????文件???????2868??2013-03-12?16:55??IP端口掃描\ScanDemo\Properties\Resources.Designer.cs

?????文件???????5612??2013-03-12?16:55??IP端口掃描\ScanDemo\Properties\Resources.resx

?????文件???????1095??2013-03-12?16:55??IP端口掃描\ScanDemo\Properties\Settings.Designer.cs

?????文件????????249??2013-03-12?16:55??IP端口掃描\ScanDemo\Properties\Settings.settings

?????文件???????4025??2013-03-14?21:16??IP端口掃描\ScanDemo\ScanDemo.csproj

?????文件????????858??2013-03-14?21:48??IP端口掃描\ScanDemo\SearchEventArgs.cs

?????文件???????1546??2013-03-13?22:03??IP端口掃描\ScanIP.sln

????..A..H.?????50176??2013-03-14?22:49??IP端口掃描\ScanIP.suo

????..A..H.?????29696??2013-03-13?22:01??IP端口掃描\ScanIP.v11.suo

?????目錄??????????0??2013-03-13?22:00??IP端口掃描\ScanDemo\Properties

?????目錄??????????0??2013-03-14?22:49??IP端口掃描\ScanDemo

?????目錄??????????0??2013-03-13?22:01??IP端口掃描

-----------?---------??----------?-----??----

???????????????134026????????????????????20


評論

共有 條評論