From 800448e2b18759ec4fa88298f29d75d6ac06681e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Aug 2021 16:34:53 +0300 Subject: [PATCH 1/6] add clear results button --- .../BruteSharkDesktop/MainForm.Designer.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/BruteShark/BruteSharkDesktop/MainForm.Designer.cs b/BruteShark/BruteSharkDesktop/MainForm.Designer.cs index d1af7d9..257424d 100644 --- a/BruteShark/BruteSharkDesktop/MainForm.Designer.cs +++ b/BruteShark/BruteSharkDesktop/MainForm.Designer.cs @@ -70,6 +70,7 @@ private void InitializeComponent() this.modulesSplitContainer = new System.Windows.Forms.SplitContainer(); this.modulesTreeView = new System.Windows.Forms.TreeView(); this.progressBar = new BruteSharkDesktop.TextProgressBar(); + this.clearResutlsButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit(); this.mainSplitContainer.Panel1.SuspendLayout(); this.mainSplitContainer.Panel2.SuspendLayout(); @@ -99,6 +100,7 @@ private void InitializeComponent() // // mainSplitContainer.Panel1 // + this.mainSplitContainer.Panel1.Controls.Add(this.clearResutlsButton); this.mainSplitContainer.Panel1.Controls.Add(this.exportResutlsButton); this.mainSplitContainer.Panel1.Controls.Add(this.liveCaptureGroupBox); this.mainSplitContainer.Panel1.Controls.Add(this.optionsGroupBox); @@ -115,10 +117,10 @@ private void InitializeComponent() // // exportResutlsButton // - this.exportResutlsButton.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.exportResutlsButton.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.exportResutlsButton.Location = new System.Drawing.Point(924, 117); this.exportResutlsButton.Name = "exportResutlsButton"; - this.exportResutlsButton.Size = new System.Drawing.Size(168, 48); + this.exportResutlsButton.Size = new System.Drawing.Size(81, 48); this.exportResutlsButton.TabIndex = 3; this.exportResutlsButton.Text = "Export Results"; this.exportResutlsButton.UseVisualStyleBackColor = true; @@ -351,7 +353,7 @@ private void InitializeComponent() // this.secondaryLowerSplitContainer.Panel2.Controls.Add(this.progressBar); this.secondaryLowerSplitContainer.Size = new System.Drawing.Size(1463, 497); - this.secondaryLowerSplitContainer.SplitterDistance = 446; + this.secondaryLowerSplitContainer.SplitterDistance = 444; this.secondaryLowerSplitContainer.SplitterWidth = 5; this.secondaryLowerSplitContainer.TabIndex = 0; // @@ -366,7 +368,7 @@ private void InitializeComponent() // modulesSplitContainer.Panel1 // this.modulesSplitContainer.Panel1.Controls.Add(this.modulesTreeView); - this.modulesSplitContainer.Size = new System.Drawing.Size(1463, 446); + this.modulesSplitContainer.Size = new System.Drawing.Size(1463, 444); this.modulesSplitContainer.SplitterDistance = 228; this.modulesSplitContainer.SplitterWidth = 5; this.modulesSplitContainer.TabIndex = 0; @@ -403,7 +405,7 @@ private void InitializeComponent() treeNode3, treeNode7, treeNode10}); - this.modulesTreeView.Size = new System.Drawing.Size(228, 446); + this.modulesTreeView.Size = new System.Drawing.Size(228, 444); this.modulesTreeView.TabIndex = 0; this.modulesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ModulesTreeView_AfterSelect); // @@ -415,9 +417,19 @@ private void InitializeComponent() this.progressBar.Location = new System.Drawing.Point(0, 0); this.progressBar.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.progressBar.Name = "progressBar"; - this.progressBar.Size = new System.Drawing.Size(1463, 46); + this.progressBar.Size = new System.Drawing.Size(1463, 48); this.progressBar.TabIndex = 0; // + // clearResutlsButton + // + this.clearResutlsButton.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.clearResutlsButton.Location = new System.Drawing.Point(1011, 117); + this.clearResutlsButton.Name = "clearResutlsButton"; + this.clearResutlsButton.Size = new System.Drawing.Size(81, 48); + this.clearResutlsButton.TabIndex = 4; + this.clearResutlsButton.Text = "Clear Results"; + this.clearResutlsButton.UseVisualStyleBackColor = true; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -475,6 +487,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox promiscuousCheckBox; private System.Windows.Forms.TextBox filterTextBox; private System.Windows.Forms.Button exportResutlsButton; + private System.Windows.Forms.Button clearResutlsButton; } } From 79bb4ff64f9bf1e45252c10c109367016c238b30 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Aug 2021 16:43:31 +0300 Subject: [PATCH 2/6] clear all modules user controls and connections set --- .../BruteSharkDesktop/MainForm.Designer.cs | 31 ++++++++++--------- BruteShark/BruteSharkDesktop/MainForm.cs | 23 ++++++++++++++ 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/BruteShark/BruteSharkDesktop/MainForm.Designer.cs b/BruteShark/BruteSharkDesktop/MainForm.Designer.cs index 257424d..16b6d7e 100644 --- a/BruteShark/BruteSharkDesktop/MainForm.Designer.cs +++ b/BruteShark/BruteSharkDesktop/MainForm.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() treeNode8, treeNode9}); this.mainSplitContainer = new System.Windows.Forms.SplitContainer(); + this.clearResutlsButton = new System.Windows.Forms.Button(); this.exportResutlsButton = new System.Windows.Forms.Button(); this.liveCaptureGroupBox = new System.Windows.Forms.GroupBox(); this.filterTextBox = new System.Windows.Forms.TextBox(); @@ -70,7 +71,6 @@ private void InitializeComponent() this.modulesSplitContainer = new System.Windows.Forms.SplitContainer(); this.modulesTreeView = new System.Windows.Forms.TreeView(); this.progressBar = new BruteSharkDesktop.TextProgressBar(); - this.clearResutlsButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit(); this.mainSplitContainer.Panel1.SuspendLayout(); this.mainSplitContainer.Panel2.SuspendLayout(); @@ -115,6 +115,17 @@ private void InitializeComponent() this.mainSplitContainer.SplitterWidth = 1; this.mainSplitContainer.TabIndex = 0; // + // clearResutlsButton + // + this.clearResutlsButton.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.clearResutlsButton.Location = new System.Drawing.Point(1011, 117); + this.clearResutlsButton.Name = "clearResutlsButton"; + this.clearResutlsButton.Size = new System.Drawing.Size(81, 48); + this.clearResutlsButton.TabIndex = 4; + this.clearResutlsButton.Text = "Clear Results"; + this.clearResutlsButton.UseVisualStyleBackColor = true; + this.clearResutlsButton.Click += new System.EventHandler(this.clearResutlsButton_Click); + // // exportResutlsButton // this.exportResutlsButton.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); @@ -353,7 +364,7 @@ private void InitializeComponent() // this.secondaryLowerSplitContainer.Panel2.Controls.Add(this.progressBar); this.secondaryLowerSplitContainer.Size = new System.Drawing.Size(1463, 497); - this.secondaryLowerSplitContainer.SplitterDistance = 444; + this.secondaryLowerSplitContainer.SplitterDistance = 443; this.secondaryLowerSplitContainer.SplitterWidth = 5; this.secondaryLowerSplitContainer.TabIndex = 0; // @@ -368,7 +379,7 @@ private void InitializeComponent() // modulesSplitContainer.Panel1 // this.modulesSplitContainer.Panel1.Controls.Add(this.modulesTreeView); - this.modulesSplitContainer.Size = new System.Drawing.Size(1463, 444); + this.modulesSplitContainer.Size = new System.Drawing.Size(1463, 443); this.modulesSplitContainer.SplitterDistance = 228; this.modulesSplitContainer.SplitterWidth = 5; this.modulesSplitContainer.TabIndex = 0; @@ -405,7 +416,7 @@ private void InitializeComponent() treeNode3, treeNode7, treeNode10}); - this.modulesTreeView.Size = new System.Drawing.Size(228, 444); + this.modulesTreeView.Size = new System.Drawing.Size(228, 443); this.modulesTreeView.TabIndex = 0; this.modulesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ModulesTreeView_AfterSelect); // @@ -417,19 +428,9 @@ private void InitializeComponent() this.progressBar.Location = new System.Drawing.Point(0, 0); this.progressBar.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.progressBar.Name = "progressBar"; - this.progressBar.Size = new System.Drawing.Size(1463, 48); + this.progressBar.Size = new System.Drawing.Size(1463, 49); this.progressBar.TabIndex = 0; // - // clearResutlsButton - // - this.clearResutlsButton.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.clearResutlsButton.Location = new System.Drawing.Point(1011, 117); - this.clearResutlsButton.Name = "clearResutlsButton"; - this.clearResutlsButton.Size = new System.Drawing.Size(81, 48); - this.clearResutlsButton.TabIndex = 4; - this.clearResutlsButton.Text = "Clear Results"; - this.clearResutlsButton.UseVisualStyleBackColor = true; - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); diff --git a/BruteShark/BruteSharkDesktop/MainForm.cs b/BruteShark/BruteSharkDesktop/MainForm.cs index d80ed21..5ab3f46 100644 --- a/BruteShark/BruteSharkDesktop/MainForm.cs +++ b/BruteShark/BruteSharkDesktop/MainForm.cs @@ -489,6 +489,29 @@ private void exportResutlsButton_Click(object sender, EventArgs e) } } + private void clearResutlsButton_Click(object sender, EventArgs e) + { + _connections = new HashSet(); + + // Clear all modules user controls. + _networkMapUserControl = new NetworkMapUserControl(); + _networkMapUserControl.Dock = DockStyle.Fill; + _sessionsExplorerUserControl = new SessionsExplorerUserControl(); + _sessionsExplorerUserControl.Dock = DockStyle.Fill; + _hashesUserControl = new HashesUserControl(); + _hashesUserControl.Dock = DockStyle.Fill; + _passwordsUserControl = new GenericTableUserControl(); + _passwordsUserControl.Dock = DockStyle.Fill; + _filesUserControl = new FilesUserControl(); + _filesUserControl.Dock = DockStyle.Fill; + _dnsResponseUserControl = new DnsResponseUserControl(); + _dnsResponseUserControl.Dock = DockStyle.Fill; + _voipCallsUserControl = new VoipCallsUserControl(); + _voipCallsUserControl.Dock = DockStyle.Fill; + + this.modulesTreeView.ResetText(); + } + } } \ No newline at end of file From bf895da85072fb496806334acc7661462d5af36d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Aug 2021 17:11:46 +0300 Subject: [PATCH 3/6] clear tree view items count --- BruteShark/BruteSharkDesktop/MainForm.cs | 75 ++++++++++++++---------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/BruteShark/BruteSharkDesktop/MainForm.cs b/BruteShark/BruteSharkDesktop/MainForm.cs index 5ab3f46..d206919 100644 --- a/BruteShark/BruteSharkDesktop/MainForm.cs +++ b/BruteShark/BruteSharkDesktop/MainForm.cs @@ -47,22 +47,6 @@ public MainForm() _processor.BuildTcpSessions = true; _processor.BuildUdpSessions = true; - // Create the user controls. - _networkMapUserControl = new NetworkMapUserControl(); - _networkMapUserControl.Dock = DockStyle.Fill; - _sessionsExplorerUserControl = new SessionsExplorerUserControl(); - _sessionsExplorerUserControl.Dock = DockStyle.Fill; - _hashesUserControl = new HashesUserControl(); - _hashesUserControl.Dock = DockStyle.Fill; - _passwordsUserControl = new GenericTableUserControl(); - _passwordsUserControl.Dock = DockStyle.Fill; - _filesUserControl = new FilesUserControl(); - _filesUserControl.Dock = DockStyle.Fill; - _dnsResponseUserControl = new DnsResponseUserControl(); - _dnsResponseUserControl.Dock = DockStyle.Fill; - _voipCallsUserControl = new VoipCallsUserControl(); - _voipCallsUserControl.Dock = DockStyle.Fill; - // Contract the events. _sniffer.UdpPacketArived += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorUdpPacketToAnalyzerUdpPacket(e.Packet)); _sniffer.TcpPacketArived += (s, e) => _analyzer.Analyze(CommonUi.Casting.CastProcessorTcpPacketToAnalyzerTcpPacket(e.Packet)); @@ -80,12 +64,31 @@ public MainForm() _analyzer.ParsedItemDetected += (s, e) => SwitchToMainThreadContext(() => OnParsedItemDetected(s, e)); _analyzer.UpdatedItemProprertyDetected += (s, e) => SwitchToMainThreadContext(() => OnUpdatedItemProprertyDetected(s, e)); + InitilizeModulesUserControls(); InitilizeFilesIconsList(); InitilizeModulesCheckedListBox(); InitilizeInterfacesComboBox(); this.modulesTreeView.ExpandAll(); } + private void InitilizeModulesUserControls() + { + _networkMapUserControl = new NetworkMapUserControl(); + _networkMapUserControl.Dock = DockStyle.Fill; + _sessionsExplorerUserControl = new SessionsExplorerUserControl(); + _sessionsExplorerUserControl.Dock = DockStyle.Fill; + _hashesUserControl = new HashesUserControl(); + _hashesUserControl.Dock = DockStyle.Fill; + _passwordsUserControl = new GenericTableUserControl(); + _passwordsUserControl.Dock = DockStyle.Fill; + _filesUserControl = new FilesUserControl(); + _filesUserControl.Dock = DockStyle.Fill; + _dnsResponseUserControl = new DnsResponseUserControl(); + _dnsResponseUserControl.Dock = DockStyle.Fill; + _voipCallsUserControl = new VoipCallsUserControl(); + _voipCallsUserControl.Dock = DockStyle.Fill; + } + private void InitilizeInterfacesComboBox() { foreach (string interfaceName in _sniffer.AvailiableDevicesNames) @@ -493,23 +496,31 @@ private void clearResutlsButton_Click(object sender, EventArgs e) { _connections = new HashSet(); - // Clear all modules user controls. - _networkMapUserControl = new NetworkMapUserControl(); - _networkMapUserControl.Dock = DockStyle.Fill; - _sessionsExplorerUserControl = new SessionsExplorerUserControl(); - _sessionsExplorerUserControl.Dock = DockStyle.Fill; - _hashesUserControl = new HashesUserControl(); - _hashesUserControl.Dock = DockStyle.Fill; - _passwordsUserControl = new GenericTableUserControl(); - _passwordsUserControl.Dock = DockStyle.Fill; - _filesUserControl = new FilesUserControl(); - _filesUserControl.Dock = DockStyle.Fill; - _dnsResponseUserControl = new DnsResponseUserControl(); - _dnsResponseUserControl.Dock = DockStyle.Fill; - _voipCallsUserControl = new VoipCallsUserControl(); - _voipCallsUserControl.Dock = DockStyle.Fill; + // Clear all modules user controls by recreating them. + InitilizeModulesUserControls(); + + // Remove the items count of each module from the tree view (e.g "DNS (13)" -> "DNS"). + foreach (var node in IterateAllNodes(modulesTreeView.Nodes)) + { + var index = node.Text.LastIndexOf('('); + + if (index > 0) + { + node.Text = node.Text.Substring(0, index); + } + } + } - this.modulesTreeView.ResetText(); + IEnumerable IterateAllNodes(TreeNodeCollection nodes) + { + // Recursively iterate over all nodes and sub nodes. + foreach (TreeNode node in nodes) + { + yield return node; + + foreach (var child in IterateAllNodes(node.Nodes)) + yield return child; + } } } From 387d55e9d112ded009774d0074ecf654f5c9998a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Aug 2021 17:36:02 +0300 Subject: [PATCH 4/6] clear analyzer state --- BruteShark/BruteSharkDesktop/MainForm.cs | 8 ++++++++ BruteShark/PcapAnalyzer/Analyzer.cs | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/BruteShark/BruteSharkDesktop/MainForm.cs b/BruteShark/BruteSharkDesktop/MainForm.cs index d206919..47115af 100644 --- a/BruteShark/BruteSharkDesktop/MainForm.cs +++ b/BruteShark/BruteSharkDesktop/MainForm.cs @@ -287,6 +287,13 @@ private void AddFile(string filePath) private void RunButton_Click(object sender, EventArgs e) { + // Reset all files status. + foreach (ListViewItem item in this.filesListView.Items) + { + item.ForeColor = Color.Black; + item.SubItems[2].Text = "Wait"; + } + new Thread(() => _processor.ProcessPcaps(this._files)).Start(); } @@ -495,6 +502,7 @@ private void exportResutlsButton_Click(object sender, EventArgs e) private void clearResutlsButton_Click(object sender, EventArgs e) { _connections = new HashSet(); + _analyzer.Clear(); // Clear all modules user controls by recreating them. InitilizeModulesUserControls(); diff --git a/BruteShark/PcapAnalyzer/Analyzer.cs b/BruteShark/PcapAnalyzer/Analyzer.cs index bb9c01a..4193042 100644 --- a/BruteShark/PcapAnalyzer/Analyzer.cs +++ b/BruteShark/PcapAnalyzer/Analyzer.cs @@ -19,6 +19,7 @@ public class Analyzer public Analyzer() { + _loadedModules = new List(); InitilyzeModulesList(); } @@ -42,8 +43,6 @@ public void AddModule(string module_name) private void InitilyzeModulesList() { - _loadedModules = new List(); - // Create an instance for any available modules by looking for every class that // implements IModule. this._availbleModules = AppDomain.CurrentDomain.GetAssemblies() @@ -87,6 +86,8 @@ public void Analyze(object item) } } } - + + public void Clear() => InitilyzeModulesList(); + } } From ea4badde1f0ae6e68453cef5400b4fb07b648684 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 Aug 2021 21:23:09 +0300 Subject: [PATCH 5/6] clear analyzer state - WIP --- BruteShark/PcapAnalyzer/Analyzer.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/BruteShark/PcapAnalyzer/Analyzer.cs b/BruteShark/PcapAnalyzer/Analyzer.cs index 4193042..a954c06 100644 --- a/BruteShark/PcapAnalyzer/Analyzer.cs +++ b/BruteShark/PcapAnalyzer/Analyzer.cs @@ -87,7 +87,18 @@ public void Analyze(object item) } } - public void Clear() => InitilyzeModulesList(); + public void Clear() + { + // Recreate modules instances. + InitilyzeModulesList(); + + // Replace the current loaded modules with the new clean modules. + foreach (var moduleName in this.LoadedModulesNames) + { + this.RemoveModule(moduleName); + this.AddModule(moduleName); + } + } } } From 4f9e5e235464c1b8b0ac073dfa2e9ff65573b61a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 15 Aug 2021 23:58:41 +0300 Subject: [PATCH 6/6] upgrade to SharpPcap 6.0 and refactor correspondingly to api changes --- .../BruteSharkDesktopInstaller/Product.wxs | 2 +- BruteShark/PcapProcessor/PcapProcessor.csproj | 4 ++-- BruteShark/PcapProcessor/Processor.cs | 4 ++-- BruteShark/PcapProcessor/Sniffer.cs | 23 ++++--------------- .../PcapProcessorTest.csproj | 2 +- 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/BruteShark/BruteSharkDesktopInstaller/Product.wxs b/BruteShark/BruteSharkDesktopInstaller/Product.wxs index f8fd1c5..b3ab1f9 100644 --- a/BruteShark/BruteSharkDesktopInstaller/Product.wxs +++ b/BruteShark/BruteSharkDesktopInstaller/Product.wxs @@ -4,7 +4,7 @@ diff --git a/BruteShark/PcapProcessor/PcapProcessor.csproj b/BruteShark/PcapProcessor/PcapProcessor.csproj index 1529d39..beaf106 100644 --- a/BruteShark/PcapProcessor/PcapProcessor.csproj +++ b/BruteShark/PcapProcessor/PcapProcessor.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/BruteShark/PcapProcessor/Processor.cs b/BruteShark/PcapProcessor/Processor.cs index 07bc521..6d28bd9 100644 --- a/BruteShark/PcapProcessor/Processor.cs +++ b/BruteShark/PcapProcessor/Processor.cs @@ -196,9 +196,9 @@ private void ProccessPcapNgPacket(PacketDotNet.Packet packet) ProcessPacket(packet); } - private void ProcessPcapPacket(object sender, CaptureEventArgs e) + private void ProcessPcapPacket(object sender, PacketCapture e) { - var packet = PacketDotNet.Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data); + var packet = PacketDotNet.Packet.ParsePacket(e.GetPacket().LinkLayerType, e.GetPacket().Data); ProcessPacket(packet); } diff --git a/BruteShark/PcapProcessor/Sniffer.cs b/BruteShark/PcapProcessor/Sniffer.cs index fa4d097..c545590 100644 --- a/BruteShark/PcapProcessor/Sniffer.cs +++ b/BruteShark/PcapProcessor/Sniffer.cs @@ -1,7 +1,6 @@ using PcapProcessor.Objects; using SharpPcap; using SharpPcap.LibPcap; -using SharpPcap.Npcap; using System; using System.Collections.Generic; using System.Linq; @@ -62,24 +61,10 @@ public void StartSniffing(CancellationToken ct) ClearOldSniffingsData(); ICaptureDevice selectedDevice = GetSelectedDevice(); - if (selectedDevice is NpcapDevice) - { - var nPcap = selectedDevice as SharpPcap.Npcap.NpcapDevice; - if (PromisciousMode) - { - nPcap.Open(SharpPcap.Npcap.OpenFlags.Promiscuous, ReadTimeoutMilliseconds); - } - else - { - nPcap.Open(); - } - - nPcap.Mode = CaptureMode.Packets; - } - else if (selectedDevice is SharpPcap.LibPcap.LibPcapLiveDevice) + if (selectedDevice is SharpPcap.LibPcap.LibPcapLiveDevice) { var livePcapDevice = selectedDevice as SharpPcap.LibPcap.LibPcapLiveDevice; - livePcapDevice.Open(PromisciousMode ? DeviceMode.Promiscuous : DeviceMode.Normal); + livePcapDevice.Open(PromisciousMode ? SharpPcap.DeviceModes.Promiscuous : SharpPcap.DeviceModes.None); } else { @@ -261,9 +246,9 @@ public static bool CheckCaptureFilter(string filter) return PcapDevice.CheckFilter(filter, out string outString); } - private void InsertPacketToQueue(object sender, CaptureEventArgs e) + private void InsertPacketToQueue(object sender, PacketCapture e) { - var packet = PacketDotNet.Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data); + var packet = PacketDotNet.Packet.ParsePacket(e.GetPacket().LinkLayerType, e.GetPacket().Data); lock (_packetsQueueLock) { diff --git a/BruteShark/PcapProcessorTest/PcapProcessorTest.csproj b/BruteShark/PcapProcessorTest/PcapProcessorTest.csproj index 0c8d19f..ac4ade4 100644 --- a/BruteShark/PcapProcessorTest/PcapProcessorTest.csproj +++ b/BruteShark/PcapProcessorTest/PcapProcessorTest.csproj @@ -14,7 +14,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - +