diff --git a/EvilLimiter.Windows/App.config b/EvilLimiter.Windows/App.config
index 9e34643..cdc3a42 100644
--- a/EvilLimiter.Windows/App.config
+++ b/EvilLimiter.Windows/App.config
@@ -4,10 +4,11 @@
-
+
+
diff --git a/EvilLimiter.Windows/Common/Config.cs b/EvilLimiter.Windows/Common/Config.cs
index cf0c490..72d5b51 100644
--- a/EvilLimiter.Windows/Common/Config.cs
+++ b/EvilLimiter.Windows/Common/Config.cs
@@ -32,6 +32,12 @@ public static int ScanReplyTimeout
set { lock (_scanReplyTimeoutLock) _scanReplyTimeout = value; }
}
+ public static bool ScanResolveHostnames
+ {
+ get { lock (_scanResolveHostnamesLock) return _scanResolveHostnames; }
+ set { lock (_scanResolveHostnamesLock) _scanResolveHostnames = value; }
+ }
+
public static int SpoofSendInterval
{
@@ -69,6 +75,8 @@ public static int BandwidthMonitorUpdateInterval
private static readonly object _scanSendIntervalLock;
private static int _scanReplyTimeout;
private static readonly object _scanReplyTimeoutLock;
+ private static bool _scanResolveHostnames;
+ private static readonly object _scanResolveHostnamesLock;
private static int _spoofSendInterval;
private static readonly object _spoofSendIntervalLock;
@@ -88,6 +96,7 @@ static Config()
_colorStyle = MetroColorStyle.Default;
_scanSendInterval = 10;
_scanReplyTimeout = 2000;
+ _scanResolveHostnames = true;
_spoofSendInterval = 4000;
_spoofRestoreSendCount = 3;
_spoofRestoreSendInterval = 50;
@@ -97,10 +106,13 @@ static Config()
_colorStyleLock = new object();
_scanSendIntervalLock = new object();
_scanReplyTimeoutLock = new object();
+ _scanResolveHostnamesLock = new object();
_spoofSendIntervalLock = new object();
_spoofRestoreSendCountLock = new object();
_spoofRestoreSendIntervalLock = new object();
_bandwidthMonitorUpdateIntervalLock = new object();
+
+ System.Console.WriteLine(true.ToString());
}
@@ -117,6 +129,7 @@ public static bool Read()
ScanSendInterval = int.Parse(config.AppSettings.Settings["ScanSendInterval"].Value);
ScanReplyTimeout = int.Parse(config.AppSettings.Settings["ScanReplyTimeout"].Value);
+ ScanResolveHostnames = bool.Parse(config.AppSettings.Settings["ScanResolveHostnames"].Value);
SpoofSendInterval = int.Parse(config.AppSettings.Settings["SpoofSendInterval"].Value);
SpoofRestoreSendCount = int.Parse(config.AppSettings.Settings["SpoofRestoreSendCount"].Value);
@@ -145,6 +158,7 @@ public static bool Write()
config.AppSettings.Settings["ScanSendInterval"].Value = ScanSendInterval.ToString();
config.AppSettings.Settings["ScanReplyTimeout"].Value = ScanReplyTimeout.ToString();
+ config.AppSettings.Settings["ScanResolveHostnames"].Value = ScanResolveHostnames.ToString();
config.AppSettings.Settings["SpoofSendInterval"].Value = SpoofSendInterval.ToString();
config.AppSettings.Settings["SpoofRestoreSendCount"].Value = SpoofRestoreSendCount.ToString();
diff --git a/EvilLimiter.Windows/Forms/FrmMain.Designer.cs b/EvilLimiter.Windows/Forms/FrmMain.Designer.cs
index 721eaf9..b10ae1b 100644
--- a/EvilLimiter.Windows/Forms/FrmMain.Designer.cs
+++ b/EvilLimiter.Windows/Forms/FrmMain.Designer.cs
@@ -87,6 +87,7 @@ private void InitializeComponent()
this.lnkEvilLimiter = new MetroFramework.Controls.MetroLink();
this.metroLabel15 = new MetroFramework.Controls.MetroLabel();
this.metroLabel14 = new MetroFramework.Controls.MetroLabel();
+ this.cbScanResolveHostnames = new MetroFramework.Controls.MetroCheckBox();
this.cmsHosts.SuspendLayout();
this.tcHosts.SuspendLayout();
this.tpHosts.SuspendLayout();
@@ -251,7 +252,7 @@ private void InitializeComponent()
this.tcHosts.Controls.Add(this.tpAbout);
this.tcHosts.Location = new System.Drawing.Point(23, 79);
this.tcHosts.Name = "tcHosts";
- this.tcHosts.SelectedIndex = 0;
+ this.tcHosts.SelectedIndex = 1;
this.tcHosts.Size = new System.Drawing.Size(718, 376);
this.tcHosts.TabIndex = 4;
this.tcHosts.UseSelectable = true;
@@ -313,7 +314,7 @@ private void InitializeComponent()
this.tcSettings.FontSize = MetroFramework.MetroTabControlSize.Small;
this.tcSettings.Location = new System.Drawing.Point(0, 13);
this.tcSettings.Name = "tcSettings";
- this.tcSettings.SelectedIndex = 4;
+ this.tcSettings.SelectedIndex = 1;
this.tcSettings.Size = new System.Drawing.Size(710, 289);
this.tcSettings.TabIndex = 2;
this.tcSettings.UseSelectable = true;
@@ -380,6 +381,7 @@ private void InitializeComponent()
//
// tpScanSettings
//
+ this.tpScanSettings.Controls.Add(this.cbScanResolveHostnames);
this.tpScanSettings.Controls.Add(this.metroLabel6);
this.tpScanSettings.Controls.Add(this.metroLabel5);
this.tpScanSettings.Controls.Add(this.tbScanReplyTimeout);
@@ -839,6 +841,18 @@ private void InitializeComponent()
this.metroLabel14.TabIndex = 2;
this.metroLabel14.Text = "This is the Windows version of the linux command-line tool .";
//
+ // cbScanResolveHostnames
+ //
+ this.cbScanResolveHostnames.AutoSize = true;
+ this.cbScanResolveHostnames.Checked = true;
+ this.cbScanResolveHostnames.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.cbScanResolveHostnames.Location = new System.Drawing.Point(4, 145);
+ this.cbScanResolveHostnames.Name = "cbScanResolveHostnames";
+ this.cbScanResolveHostnames.Size = new System.Drawing.Size(126, 15);
+ this.cbScanResolveHostnames.TabIndex = 9;
+ this.cbScanResolveHostnames.Text = "Resolve Hostnames";
+ this.cbScanResolveHostnames.UseSelectable = true;
+ //
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -931,5 +945,6 @@ private void InitializeComponent()
private MetroFramework.Controls.MetroLink lnkGitHubPage;
private MetroFramework.Controls.MetroLabel metroLabel15;
private MetroFramework.Controls.MetroLabel metroLabel17;
+ private MetroFramework.Controls.MetroCheckBox cbScanResolveHostnames;
}
}
\ No newline at end of file
diff --git a/EvilLimiter.Windows/Forms/FrmMain.cs b/EvilLimiter.Windows/Forms/FrmMain.cs
index 4b8a302..123d34a 100644
--- a/EvilLimiter.Windows/Forms/FrmMain.cs
+++ b/EvilLimiter.Windows/Forms/FrmMain.cs
@@ -77,6 +77,7 @@ private void UpdateConfigDisplay()
tbScanSendInterval.Text = Config.ScanSendInterval.ToString();
tbScanReplyTimeout.Text = Config.ScanReplyTimeout.ToString();
+ cbScanResolveHostnames.Checked = Config.ScanResolveHostnames;
tbSpoofSendInterval.Text = Config.SpoofSendInterval.ToString();
tbSpoofRestoreSendCount.Text = Config.SpoofRestoreSendCount.ToString();
tbSpoofRestoreSendInterval.Text = Config.SpoofRestoreSendInterval.ToString();
@@ -362,6 +363,7 @@ private void BtnApplySettings_Click(object sender, EventArgs e)
Config.ColorStyle = colorStyle;
Config.ScanSendInterval = scanSendInterval;
Config.ScanReplyTimeout = scanReplyTimeout;
+ Config.ScanResolveHostnames = cbScanResolveHostnames.Checked;
Config.SpoofSendInterval = spoofSendInterval;
Config.SpoofRestoreSendCount = spoofRestoreSendCount;
Config.SpoofRestoreSendInterval = spoofRestoreSendInterval;
diff --git a/EvilLimiter.Windows/Forms/FrmScan.cs b/EvilLimiter.Windows/Forms/FrmScan.cs
index e0055b0..c884f22 100644
--- a/EvilLimiter.Windows/Forms/FrmScan.cs
+++ b/EvilLimiter.Windows/Forms/FrmScan.cs
@@ -1,4 +1,5 @@
-using EvilLimiter.Windows.Data;
+using EvilLimiter.Windows.Common;
+using EvilLimiter.Windows.Data;
using EvilLimiter.Windows.Networking;
using EvilLimiter.Windows.Utilities;
using MetroFramework;
@@ -104,7 +105,7 @@ private void HostScanner_HostScanned(object sender, HostScannedEventArgs e)
pbScan.Maximum = e.Total;
pbScan.Value = e.Current;
- if (e.Current == e.Total)
+ if (e.Current == e.Total && Config.ScanResolveHostnames)
{
btnScan.Enabled = false;
lblStatus.Text = "Resolving hostnames...";
@@ -144,7 +145,7 @@ private void BtnScan_Click(object sender, System.EventArgs e)
range = _networkInfo.SubnetRange;
ChangeScanState(ScanState.Scan);
- _hostScanner.Scan(range);
+ _hostScanner.Scan(range, Config.ScanResolveHostnames);
}
}
diff --git a/EvilLimiter.Windows/Networking/HostScanner.cs b/EvilLimiter.Windows/Networking/HostScanner.cs
index f828a7a..e37cdcf 100644
--- a/EvilLimiter.Windows/Networking/HostScanner.cs
+++ b/EvilLimiter.Windows/Networking/HostScanner.cs
@@ -52,7 +52,7 @@ public HostScanner(NetworkInformation netInfo)
- public void Scan(ICollection addresses)
+ public void Scan(ICollection addresses, bool resolveHostnames = true)
{
if (IsScanning)
return;
@@ -137,8 +137,11 @@ public void Scan(ICollection addresses)
Thread.Sleep(Config.ScanReplyTimeout);
_tokenSource.Cancel();
- foreach (var host in discoveredHosts)
- host.HostName = NetworkUtilities.GetHostNameByIp(host.IpAddress);
+ if(resolveHostnames)
+ {
+ foreach (var host in discoveredHosts)
+ host.HostName = NetworkUtilities.GetHostNameByIp(host.IpAddress);
+ }
OnScanFinished(new ScanFinishedEventArgs(discoveredHosts));
}