資源簡介
(1) 捕獲網絡中的IP數據包,解析數據包的內容,并將結果顯示出來。
(2) 顯示內容包括:捕獲的IP包的版本、源地址、目的地址、源端口、目的端口、協議類型、IP包總長度、IP包頭總長度、IP數據包長度等內容。
(3) 設置停止標志,當程序接受到停止命令時即停止。

代碼片段和文件信息
using?System;
using?System.Drawing;
using?System.Collections;
using?System.ComponentModel;
using?System.Windows.Forms;
using?System.Net;
using?System.Net.Sockets;
using?System.Management;
using?System.Threading;
using?System.IO;
namespace?SimpleSniff
{
public?class?SniffWindow?:?System.Windows.Forms.Form
{
private?System.Windows.Forms.ListBox?resultListBox;
private?System.Windows.Forms.Button?startButton;
private?System.Windows.Forms.Button?stopButton;
private?System.Windows.Forms.ComboBox?addressComboBox;
private?System.ComponentModel.Container?components?=?null;
private?System.Windows.Forms.Button?clearButton;
????????private?Label?label1;
????????private?Label?label2;
????????private?Label?label3;
????????private?Label?label4;
????????private?Button?saveButton;
????????private?Label?label5;
????????private?SniffSocket?mySniffSocket;
public?SniffWindow()
{
InitializeComponent();
}
????????protected?override?void?Dispose(bool?disposing)?//為?true?則釋放托管資源和非托管資源;為?false?則僅釋放非托管資源。
{
if(?disposing?)
{
if?(components?!=?null)?
{
components.Dispose();
}
}
base.Dispose(?disposing?);
}
#region?Windows?Form?Designer?generated?code
///?
///?Required?method?for?Designer?support?-?do?not?modify
///?the?contents?of?this?method?with?the?code?editor.
///?
private?void?InitializeComponent()
{
????????????this.resultListBox?=?new?System.Windows.Forms.ListBox();
????????????this.startButton?=?new?System.Windows.Forms.Button();
????????????this.stopButton?=?new?System.Windows.Forms.Button();
????????????this.addressComboBox?=?new?System.Windows.Forms.ComboBox();
????????????this.clearButton?=?new?System.Windows.Forms.Button();
????????????this.label1?=?new?System.Windows.Forms.Label();
????????????this.label2?=?new?System.Windows.Forms.Label();
????????????this.label3?=?new?System.Windows.Forms.Label();
????????????this.label4?=?new?System.Windows.Forms.Label();
????????????this.saveButton?=?new?System.Windows.Forms.Button();
????????????this.label5?=?new?System.Windows.Forms.Label();
????????????this.SuspendLayout();
????????????//?
????????????//?resultListBox
????????????//?
????????????this.resultListBox.ItemHeight?=?12;
????????????this.resultListBox.Location?=?new?System.Drawing.Point(4?35);
????????????this.resultListBox.Name?=?“resultListBox“;
????????????this.resultListBox.Size?=?new?System.Drawing.Size(552?280);
????????????this.resultListBox.TabIndex?=?0;
????????????this.resultListBox.DoubleClick?+=?new?System.EventHandler(this.resultListBox_DoubleClick);
????????????//?
????????????//?startButton
????????????//?
????????????this.startButton.Location?=?new?System.Drawing.Point(12?331);
????????????this.startButton.Name?=?“startButton“;
????????????this.startButton.Size?=?new?System.Drawing.Size(75?23);
????????????this.startButton.TabIndex?=?1;
????????????this.startButton.Te
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????47616??2018-01-05?10:19??SniffScoket\.vs\SIMPLESNIFF\v14\.suo
?????文件????????369??2009-06-13?20:48??SniffScoket\APP.CS
?????文件???????1078??2002-06-29?12:23??SniffScoket\APP.ICO
?????文件???????2426??2002-06-29?12:23??SniffScoket\ASSEMBLYINFO.CS
?????文件??????32768??2018-01-04?17:26??SniffScoket\BIN\DEBUG\SimpleSniff.exe
?????文件??????42496??2018-01-04?17:26??SniffScoket\BIN\DEBUG\SimpleSniff.pdb
?????文件??????21680??2018-01-05?09:38??SniffScoket\BIN\DEBUG\SimpleSniff.vshost.exe
?????文件????????490??2016-07-16?19:44??SniffScoket\BIN\DEBUG\SimpleSniff.vshost.exe.manifest
?????文件??????28672??2009-06-13?21:13??SniffScoket\BIN\RELEASE\SimpleSniff.exe
?????文件???????5632??2005-12-08?14:51??SniffScoket\BIN\RELEASE\SimpleSniff.vshost.exe
?????文件???????2238??2009-06-13?20:08??SniffScoket\ClassDiagram1.cd
?????文件??????11850??2018-01-04?17:04??SniffScoket\MainForm.cs
?????文件???????5814??2018-01-04?17:04??SniffScoket\MainForm.resx
?????文件???????1230??2018-01-01?22:33??SniffScoket\OBJ\DEBUG\DesignTimeResolveAssemblyReferences.cache
?????文件???????6184??2018-01-05?09:38??SniffScoket\OBJ\DEBUG\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????847??2018-01-05?09:38??SniffScoket\OBJ\DEBUG\SimpleSniff.csproj.FileListAbsolute.txt
?????文件????????843??2018-01-04?17:22??SniffScoket\OBJ\DEBUG\SimpleSniff.csproj.GenerateResource.Cache
?????文件???????1340??2018-01-01?21:06??SniffScoket\OBJ\DEBUG\SimpleSniff.csprojResolveAssemblyReference.cache
?????文件??????32768??2018-01-04?17:26??SniffScoket\OBJ\DEBUG\SimpleSniff.exe
?????文件????????180??2018-01-04?17:22??SniffScoket\OBJ\DEBUG\SimpleSniff.PacketDisplay.resources
?????文件??????42496??2018-01-04?17:26??SniffScoket\OBJ\DEBUG\SimpleSniff.pdb
?????文件????????180??2018-01-04?17:14??SniffScoket\OBJ\DEBUG\SimpleSniff.SniffWindow.resources
?????文件????????838??2009-06-13?21:13??SniffScoket\OBJ\RELEASE\SimpleSniff.csproj.GenerateResource.Cache
?????文件??????28672??2009-06-13?21:13??SniffScoket\OBJ\RELEASE\SimpleSniff.exe
?????文件????????180??2009-06-13?21:13??SniffScoket\OBJ\RELEASE\SimpleSniff.PacketDisplay.resources
?????文件????????180??2009-06-13?21:13??SniffScoket\OBJ\RELEASE\SimpleSniff.SniffWindow.resources
?????文件???????1227??2009-07-08?15:31??SniffScoket\OBJ\SimpleSniff.csproj.FileListAbsolute.txt
?????文件??????15170??2018-01-04?17:26??SniffScoket\PacketDisplay.cs
?????文件???????5814??2018-01-04?17:22??SniffScoket\PacketDisplay.resx
?????文件???????5584??2018-01-01?21:01??SniffScoket\SIMPLESNIFF.CSPROJ
............此處省略27個文件信息
評論
共有 條評論