Skip to content

Commit 30d4624

Browse files
committed
Code cleanup and small fixes
1 parent 57f865b commit 30d4624

16 files changed

Lines changed: 205 additions & 203 deletions

NetStalker/NetStalker/AcceptedPacket.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public string Host
254254
return HTTPData[0];
255255
}
256256
}
257-
catch (Exception e)
257+
catch (Exception)
258258
{
259259

260260
}

NetStalker/NetStalker/Controller.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public void DisconnectSelectedClients()//Not used
8080
if (_view.ListView1.SelectedObjects.Count > 0)
8181
{
8282
Dictionary<IPAddress, PhysicalAddress> targetlist = new Dictionary<IPAddress, PhysicalAddress>();
83-
int parseindex = 0;
8483
foreach (Device listitem in _view.ListView1.SelectedObjects)
8584
{
8685

@@ -106,12 +105,12 @@ public void DisconnectSelectedClients()//Not used
106105
}));
107106
}
108107
}
109-
catch (GatewayTargeted e)
108+
catch (GatewayTargeted)
110109
{
111110
MetroMessageBox.Show(_view.MainForm, "This operation can not target the gateway!", "Warning",
112111
MessageBoxButtons.OK, MessageBoxIcon.Warning);
113112
}
114-
catch (LocalHostTargeted e)
113+
catch (LocalHostTargeted)
115114
{
116115
MetroMessageBox.Show(_view.MainForm, "This operation can not target your own ip address!", "Warning",
117116
MessageBoxButtons.OK, MessageBoxIcon.Warning);
@@ -177,7 +176,7 @@ public void AttachOnExitEventHandler()
177176

178177

179178
}
180-
catch (Exception exception)
179+
catch (Exception)
181180
{
182181

183182
}

NetStalker/NetStalker/Device.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void BlockOrRedirect()
123123
}
124124

125125
}
126-
catch (PcapException ex)
126+
catch (PcapException)
127127
{
128128
}
129129

NetStalker/NetStalker/DisconnectReconnect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static void Disconnect(ListView view, Dictionary<IPAddress, PhysicalAddre
4747
}
4848

4949
}
50-
catch (PcapException ex)
50+
catch (PcapException)
5151
{
5252
}
5353
}).Start();

NetStalker/NetStalker/GetClientList.cs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static void GetAllClients(IView view, string interfacefriendlyname)
5050
StopTheLoadingBar(view);
5151

5252
}
53-
catch (PcapException ex)
53+
catch (PcapException)
5454
{
5555
}
5656
}
@@ -161,7 +161,7 @@ public static void GetAllClients(IView view, string interfacefriendlyname)
161161

162162

163163
}
164-
catch (Exception ex)
164+
catch (Exception)
165165
{
166166

167167
}
@@ -189,7 +189,6 @@ public static void GetAllClients(IView view, string interfacefriendlyname)
189189
view.ListView1.Invoke(new Action(() =>
190190
{
191191
string mac = GetMACString(arppacket.SenderHardwareAddress);
192-
string machineName = "";
193192
int id = clientlist.Count - 1;
194193
string ip = arppacket.SenderProtocolAddress.ToString();
195194
var obj = new Device();
@@ -208,7 +207,7 @@ public static void GetAllClients(IView view, string interfacefriendlyname)
208207
view.ListView1.UpdateObject(obj);
209208
}));
210209
}
211-
catch (Exception ex)
210+
catch (Exception)
212211
{
213212

214213
view.ListView1.BeginInvoke(new Action(() =>
@@ -257,14 +256,11 @@ public static void GetAllClients(IView view, string interfacefriendlyname)
257256
capturedevice = null;
258257
BackgroundScanStart(view, interfacefriendlyname); //start passive monitoring
259258
}
260-
catch (PcapException ex)
259+
catch (Exception)
261260
{
262261
view.MainForm.Invoke(new Action(() => view.StatusLabel.Text = "Refresh for scan"));
263262
}
264-
catch (Exception ex)
265-
{
266-
267-
}
263+
268264

269265
}).Start();
270266
#endregion
@@ -393,13 +389,11 @@ public static void BackgroundScanStart(IView view, string interfacefriendlyname)
393389
}
394390
}
395391
}
396-
catch (PcapException ex)
392+
catch (Exception)
397393
{
398394

399395
}
400-
catch (Exception ex)
401-
{
402-
}
396+
403397
}).Start();
404398
#endregion
405399

@@ -417,7 +411,6 @@ public static void BackgroundScanStart(IView view, string interfacefriendlyname)
417411
view.ListView1.Invoke(new Action(() =>
418412
{
419413
string mac = GetMACString(arppacket.SenderHardwareAddress);
420-
string machineName = "";
421414
int id = clientlist.Count - 1;
422415
string ip = arppacket.SenderProtocolAddress.ToString();
423416
var obj = new Device();
@@ -437,7 +430,7 @@ public static void BackgroundScanStart(IView view, string interfacefriendlyname)
437430
}));
438431

439432
}
440-
catch (Exception ex)
433+
catch (Exception)
441434
{
442435

443436
view.ListView1.BeginInvoke(new Action(() =>
@@ -494,7 +487,7 @@ public static void BackgroundScanStart(IView view, string interfacefriendlyname)
494487
#endregion
495488

496489
}
497-
catch (Exception ex)
490+
catch (Exception)
498491
{
499492
}
500493
}
@@ -550,11 +543,12 @@ public static string GetMACString(PhysicalAddress physicaladdress)
550543
retval += physicaladdress.GetAddressBytes()[i].ToString("X2") + ":";
551544
return retval.Substring(0, retval.Length - 1);
552545
}
553-
catch (Exception ex)
546+
catch (Exception)
554547
{
555-
throw ex;
548+
556549
}
557550

551+
return default;
558552
}
559553

560554

NetStalker/NetStalker/Limiter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void StartLimiter()
3737

3838
}
3939
}
40-
catch (Exception exception)
40+
catch (Exception)
4141
{
4242

4343
}
@@ -58,7 +58,7 @@ public void Limiter()
5858
Packet = PacketDotNet.Packet.ParsePacket(rawCapture.LinkLayerType, rawCapture.Data) as EthernetPacket;
5959
if (Packet == null) { return; }
6060
}
61-
catch (Exception e)
61+
catch (Exception)
6262
{
6363
continue;
6464
}

NetStalker/NetStalker/Main.Designer.cs

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)