From b05f827243a2d49021e80cafa618389c9fec3bd9 Mon Sep 17 00:00:00 2001 From: goingfine Date: Thu, 2 Mar 2023 18:53:33 +0330 Subject: [PATCH 1/6] adapting with new client config file format --- windows/Classes/AppUpdateChecker.cs | 132 +++++++++++++++++ windows/Classes/CheckIPWorking.cs | 21 ++- windows/Classes/Config/AppConfig.cs | 4 +- windows/Classes/Config/ConfigManager.cs | 16 +- windows/Classes/Config/RealConfig.cs | 139 ------------------ windows/Classes/ScanEngine.cs | 11 +- windows/Classes/Tools.cs | 2 +- windows/assets/app-config.json | 6 +- windows/assets/v2ray-config/ClientConfig.json | 10 ++ .../assets/v2ray-config/config.json.template | 2 +- windows/assets/v2ray-config/config.real | 5 - windows/frmMain.cs | 43 ++++-- 12 files changed, 209 insertions(+), 182 deletions(-) create mode 100644 windows/Classes/AppUpdateChecker.cs delete mode 100644 windows/Classes/Config/RealConfig.cs create mode 100644 windows/assets/v2ray-config/ClientConfig.json delete mode 100644 windows/assets/v2ray-config/config.real diff --git a/windows/Classes/AppUpdateChecker.cs b/windows/Classes/AppUpdateChecker.cs new file mode 100644 index 00000000..b02a00ca --- /dev/null +++ b/windows/Classes/AppUpdateChecker.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using WinCFScan.Classes.Config; + +namespace WinCFScan.Classes +{ + internal class AppUpdateChecker + { + private string localVersion; + private string remoteVersion; + + private string remoteVersionUrl = "https://raw.githubusercontent.com/MortezaBashsiz/CFScanner/main/windows/Properties/latest-version"; + private string localVersionFileName = "local-version"; + private bool foundNewVersion = false; + + public static Version getCurrentVersion() + { + return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + } + + public AppUpdateChecker() { + localVersion = getCurrentVersion().ToString(); + } + + // check for update + public UpdateCheckResult check() + { + if(getRemoteVersion()) + { + foundNewVersion = isNewVersionAvailable(); + return foundNewVersion ? UpdateCheckResult.NewVersionAvailable : UpdateCheckResult.NewVersionAvailable; + } + else + { + return UpdateCheckResult.HasError; + } + } + + public bool isFoundNewVersion() + { + return foundNewVersion; + } + + public string getUpdateVersion() + { + return remoteVersion; + } + + public bool shouldCheck() + { + return isFileOld(localVersionFileName); + } + + // is there new version? + private bool isNewVersionAvailable() + { + return isRemoteVersionValid() && compareVersions(); + } + + // is valid string with format v:1.0.xxx.xxx + private bool isRemoteVersionValid() + { + return remoteVersion != null && remoteVersion.StartsWith("v:") && remoteVersion.Split(".").Length == 4; + } + + // return true if remote version is higher + private bool compareVersions() { + + var remoteV = remoteVersion.Substring(2).Split(".").Sum(p => Convert.ToUInt32(p)); + var localV = localVersion.Split(".").Sum(p => Convert.ToUInt32(p)); + + return remoteV > localV; + } + + private bool isFileOld(string file) + { + return !File.Exists(file) || (DateTime.Now - File.GetLastWriteTime(file)).TotalDays > 1; + } + + private bool saveCurrentLocalVersion() + { + try + { + File.WriteAllText(localVersionFileName, localVersion); + return true; + } + catch (Exception) { } + return false; + } + + private bool getRemoteVersion() + { + HttpClient client = new HttpClient(); + client.Timeout = TimeSpan.FromSeconds(5); + + try + { + remoteVersion = client.GetStringAsync(remoteVersionUrl).Result; + + if (isRemoteVersionValid()) + { + // whenever check remote version then update timestamp of local version file + // to prevent frequent remote checks + saveCurrentLocalVersion(); + + return true; + } + } + catch (Exception ex) + { + Tools.logStep($"getRemoteVersion had exception: {ex.Message}"); + } + finally + { + client.Dispose(); + } + + return false; + } + } + + public enum UpdateCheckResult { + NewVersionAvailable = 0, + NewVersionNotAvailable = 1, + HasError = 3 + } +} diff --git a/windows/Classes/CheckIPWorking.cs b/windows/Classes/CheckIPWorking.cs index 61bdec7f..cb410dfa 100644 --- a/windows/Classes/CheckIPWorking.cs +++ b/windows/Classes/CheckIPWorking.cs @@ -123,7 +123,7 @@ private bool checkDownloadSpeed() try { sw.Start(); - string dlUrl = "https://" + ConfigManager.Instance.getAppConfig().scanDomain + "/data.100k"; + string dlUrl = "https://" + ConfigManager.Instance.getAppConfig().scanDomain + "100000"; Tools.logStep($"Starting dl url: {dlUrl}"); var data = client.GetStringAsync(dlUrl).Result; Tools.logStep($"*** Download success in {sw.ElapsedMilliseconds:n0} ms, dl size: {data.Length:n0} bytes for IP {ip}"); @@ -148,16 +148,16 @@ private bool createV2rayConfigFile() try { var configTemplate = ConfigManager.Instance.v2rayConfigTemplate; - RealConfig realConfig = ConfigManager.Instance.getRealConfig(); + ClientConfig clientConfig = ConfigManager.Instance.getClientConfig(); configTemplate = configTemplate - .Replace("IDID", realConfig.id) + .Replace("IDID", clientConfig.id) .Replace("PORTPORT", port) - .Replace("HOSTHOST", realConfig.host) - .Replace("CFPORTCFPORT", realConfig.port) - .Replace("RANDOMHOST", realConfig.serverName) + .Replace("HOSTHOST", clientConfig.host) + .Replace("CFPORTCFPORT", clientConfig.port) + .Replace("RANDOMHOST", clientConfig.serverName) .Replace("IP.IP.IP.IP", this.ip) - .Replace("ENDPOINTENDPOINT", realConfig.path); + .Replace("ENDPOINTENDPOINT", clientConfig.path); File.WriteAllText(v2rayConfigPath, configTemplate); @@ -197,6 +197,13 @@ private bool runV2rayProcess() Thread.Sleep(1500); bool wasSuccess = process.Responding && !process.HasExited; Tools.logStep($"v2ray.exe executed success: {wasSuccess}"); + + // log error + if (!wasSuccess) + { + Tools.logStep($"v2ray.exe Error: {process.StandardError.ReadToEnd()}"); + } + return wasSuccess; } diff --git a/windows/Classes/Config/AppConfig.cs b/windows/Classes/Config/AppConfig.cs index 909e85a1..fb9e7cfc 100644 --- a/windows/Classes/Config/AppConfig.cs +++ b/windows/Classes/Config/AppConfig.cs @@ -14,7 +14,7 @@ internal class AppConfig : ConfigInterface public string frontDomain { get; set; } public string scanDomain { get; set; } - public string configRealUrl { get; set; } + public string clientConfigUrl { get; set; } // load app config public bool load() @@ -41,7 +41,7 @@ public bool load() public bool isConfigValid() { - return frontDomain != null && scanDomain != null && configRealUrl != null; + return frontDomain != null && scanDomain != null && clientConfigUrl != null; } public AppConfig? getLoadedInstance() diff --git a/windows/Classes/Config/ConfigManager.cs b/windows/Classes/Config/ConfigManager.cs index 288c096b..bb0f1c13 100644 --- a/windows/Classes/Config/ConfigManager.cs +++ b/windows/Classes/Config/ConfigManager.cs @@ -16,7 +16,7 @@ internal class ConfigManager protected string[] mandatoryDirectories = { "v2ray-config", "v2ray-config/generated", "results" }; //this dirs must be existed protected AppConfig? appConfig; - protected RealConfig? realConfig; + protected ClientConfig? clientConfig; public string errorMessage { get; set; } = ""; protected bool loadedOK = true; @@ -28,7 +28,7 @@ public ConfigManager() { if (this.load() && appConfig != null) { - realConfig = new RealConfig(appConfig); + clientConfig = (new ClientConfig(appConfig)).getLoadedInstance(); } // set static instance for later access of this instance @@ -81,12 +81,16 @@ protected bool load() return false; } - return isConfigValid(); + return true; } public bool isConfigValid() { - if(appConfig != null && appConfig.isConfigValid() && v2rayConfigTemplate != null && loadedOK) + if( + appConfig != null && appConfig.isConfigValid() && + v2rayConfigTemplate != null && loadedOK && + clientConfig != null && clientConfig.isConfigValid() + ) { return true; } @@ -106,9 +110,9 @@ private void checkDebugEnable() return this.appConfig; } - public RealConfig? getRealConfig() + public ClientConfig? getClientConfig() { - return this.realConfig; + return this.clientConfig; } } } diff --git a/windows/Classes/Config/RealConfig.cs b/windows/Classes/Config/RealConfig.cs deleted file mode 100644 index 96a0d315..00000000 --- a/windows/Classes/Config/RealConfig.cs +++ /dev/null @@ -1,139 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Threading.Tasks; - -namespace WinCFScan.Classes.Config -{ - - internal class RealConfig : ConfigInterface - { - public string id { get; private set; } - public string host { get; private set; } - public string port { get; private set; } - public string path { get; private set; } - public string serverName { get; private set; } - - protected string v2rayConfigRealFileName = "v2ray-config/config.real"; - protected string v2rayGeneratedConfigDir = "v2ray-config/generated"; - protected AppConfig appConfig; - - public RealConfig(AppConfig appConfig) - { - this.appConfig = appConfig; - this.load(); - } - - // load real config - public bool load() - { - if (!File.Exists(v2rayConfigRealFileName)) - { - return false; - } - - try - { - string[] lines = File.ReadAllLines(v2rayConfigRealFileName); - foreach (string line in lines) - { - string[] parts = line.Split(": "); - switch (parts[0].ToLower()) - { - case "id": - this.id = parts[1]; - break; - case "host": - this.host = parts[1]; - break; - case "port": - this.port = parts[1]; - break; - case "path": - this.path = parts[1]; - break; - case "servername": - this.serverName = parts[1]; - break; - } - } - } - catch (Exception ex) { - return false; - } - - return isConfigValid(); - } - - public bool isConfigValid() - { - return this.id!= null && this.host != null && this.port != null && this.path != null && this.serverName != null; - } - - // if 'config real' file is not exists or is too old then download it from remote - public bool remoteUpdateConfigReal() - { - if (isConfigRealOld()) - { - deleteOldGeneratedConfigs(); - - // download fresh conf - var client = new HttpClient(); - try - { - client.Timeout = TimeSpan.FromSeconds(10); - var html = client.GetStringAsync(this.appConfig.configRealUrl).Result; - File.WriteAllText(v2rayConfigRealFileName, html); - - // reload - this.load(); - return true; - - } - catch (Exception ex) - { - Tools.logStep($"remoteUpdateConfigReal() had exception: {ex.Message}"); - return false; - } - finally - { - client.Dispose(); - } - } - - return true; - } - - private void deleteOldGeneratedConfigs() - { - try - { - var resultFiles = Directory.GetFiles(v2rayGeneratedConfigDir, "*.json"); - foreach (var resultFile in resultFiles) - { - if (isFileOld(resultFile)) - { - File.Delete(resultFile); - } - } - } - catch (Exception) - { - - } - } - - private bool isFileOld(string file) - { - return (DateTime.Now - File.GetLastWriteTime(file)).TotalDays > 1; - } - - public bool isConfigRealOld() - { - return !File.Exists(v2rayConfigRealFileName) || isFileOld(v2rayConfigRealFileName); - } - - } -} diff --git a/windows/Classes/ScanEngine.cs b/windows/Classes/ScanEngine.cs index 00662fda..aacf58cd 100644 --- a/windows/Classes/ScanEngine.cs +++ b/windows/Classes/ScanEngine.cs @@ -187,11 +187,16 @@ public bool loadCFIPList(string fileName = "cf.local.iplist") internal void stop() { - if(progressInfo.isScanRunning) + try { - progressInfo.stopRequested = true; - cts.Cancel(); + if (progressInfo.isScanRunning) + { + progressInfo.stopRequested = true; + cts.Cancel(); + } } + catch (Exception) + {} } public void skipCurrentIPRange() { diff --git a/windows/Classes/Tools.cs b/windows/Classes/Tools.cs index efd8d484..cd42668a 100644 --- a/windows/Classes/Tools.cs +++ b/windows/Classes/Tools.cs @@ -13,7 +13,7 @@ internal class Tools public static void logStep(string message) { - if(ConfigManager.Instance.enableDebug) + if(ConfigManager.Instance != null && ConfigManager.Instance.enableDebug) { LogControl.Write(message, "debug.txt"); } diff --git a/windows/assets/app-config.json b/windows/assets/app-config.json index c8c52f55..77712506 100644 --- a/windows/assets/app-config.json +++ b/windows/assets/app-config.json @@ -1,5 +1,5 @@ { - "frontDomain": "fronting.sudoer.net", - "scanDomain": "scan.sudoer.net", - "configRealUrl": "http://bot.sudoer.net/config.real" + "frontDomain": "speed.cloudflare.com/__down?bytes=1000", + "scanDomain": "speed.cloudflare.com/__down?bytes=", + "clientConfigUrl": "https://raw.githubusercontent.com/MortezaBashsiz/CFScanner/main/bash/ClientConfig.json" } \ No newline at end of file diff --git a/windows/assets/v2ray-config/ClientConfig.json b/windows/assets/v2ray-config/ClientConfig.json new file mode 100644 index 00000000..d7d7a22e --- /dev/null +++ b/windows/assets/v2ray-config/ClientConfig.json @@ -0,0 +1,10 @@ +{ + "id": "248ecb72-89cf-5be7-923f-b790fca681c5", + "Host": "scherehtzhel01.sudoer.net", + "Port": "443", + "path": "api01", + "serverName": "248ecb72-89cf-5be7-923f-b790fca681c5.sudoer.net", + "frontDomain": "fronting.sudoer.net", + "scanDomain": "scan.sudoer.net", + "subnetsList": "https://raw.githubusercontent.com/MortezaBashsiz/CFScanner/main/bash/cf.local.iplist" +} diff --git a/windows/assets/v2ray-config/config.json.template b/windows/assets/v2ray-config/config.json.template index cdb9d2fc..9180816e 100644 --- a/windows/assets/v2ray-config/config.json.template +++ b/windows/assets/v2ray-config/config.json.template @@ -20,7 +20,7 @@ "settings": { "vnext": [{ "address": "IP.IP.IP.IP", - "port": 443, + "port": CFPORTCFPORT, "users": [{"id": "IDID" }] }] }, diff --git a/windows/assets/v2ray-config/config.real b/windows/assets/v2ray-config/config.real deleted file mode 100644 index 8dd21fcb..00000000 --- a/windows/assets/v2ray-config/config.real +++ /dev/null @@ -1,5 +0,0 @@ -id: 248ecb72-89cf-5be7-923f-b790fca681c5 -Host: scherehtzhel01.sudoer.net -Port: 443 -path: api01 -serverName: 248ecb72-89cf-5be7-923f-b790fca681c5.sudoer.net diff --git a/windows/frmMain.cs b/windows/frmMain.cs index b4884cd2..3b67de83 100644 --- a/windows/frmMain.cs +++ b/windows/frmMain.cs @@ -25,6 +25,7 @@ public partial class frmMain : Form private ListViewColumnSorter listResultsColumnSorter; private ListViewColumnSorter listCFIPsColumnSorter; private Version appVersion; + private AppUpdateChecker appUpdateChecker; public frmMain() { @@ -54,12 +55,15 @@ public frmMain() loadLastResultsComboList(); - appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + appVersion = AppUpdateChecker.getCurrentVersion(); + DateTime buildDate = new DateTime(2000, 1, 1) .AddDays(appVersion.Build).AddSeconds(appVersion.Revision * 2); string displayableVersion = $" - {appVersion}"; this.Text += displayableVersion; + appUpdateChecker = new AppUpdateChecker(); + // is debug mode enable? this line should be at bottom line checkEnableDebugMode(); } @@ -72,7 +76,7 @@ private void checkEnableDebugMode() comboConcurrent.Enabled = false; lblDebugMode.Visible = true; addTextLog("Debug mode is enabled. In this mode concurrent process is set to 1 and you can see scan debug data in 'debug.txt' file in the app directory."); - addTextLog("To exit debug mode delete 'enable-debug' file from the app directory and re-open the app."); + addTextLog("To exit debug mode delete 'enable-debug' file from the app directory and then re-open the app."); Tools.logStep($"\n\nApp started. Version: {appVersion}"); } } @@ -218,8 +222,6 @@ private void updateUIControlls(bool isStarting) listResultsColumnSorter.Order = SortOrder.Ascending; listResultsColumnSorter.SortColumn = 0; listResults.Sort(); - - } } @@ -234,7 +236,6 @@ private void timerBase_Tick(object sender, EventArgs e) } } - private void timerProgress_Tick(object sender, EventArgs e) { updateConrtolsProgress(); @@ -261,8 +262,6 @@ private void updateConrtolsProgress(bool forceUpdate = false) fetchWorkingIPResults(); pInf.scanResults.autoSave(); } - - } // fetch new woriking ips and add to the list view while scanning @@ -349,23 +348,24 @@ private void oneTimeChecks() { //Load cf ip ranges loadCFIPListView(); + - // check if config real file is exists and update - if (configManager.getRealConfig() != null && configManager.getRealConfig().isConfigRealOld()) + // check if client config file is exists and update + if (configManager.getClientConfig() != null && configManager.getClientConfig().isClientConfigOld()) { - addTextLog("Updating real config from remote..."); - bool result = configManager.getRealConfig().remoteUpdateConfigReal(); + addTextLog("Updating client config from remote..."); + bool result = configManager.getClientConfig().remoteUpdateClientConfig(); if (result) { - addTextLog("'real config' is successfully updated."); - if (!configManager.getRealConfig().isConfigValid()) + addTextLog("'client config' is successfully updated."); + if (!configManager.getClientConfig().isConfigValid()) { - addTextLog("'real config' data is not valid!"); + addTextLog("'client config' data is not valid!"); } } else { - addTextLog("Failed to update real config. check your internet connection or maybe real config update url is blocked by your ISP!"); + addTextLog("Failed to update client config. check your internet connection or maybe client config update url is blocked by your ISP!"); } } @@ -379,6 +379,19 @@ private void oneTimeChecks() } }); + // check for updates + if (appUpdateChecker.shouldCheck()) + { + Task.Factory.StartNew(() => appUpdateChecker.check()) + .ContinueWith(done => + { + if(appUpdateChecker.isFoundNewVersion()) + { + addTextLog($"There is a new version available ({appUpdateChecker.getUpdateVersion()}) Download it from here: {ourGitHubUrl}/releases"); + } + }); + } + oneTimeChecked = true; } } From 1979e37d736f7d0864de53e95b10b0e0b0bbcd3a Mon Sep 17 00:00:00 2001 From: goingfine Date: Fri, 3 Mar 2023 09:37:13 +0330 Subject: [PATCH 2/6] changing ui design --- windows/frmMain.Designer.cs | 339 ++++++++++++++++++++++-------------- windows/frmMain.cs | 15 +- windows/frmMain.resx | 28 ++- 3 files changed, 250 insertions(+), 132 deletions(-) diff --git a/windows/frmMain.Designer.cs b/windows/frmMain.Designer.cs index c2d85e53..6af5164a 100644 --- a/windows/frmMain.Designer.cs +++ b/windows/frmMain.Designer.cs @@ -29,23 +29,32 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - this.btnStart = new System.Windows.Forms.Button(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain)); this.txtLog = new System.Windows.Forms.TextBox(); this.timerBase = new System.Windows.Forms.Timer(this.components); - this.prgOveral = new System.Windows.Forms.ProgressBar(); - this.prgCurRange = new System.Windows.Forms.ProgressBar(); - this.btnSkipCurRange = new System.Windows.Forms.Button(); this.labelLastIPChecked = new System.Windows.Forms.Label(); this.lblLastIPRange = new System.Windows.Forms.Label(); this.timerProgress = new System.Windows.Forms.Timer(this.components); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.btnStart = new System.Windows.Forms.ToolStripSplitButton(); + this.mnuPauseScan = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.comboConcurrent = new System.Windows.Forms.ToolStripComboBox(); + this.lblConcurrent = new System.Windows.Forms.ToolStripLabel(); + this.comboTargetSpeed = new System.Windows.Forms.ToolStripComboBox(); + this.lblTargetSpeed = new System.Windows.Forms.ToolStripLabel(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.prgOveral = new System.Windows.Forms.ToolStripProgressBar(); + this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.btnSkipCurRange = new System.Windows.Forms.ToolStripButton(); + this.prgCurRange = new System.Windows.Forms.ToolStripProgressBar(); + this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); this.lblDebugMode = new System.Windows.Forms.Label(); this.linkGithub = new System.Windows.Forms.LinkLabel(); this.btnCopyFastestIP = new System.Windows.Forms.Button(); this.txtFastestIP = new System.Windows.Forms.TextBox(); - this.lblFastestIP = new System.Windows.Forms.Label(); - this.comboConcurrent = new System.Windows.Forms.ComboBox(); - this.lblConcurrent = new System.Windows.Forms.Label(); this.lblTotalWorkingIPs = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.comboResults = new System.Windows.Forms.ComboBox(); @@ -87,6 +96,7 @@ private void InitializeComponent() this.importResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); this.mnuListView.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -99,19 +109,6 @@ private void InitializeComponent() this.mnuResultsActions.SuspendLayout(); this.SuspendLayout(); // - // btnStart - // - this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnStart.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); - this.btnStart.Location = new System.Drawing.Point(685, 19); - this.btnStart.Name = "btnStart"; - this.btnStart.Size = new System.Drawing.Size(89, 52); - this.btnStart.TabIndex = 0; - this.btnStart.Text = "Start Scan"; - this.toolTip1.SetToolTip(this.btnStart, "Scan in selected IP ranges of Cloudflare"); - this.btnStart.UseVisualStyleBackColor = true; - this.btnStart.Click += new System.EventHandler(this.btnStart_Click); - // // txtLog // this.txtLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(23)))), ((int)(((byte)(24))))); @@ -123,7 +120,7 @@ private void InitializeComponent() this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(780, 185); + this.txtLog.Size = new System.Drawing.Size(780, 186); this.txtLog.TabIndex = 1; this.txtLog.Text = "Welcome to Cloudflare IP Scanner.\r\n"; // @@ -133,43 +130,10 @@ private void InitializeComponent() this.timerBase.Interval = 1500; this.timerBase.Tick += new System.EventHandler(this.timerBase_Tick); // - // prgOveral - // - this.prgOveral.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.prgOveral.Location = new System.Drawing.Point(274, 47); - this.prgOveral.Name = "prgOveral"; - this.prgOveral.Size = new System.Drawing.Size(260, 20); - this.prgOveral.TabIndex = 5; - this.toolTip1.SetToolTip(this.prgOveral, "Overal progress"); - // - // prgCurRange - // - this.prgCurRange.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.prgCurRange.Location = new System.Drawing.Point(274, 20); - this.prgCurRange.Name = "prgCurRange"; - this.prgCurRange.Size = new System.Drawing.Size(260, 20); - this.prgCurRange.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this.prgCurRange.TabIndex = 4; - this.toolTip1.SetToolTip(this.prgCurRange, "Current IP range progress"); - // - // btnSkipCurRange - // - this.btnSkipCurRange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnSkipCurRange.Enabled = false; - this.btnSkipCurRange.Location = new System.Drawing.Point(545, 19); - this.btnSkipCurRange.Name = "btnSkipCurRange"; - this.btnSkipCurRange.Size = new System.Drawing.Size(131, 23); - this.btnSkipCurRange.TabIndex = 3; - this.btnSkipCurRange.Text = "Skip curent IP range"; - this.btnSkipCurRange.UseVisualStyleBackColor = true; - this.btnSkipCurRange.Click += new System.EventHandler(this.btnSkipCurRange_Click); - // // labelLastIPChecked // this.labelLastIPChecked.AutoSize = true; - this.labelLastIPChecked.Location = new System.Drawing.Point(11, 22); + this.labelLastIPChecked.Location = new System.Drawing.Point(11, 52); this.labelLastIPChecked.Name = "labelLastIPChecked"; this.labelLastIPChecked.Size = new System.Drawing.Size(91, 15); this.labelLastIPChecked.TabIndex = 1; @@ -178,7 +142,7 @@ private void InitializeComponent() // lblLastIPRange // this.lblLastIPRange.AutoSize = true; - this.lblLastIPRange.Location = new System.Drawing.Point(11, 43); + this.lblLastIPRange.Location = new System.Drawing.Point(11, 73); this.lblLastIPRange.Name = "lblLastIPRange"; this.lblLastIPRange.Size = new System.Drawing.Size(99, 15); this.lblLastIPRange.TabIndex = 0; @@ -193,33 +157,181 @@ private void InitializeComponent() // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.toolStrip1); this.groupBox1.Controls.Add(this.lblDebugMode); this.groupBox1.Controls.Add(this.linkGithub); this.groupBox1.Controls.Add(this.btnCopyFastestIP); this.groupBox1.Controls.Add(this.txtFastestIP); - this.groupBox1.Controls.Add(this.lblFastestIP); - this.groupBox1.Controls.Add(this.comboConcurrent); - this.groupBox1.Controls.Add(this.lblConcurrent); this.groupBox1.Controls.Add(this.lblTotalWorkingIPs); this.groupBox1.Controls.Add(this.labelLastIPChecked); - this.groupBox1.Controls.Add(this.prgOveral); this.groupBox1.Controls.Add(this.lblLastIPRange); - this.groupBox1.Controls.Add(this.btnStart); - this.groupBox1.Controls.Add(this.prgCurRange); - this.groupBox1.Controls.Add(this.btnSkipCurRange); - this.groupBox1.Location = new System.Drawing.Point(12, 18); + this.groupBox1.Location = new System.Drawing.Point(12, 21); this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3); this.groupBox1.Size = new System.Drawing.Size(780, 120); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; // + // toolStrip1 + // + this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.btnStart, + this.toolStripSeparator2, + this.comboConcurrent, + this.lblConcurrent, + this.comboTargetSpeed, + this.lblTargetSpeed, + this.toolStripSeparator1, + this.prgOveral, + this.toolStripLabel1, + this.toolStripSeparator3, + this.btnSkipCurRange, + this.prgCurRange, + this.toolStripLabel2}); + this.toolStrip1.Location = new System.Drawing.Point(3, 16); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; + this.toolStrip1.Size = new System.Drawing.Size(774, 33); + this.toolStrip1.TabIndex = 16; + this.toolStrip1.Text = "toolStrip1"; + // + // btnStart + // + this.btnStart.AutoSize = false; + this.btnStart.BackColor = System.Drawing.SystemColors.Control; + this.btnStart.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnStart.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuPauseScan}); + this.btnStart.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + this.btnStart.ForeColor = System.Drawing.SystemColors.ControlText; + this.btnStart.Image = ((System.Drawing.Image)(resources.GetObject("btnStart.Image"))); + this.btnStart.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnStart.Name = "btnStart"; + this.btnStart.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.btnStart.Size = new System.Drawing.Size(95, 30); + this.btnStart.Text = "Start Scan"; + this.btnStart.ToolTipText = "Scan in selected IP ranges of Cloudflare"; + this.btnStart.ButtonClick += new System.EventHandler(this.btnStart_ButtonClick); + this.btnStart.Click += new System.EventHandler(this.btnStart_Click); + // + // mnuPauseScan + // + this.mnuPauseScan.Name = "mnuPauseScan"; + this.mnuPauseScan.Size = new System.Drawing.Size(134, 22); + this.mnuPauseScan.Text = "Pause Scan"; + this.mnuPauseScan.Visible = false; + this.mnuPauseScan.Click += new System.EventHandler(this.mnuPauseScan_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 33); + // + // comboConcurrent + // + this.comboConcurrent.AutoSize = false; + this.comboConcurrent.DropDownWidth = 50; + this.comboConcurrent.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.comboConcurrent.Items.AddRange(new object[] { + "1", + "2", + "4", + "8", + "16", + "32"}); + this.comboConcurrent.Name = "comboConcurrent"; + this.comboConcurrent.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.comboConcurrent.Size = new System.Drawing.Size(50, 23); + this.comboConcurrent.Text = "4"; + this.comboConcurrent.ToolTipText = "Number of parallel scan processes"; + this.comboConcurrent.TextChanged += new System.EventHandler(this.comboConcurrent_TextChanged); + // + // lblConcurrent + // + this.lblConcurrent.Name = "lblConcurrent"; + this.lblConcurrent.Size = new System.Drawing.Size(67, 30); + this.lblConcurrent.Text = "Concurrent"; + // + // comboTargetSpeed + // + this.comboTargetSpeed.AutoSize = false; + this.comboTargetSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboTargetSpeed.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.comboTargetSpeed.Items.AddRange(new object[] { + "20 KB/s", + "50 KB/s", + "100 KB/s", + "200 KB/s", + "500 KB/s"}); + this.comboTargetSpeed.Name = "comboTargetSpeed"; + this.comboTargetSpeed.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.comboTargetSpeed.Size = new System.Drawing.Size(70, 23); + this.comboTargetSpeed.ToolTipText = "Target Speed"; + this.comboTargetSpeed.SelectedIndexChanged += new System.EventHandler(this.comboTargetSpeed_SelectedIndexChanged); + // + // lblTargetSpeed + // + this.lblTargetSpeed.Name = "lblTargetSpeed"; + this.lblTargetSpeed.Size = new System.Drawing.Size(74, 30); + this.lblTargetSpeed.Text = "Target Speed"; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 33); + // + // prgOveral + // + this.prgOveral.AutoSize = false; + this.prgOveral.Name = "prgOveral"; + this.prgOveral.Size = new System.Drawing.Size(100, 22); + this.prgOveral.ToolTipText = "Overal progress"; + // + // toolStripLabel1 + // + this.toolStripLabel1.Name = "toolStripLabel1"; + this.toolStripLabel1.Size = new System.Drawing.Size(41, 30); + this.toolStripLabel1.Text = "Overal"; + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(6, 33); + // + // btnSkipCurRange + // + this.btnSkipCurRange.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnSkipCurRange.Enabled = false; + this.btnSkipCurRange.Image = ((System.Drawing.Image)(resources.GetObject("btnSkipCurRange.Image"))); + this.btnSkipCurRange.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnSkipCurRange.Name = "btnSkipCurRange"; + this.btnSkipCurRange.Size = new System.Drawing.Size(33, 30); + this.btnSkipCurRange.Text = "Skip"; + this.btnSkipCurRange.ToolTipText = "Skip curent IP range"; + this.btnSkipCurRange.Click += new System.EventHandler(this.btnSkipCurRange_Click); + // + // prgCurRange + // + this.prgCurRange.AutoSize = false; + this.prgCurRange.Name = "prgCurRange"; + this.prgCurRange.Size = new System.Drawing.Size(100, 22); + this.prgCurRange.ToolTipText = "Current IP range progress"; + // + // toolStripLabel2 + // + this.toolStripLabel2.Name = "toolStripLabel2"; + this.toolStripLabel2.Size = new System.Drawing.Size(47, 30); + this.toolStripLabel2.Text = "Current"; + // // lblDebugMode // + this.lblDebugMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.lblDebugMode.AutoSize = true; - this.lblDebugMode.BackColor = System.Drawing.Color.White; + this.lblDebugMode.BackColor = System.Drawing.SystemColors.Control; this.lblDebugMode.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.lblDebugMode.ForeColor = System.Drawing.Color.Red; - this.lblDebugMode.Location = new System.Drawing.Point(272, 69); + this.lblDebugMode.Location = new System.Drawing.Point(550, 89); this.lblDebugMode.Name = "lblDebugMode"; this.lblDebugMode.Size = new System.Drawing.Size(143, 15); this.lblDebugMode.TabIndex = 13; @@ -233,7 +345,7 @@ private void InitializeComponent() this.linkGithub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.linkGithub.Image = global::WinCFScan.Properties.Resources.github_mark24; this.linkGithub.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.linkGithub.Location = new System.Drawing.Point(694, 85); + this.linkGithub.Location = new System.Drawing.Point(699, 86); this.linkGithub.Name = "linkGithub"; this.linkGithub.Size = new System.Drawing.Size(71, 23); this.linkGithub.TabIndex = 12; @@ -245,9 +357,10 @@ private void InitializeComponent() // // btnCopyFastestIP // - this.btnCopyFastestIP.Location = new System.Drawing.Point(545, 85); + this.btnCopyFastestIP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnCopyFastestIP.Location = new System.Drawing.Point(623, 55); this.btnCopyFastestIP.Name = "btnCopyFastestIP"; - this.btnCopyFastestIP.Size = new System.Drawing.Size(131, 25); + this.btnCopyFastestIP.Size = new System.Drawing.Size(151, 25); this.btnCopyFastestIP.TabIndex = 11; this.btnCopyFastestIP.Text = "Copy fastest IP"; this.btnCopyFastestIP.UseVisualStyleBackColor = true; @@ -255,57 +368,20 @@ private void InitializeComponent() // // txtFastestIP // + this.txtFastestIP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.txtFastestIP.BackColor = System.Drawing.Color.White; this.txtFastestIP.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.txtFastestIP.ForeColor = System.Drawing.Color.Green; - this.txtFastestIP.Location = new System.Drawing.Point(274, 85); + this.txtFastestIP.Location = new System.Drawing.Point(409, 57); this.txtFastestIP.Name = "txtFastestIP"; this.txtFastestIP.ReadOnly = true; - this.txtFastestIP.Size = new System.Drawing.Size(260, 23); + this.txtFastestIP.Size = new System.Drawing.Size(208, 23); this.txtFastestIP.TabIndex = 10; // - // lblFastestIP - // - this.lblFastestIP.AutoSize = true; - this.lblFastestIP.Location = new System.Drawing.Point(11, 88); - this.lblFastestIP.Name = "lblFastestIP"; - this.lblFastestIP.Size = new System.Drawing.Size(94, 15); - this.lblFastestIP.TabIndex = 9; - this.lblFastestIP.Text = "Fastest IP found:"; - // - // comboConcurrent - // - this.comboConcurrent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.comboConcurrent.FormattingEnabled = true; - this.comboConcurrent.Items.AddRange(new object[] { - "1", - "2", - "4", - "8", - "16", - "32"}); - this.comboConcurrent.Location = new System.Drawing.Point(621, 48); - this.comboConcurrent.Name = "comboConcurrent"; - this.comboConcurrent.Size = new System.Drawing.Size(55, 23); - this.comboConcurrent.TabIndex = 8; - this.comboConcurrent.Text = "4"; - this.toolTip1.SetToolTip(this.comboConcurrent, "Number of parallel scan processes"); - this.comboConcurrent.TextChanged += new System.EventHandler(this.comboConcurrent_TextChanged); - // - // lblConcurrent - // - this.lblConcurrent.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.lblConcurrent.AutoSize = true; - this.lblConcurrent.Location = new System.Drawing.Point(545, 52); - this.lblConcurrent.Name = "lblConcurrent"; - this.lblConcurrent.Size = new System.Drawing.Size(70, 15); - this.lblConcurrent.TabIndex = 7; - this.lblConcurrent.Text = "Concurrent:"; - // // lblTotalWorkingIPs // this.lblTotalWorkingIPs.AutoSize = true; - this.lblTotalWorkingIPs.Location = new System.Drawing.Point(11, 64); + this.lblTotalWorkingIPs.Location = new System.Drawing.Point(11, 94); this.lblTotalWorkingIPs.Name = "lblTotalWorkingIPs"; this.lblTotalWorkingIPs.Size = new System.Drawing.Size(108, 15); this.lblTotalWorkingIPs.TabIndex = 6; @@ -357,7 +433,8 @@ private void InitializeComponent() this.listResults.GridLines = true; this.listResults.Location = new System.Drawing.Point(0, 40); this.listResults.Name = "listResults"; - this.listResults.Size = new System.Drawing.Size(772, 188); + this.listResults.Size = new System.Drawing.Size(772, 186); + this.listResults.Sorting = System.Windows.Forms.SortOrder.Ascending; this.listResults.TabIndex = 4; this.listResults.UseCompatibleStateImageBehavior = false; this.listResults.View = System.Windows.Forms.View.Details; @@ -402,7 +479,7 @@ private void InitializeComponent() this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.splitContainer1.Location = new System.Drawing.Point(12, 146); + this.splitContainer1.Location = new System.Drawing.Point(12, 147); this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; // @@ -413,8 +490,8 @@ private void InitializeComponent() // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.txtLog); - this.splitContainer1.Size = new System.Drawing.Size(780, 445); - this.splitContainer1.SplitterDistance = 256; + this.splitContainer1.Size = new System.Drawing.Size(780, 444); + this.splitContainer1.SplitterDistance = 254; this.splitContainer1.TabIndex = 7; // // tabControl1 @@ -425,7 +502,7 @@ private void InitializeComponent() this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(780, 256); + this.tabControl1.Size = new System.Drawing.Size(780, 254); this.tabControl1.TabIndex = 9; // // tabPageCFRanges @@ -438,7 +515,7 @@ private void InitializeComponent() this.tabPageCFRanges.Location = new System.Drawing.Point(4, 24); this.tabPageCFRanges.Name = "tabPageCFRanges"; this.tabPageCFRanges.Padding = new System.Windows.Forms.Padding(3); - this.tabPageCFRanges.Size = new System.Drawing.Size(772, 228); + this.tabPageCFRanges.Size = new System.Drawing.Size(772, 226); this.tabPageCFRanges.TabIndex = 1; this.tabPageCFRanges.Text = "Cloudflare IP ranges"; this.tabPageCFRanges.UseVisualStyleBackColor = true; @@ -485,7 +562,7 @@ private void InitializeComponent() this.headTotalIPs}); this.listCFIPList.Location = new System.Drawing.Point(0, 38); this.listCFIPList.Name = "listCFIPList"; - this.listCFIPList.Size = new System.Drawing.Size(772, 190); + this.listCFIPList.Size = new System.Drawing.Size(772, 188); this.listCFIPList.TabIndex = 0; this.listCFIPList.UseCompatibleStateImageBehavior = false; this.listCFIPList.View = System.Windows.Forms.View.Details; @@ -513,7 +590,7 @@ private void InitializeComponent() this.tabPageResults.Location = new System.Drawing.Point(4, 24); this.tabPageResults.Name = "tabPageResults"; this.tabPageResults.Padding = new System.Windows.Forms.Padding(3); - this.tabPageResults.Size = new System.Drawing.Size(772, 228); + this.tabPageResults.Size = new System.Drawing.Size(772, 226); this.tabPageResults.TabIndex = 0; this.tabPageResults.Text = "Scan Results"; this.tabPageResults.UseVisualStyleBackColor = true; @@ -544,7 +621,6 @@ private void InitializeComponent() this.btnResultsActions.TabIndex = 8; this.btnResultsActions.Text = "Actions"; this.btnResultsActions.UseVisualStyleBackColor = true; - this.btnResultsActions.Click += new System.EventHandler(this.btnResultsActions_Click); this.btnResultsActions.MouseClick += new System.Windows.Forms.MouseEventHandler(this.btnResultsActions_MouseClick); // // mnuMain @@ -679,6 +755,8 @@ private void InitializeComponent() this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); this.mnuListView.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); @@ -699,16 +777,11 @@ private void InitializeComponent() } #endregion - - private Button btnStart; private TextBox txtLog; private System.Windows.Forms.Timer timerBase; private Label lblLastIPRange; private System.Windows.Forms.Timer timerProgress; private Label labelLastIPChecked; - private Button btnSkipCurRange; - private ProgressBar prgOveral; - private ProgressBar prgCurRange; private GroupBox groupBox1; private ToolTip toolTip1; private ListView listResults; @@ -719,11 +792,8 @@ private void InitializeComponent() private Button btnScanInPrevResults; private SplitContainer splitContainer1; private Label lblPrevResults; - private ComboBox comboConcurrent; - private Label lblConcurrent; private Button btnResultsActions; private TextBox txtFastestIP; - private Label lblFastestIP; private Button btnCopyFastestIP; private ContextMenuStrip mnuListView; private ToolStripMenuItem mnuListViewCopyIP; @@ -757,5 +827,20 @@ private void InitializeComponent() private ToolStripSeparator toolStripMenuItem1; private ToolStripMenuItem importScanResultsToolStripMenuItem; private ToolStripSeparator toolStripMenuItem2; + private ToolStrip toolStrip1; + private ToolStripComboBox comboConcurrent; + private ToolStripProgressBar prgOveral; + private ToolStripLabel lblConcurrent; + private ToolStripComboBox comboTargetSpeed; + private ToolStripLabel lblTargetSpeed; + private ToolStripProgressBar prgCurRange; + private ToolStripLabel toolStripLabel1; + private ToolStripLabel toolStripLabel2; + private ToolStripSeparator toolStripSeparator2; + private ToolStripSeparator toolStripSeparator1; + private ToolStripSplitButton btnStart; + private ToolStripMenuItem mnuPauseScan; + private ToolStripButton btnSkipCurRange; + private ToolStripSeparator toolStripSeparator3; } } \ No newline at end of file diff --git a/windows/frmMain.cs b/windows/frmMain.cs index 3b67de83..b3627cc8 100644 --- a/windows/frmMain.cs +++ b/windows/frmMain.cs @@ -54,6 +54,7 @@ public frmMain() scanEngine = new ScanEngine(); loadLastResultsComboList(); + comboTargetSpeed.SelectedIndex = 2; appVersion = AppUpdateChecker.getCurrentVersion(); @@ -110,7 +111,7 @@ private void btnScanInPrevResults_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e) { - startStopScan(false); + } private void startStopScan(bool inPrevResult = false) @@ -832,9 +833,19 @@ private void importScanResultsToolStripMenuItem_Click(object sender, EventArgs e importResults(); } - private void btnResultsActions_Click(object sender, EventArgs e) + private void comboTargetSpeed_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void mnuPauseScan_Click(object sender, EventArgs e) { } + + private void btnStart_ButtonClick(object sender, EventArgs e) + { + startStopScan(false); + } } } \ No newline at end of file diff --git a/windows/frmMain.resx b/windows/frmMain.resx index 5ebe98a5..f9ec48b3 100644 --- a/windows/frmMain.resx +++ b/windows/frmMain.resx @@ -57,15 +57,37 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 249, 17 - 17, 17 122, 17 + + 1002, 21 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb + J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj + CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN + AAAAAElFTkSuQmCC + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb + J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj + CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN + AAAAAElFTkSuQmCC + + + + 249, 17 + 346, 17 From 1babeff15c77002387234fc2400fbf50785bf61a Mon Sep 17 00:00:00 2001 From: goingfine Date: Fri, 3 Mar 2023 11:05:32 +0330 Subject: [PATCH 3/6] added option to choose target download speed --- windows/Classes/CheckIPWorking.cs | 11 +++++++---- windows/Classes/ScanEngine.cs | 3 ++- windows/frmMain.Designer.cs | 8 ++++---- windows/frmMain.cs | 13 ++++++++++++- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/windows/Classes/CheckIPWorking.cs b/windows/Classes/CheckIPWorking.cs index cb410dfa..a7fb85b8 100644 --- a/windows/Classes/CheckIPWorking.cs +++ b/windows/Classes/CheckIPWorking.cs @@ -17,12 +17,14 @@ internal class CheckIPWorking private string port; private string v2rayConfigPath; public long downloadDuration { get; private set; } + private ScanSpeed targetSpeed; - public CheckIPWorking(string ip) + public CheckIPWorking(string ip, ScanSpeed targetSpeed) { this.ip = ip; this.port = getPortByIP(); v2rayConfigPath = $"v2ray-config/generated/config.{ip}.json"; + this.targetSpeed = targetSpeed; } public CheckIPWorking() @@ -116,19 +118,20 @@ private bool checkDownloadSpeed() Proxy = proxy }; + int timeout = 2; var client = new HttpClient(handler); - client.Timeout = TimeSpan.FromSeconds(2); // 2 seconds + client.Timeout = TimeSpan.FromSeconds(timeout); // 2 seconds Tools.logStep($"Start check dl speed, proxy port: {port}, timeout: {client.Timeout.TotalSeconds} sec"); Stopwatch sw = new Stopwatch(); try { sw.Start(); - string dlUrl = "https://" + ConfigManager.Instance.getAppConfig().scanDomain + "100000"; + string dlUrl = "https://" + ConfigManager.Instance.getAppConfig().scanDomain + targetSpeed.getTargetFileSize(timeout); Tools.logStep($"Starting dl url: {dlUrl}"); var data = client.GetStringAsync(dlUrl).Result; Tools.logStep($"*** Download success in {sw.ElapsedMilliseconds:n0} ms, dl size: {data.Length:n0} bytes for IP {ip}"); - return data.Length > 90_000; + return data.Length == targetSpeed.getTargetSpeed() * timeout; } catch (Exception ex) { diff --git a/windows/Classes/ScanEngine.cs b/windows/Classes/ScanEngine.cs index aacf58cd..e2cf5ed0 100644 --- a/windows/Classes/ScanEngine.cs +++ b/windows/Classes/ScanEngine.cs @@ -23,6 +23,7 @@ internal class ScanEngine private CancellationTokenSource cts; public List? workingIPsFromPrevScan { get; set; } public int concurrentProcess = 4; + public ScanSpeed targetSpeed; public ScanEngine() { @@ -135,7 +136,7 @@ private void parallelScan(List ipRange) { Parallel.ForEach(ipRange, po, (ip) => { - var checker = new CheckIPWorking(ip); + var checker = new CheckIPWorking(ip, targetSpeed); bool isOK = checker.check(); progressInfo.lastCheckedIP = ip; diff --git a/windows/frmMain.Designer.cs b/windows/frmMain.Designer.cs index 6af5164a..66ddeadf 100644 --- a/windows/frmMain.Designer.cs +++ b/windows/frmMain.Designer.cs @@ -301,12 +301,13 @@ private void InitializeComponent() // // btnSkipCurRange // + this.btnSkipCurRange.AutoSize = false; this.btnSkipCurRange.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.btnSkipCurRange.Enabled = false; this.btnSkipCurRange.Image = ((System.Drawing.Image)(resources.GetObject("btnSkipCurRange.Image"))); this.btnSkipCurRange.ImageTransparentColor = System.Drawing.Color.Magenta; this.btnSkipCurRange.Name = "btnSkipCurRange"; - this.btnSkipCurRange.Size = new System.Drawing.Size(33, 30); + this.btnSkipCurRange.Size = new System.Drawing.Size(33, 23); this.btnSkipCurRange.Text = "Skip"; this.btnSkipCurRange.ToolTipText = "Skip curent IP range"; this.btnSkipCurRange.Click += new System.EventHandler(this.btnSkipCurRange_Click); @@ -331,7 +332,7 @@ private void InitializeComponent() this.lblDebugMode.BackColor = System.Drawing.SystemColors.Control; this.lblDebugMode.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.lblDebugMode.ForeColor = System.Drawing.Color.Red; - this.lblDebugMode.Location = new System.Drawing.Point(550, 89); + this.lblDebugMode.Location = new System.Drawing.Point(550, 91); this.lblDebugMode.Name = "lblDebugMode"; this.lblDebugMode.Size = new System.Drawing.Size(143, 15); this.lblDebugMode.TabIndex = 13; @@ -345,7 +346,7 @@ private void InitializeComponent() this.linkGithub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.linkGithub.Image = global::WinCFScan.Properties.Resources.github_mark24; this.linkGithub.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.linkGithub.Location = new System.Drawing.Point(699, 86); + this.linkGithub.Location = new System.Drawing.Point(699, 88); this.linkGithub.Name = "linkGithub"; this.linkGithub.Size = new System.Drawing.Size(71, 23); this.linkGithub.TabIndex = 12; @@ -434,7 +435,6 @@ private void InitializeComponent() this.listResults.Location = new System.Drawing.Point(0, 40); this.listResults.Name = "listResults"; this.listResults.Size = new System.Drawing.Size(772, 186); - this.listResults.Sorting = System.Windows.Forms.SortOrder.Ascending; this.listResults.TabIndex = 4; this.listResults.UseCompatibleStateImageBehavior = false; this.listResults.View = System.Windows.Forms.View.Details; diff --git a/windows/frmMain.cs b/windows/frmMain.cs index b3627cc8..4435fed7 100644 --- a/windows/frmMain.cs +++ b/windows/frmMain.cs @@ -125,6 +125,7 @@ private void startStopScan(bool inPrevResult = false) if (isScanRunning()) { // stop scan + btnStart.Enabled= false; waitUntilScannerStoped(); updateUIControlls(false); } @@ -157,6 +158,7 @@ private void startStopScan(bool inPrevResult = false) updateUIControlls(true); scanEngine.workingIPsFromPrevScan = inPrevResult ? currentScanResults : null; + scanEngine.targetSpeed = getTargetSpeed(); // set target speed var scanType = inPrevResult ? ScanType.SCAN_IN_PERV_RESULTS : ScanType.SCAN_CLOUDFLARE_IPS; // start scan job in new thread @@ -182,6 +184,7 @@ private void updateUIControlls(bool isStarting) btnScanInPrevResults.Enabled = false; btnResultsActions.Enabled = false; comboConcurrent.Enabled = false; + comboTargetSpeed.Enabled = false; timerProgress.Enabled = true; btnSkipCurRange.Enabled = true; comboResults.Enabled = false; @@ -190,6 +193,7 @@ private void updateUIControlls(bool isStarting) else { // is stopping btnStart.Text = "Start Scan"; + btnStart.Enabled = true; btnScanInPrevResults.Enabled = true; btnResultsActions.Enabled = true; timerProgress.Enabled = false; @@ -199,6 +203,7 @@ private void updateUIControlls(bool isStarting) { comboConcurrent.Enabled = true; } + comboTargetSpeed.Enabled = true; tabPageCFRanges.Enabled = true; // save result file if found working IPs @@ -564,7 +569,7 @@ private void mnuListViewTestThisIPAddress_Click(object sender, EventArgs e) private void testSingleIP(string IPAddress) { addTextLog($"Testing {IPAddress} ..."); - var checker = new CheckIPWorking(IPAddress); + var checker = new CheckIPWorking(IPAddress, getTargetSpeed()); var success = checker.check(); if (success) addTextLog($"{IPAddress} is working. Delay: {checker.downloadDuration:n0} ms."); @@ -572,6 +577,12 @@ private void testSingleIP(string IPAddress) addTextLog($"{IPAddress} is NOT working."); } + private ScanSpeed getTargetSpeed() + { + int speed = int.Parse(comboTargetSpeed.SelectedItem.ToString().Replace(" KB/s", "")); + return new ScanSpeed(speed); + } + private string? getSelectedIPAddress() { try From 0c19e09841f6b96ebeba0e9ecaafe364da8d7f15 Mon Sep 17 00:00:00 2001 From: goingfine Date: Fri, 3 Mar 2023 11:46:29 +0330 Subject: [PATCH 4/6] added check for update --- windows/Classes/AppUpdateChecker.cs | 13 +++++++---- windows/Classes/CheckIPWorking.cs | 2 +- windows/frmMain.Designer.cs | 12 +++++++++- windows/frmMain.cs | 36 ++++++++++++++++++++++------- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/windows/Classes/AppUpdateChecker.cs b/windows/Classes/AppUpdateChecker.cs index b02a00ca..a9132dcc 100644 --- a/windows/Classes/AppUpdateChecker.cs +++ b/windows/Classes/AppUpdateChecker.cs @@ -17,6 +17,7 @@ internal class AppUpdateChecker private string remoteVersionUrl = "https://raw.githubusercontent.com/MortezaBashsiz/CFScanner/main/windows/Properties/latest-version"; private string localVersionFileName = "local-version"; private bool foundNewVersion = false; + public UpdateCheckResult updateCheckResult; public static Version getCurrentVersion() { @@ -33,12 +34,14 @@ public UpdateCheckResult check() if(getRemoteVersion()) { foundNewVersion = isNewVersionAvailable(); - return foundNewVersion ? UpdateCheckResult.NewVersionAvailable : UpdateCheckResult.NewVersionAvailable; + updateCheckResult = foundNewVersion ? UpdateCheckResult.NewVersionAvailable : UpdateCheckResult.NewVersionAvailable; } else { - return UpdateCheckResult.HasError; + updateCheckResult = UpdateCheckResult.HasError; } + + return updateCheckResult; } public bool isFoundNewVersion() @@ -71,10 +74,10 @@ private bool isRemoteVersionValid() // return true if remote version is higher private bool compareVersions() { - var remoteV = remoteVersion.Substring(2).Split(".").Sum(p => Convert.ToUInt32(p)); - var localV = localVersion.Split(".").Sum(p => Convert.ToUInt32(p)); + var remoteV = new Version(remoteVersion.Substring(2)); + var localV = new Version(localVersion); - return remoteV > localV; + return remoteV.CompareTo(localV) == 1; } private bool isFileOld(string file) diff --git a/windows/Classes/CheckIPWorking.cs b/windows/Classes/CheckIPWorking.cs index a7fb85b8..e1198832 100644 --- a/windows/Classes/CheckIPWorking.cs +++ b/windows/Classes/CheckIPWorking.cs @@ -121,7 +121,7 @@ private bool checkDownloadSpeed() int timeout = 2; var client = new HttpClient(handler); client.Timeout = TimeSpan.FromSeconds(timeout); // 2 seconds - Tools.logStep($"Start check dl speed, proxy port: {port}, timeout: {client.Timeout.TotalSeconds} sec"); + Tools.logStep($"Start check dl speed, proxy port: {port}, timeout: {timeout} sec, target speed: {targetSpeed.getTargetSpeed():n0} b/s"); Stopwatch sw = new Stopwatch(); try { diff --git a/windows/frmMain.Designer.cs b/windows/frmMain.Designer.cs index 66ddeadf..dc0de35e 100644 --- a/windows/frmMain.Designer.cs +++ b/windows/frmMain.Designer.cs @@ -95,6 +95,7 @@ private void InitializeComponent() this.exportResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.importResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.checkForUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.mnuListView.SuspendLayout(); @@ -688,7 +689,8 @@ private void InitializeComponent() // toolsToolStripMenuItem // this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.scanASingleIPAddressToolStripMenuItem}); + this.scanASingleIPAddressToolStripMenuItem, + this.checkForUpdateToolStripMenuItem}); this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; this.toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20); this.toolsToolStripMenuItem.Text = "Tools"; @@ -741,6 +743,13 @@ private void InitializeComponent() this.deleteResultsToolStripMenuItem.Text = "Delete results"; this.deleteResultsToolStripMenuItem.Click += new System.EventHandler(this.deleteResultsToolStripMenuItem_Click); // + // checkForUpdateToolStripMenuItem + // + this.checkForUpdateToolStripMenuItem.Name = "checkForUpdateToolStripMenuItem"; + this.checkForUpdateToolStripMenuItem.Size = new System.Drawing.Size(193, 22); + this.checkForUpdateToolStripMenuItem.Text = "Check for update"; + this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click); + // // frmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -842,5 +851,6 @@ private void InitializeComponent() private ToolStripMenuItem mnuPauseScan; private ToolStripButton btnSkipCurRange; private ToolStripSeparator toolStripSeparator3; + private ToolStripMenuItem checkForUpdateToolStripMenuItem; } } \ No newline at end of file diff --git a/windows/frmMain.cs b/windows/frmMain.cs index 4435fed7..5836aa01 100644 --- a/windows/frmMain.cs +++ b/windows/frmMain.cs @@ -388,20 +388,34 @@ private void oneTimeChecks() // check for updates if (appUpdateChecker.shouldCheck()) { - Task.Factory.StartNew(() => appUpdateChecker.check()) - .ContinueWith(done => - { - if(appUpdateChecker.isFoundNewVersion()) - { - addTextLog($"There is a new version available ({appUpdateChecker.getUpdateVersion()}) Download it from here: {ourGitHubUrl}/releases"); - } - }); + checkForUpdate(); } oneTimeChecked = true; } } + // check for update + private void checkForUpdate(bool logNoNewVersion = false) + { + Task.Factory.StartNew(() => { appUpdateChecker.check(); }) + .ContinueWith(done => + { + if (appUpdateChecker.isFoundNewVersion()) + { + addTextLog($"There is a new version available ({appUpdateChecker.getUpdateVersion()}) Download it from here: {ourGitHubUrl}/releases"); + } + else if(appUpdateChecker.updateCheckResult == UpdateCheckResult.HasError) + { + addTextLog("Something went wrong while checking for update!"); + } + else if(logNoNewVersion) + { + addTextLog("Everything is up to date."); + } + }); + } + private void comboConcurrent_TextChanged(object sender, EventArgs e) { var con = getConcurentProcess(); @@ -858,5 +872,11 @@ private void btnStart_ButtonClick(object sender, EventArgs e) { startStopScan(false); } + + private void checkForUpdateToolStripMenuItem_Click(object sender, EventArgs e) + { + addTextLog("Checking for new version..."); + checkForUpdate(true); + } } } \ No newline at end of file From 8299263784cada383bd390b8c6e77898abce4437 Mon Sep 17 00:00:00 2001 From: goingfine Date: Fri, 3 Mar 2023 12:45:31 +0330 Subject: [PATCH 5/6] added option to choose target download speed --- windows/Classes/ScanSpeed.cs | 28 +++++++++++++++++ windows/frmMain.Designer.cs | 59 ++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 29 deletions(-) create mode 100644 windows/Classes/ScanSpeed.cs diff --git a/windows/Classes/ScanSpeed.cs b/windows/Classes/ScanSpeed.cs new file mode 100644 index 00000000..f4d9f37e --- /dev/null +++ b/windows/Classes/ScanSpeed.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinCFScan.Classes +{ + internal class ScanSpeed + { + private int targetSpeed; + + public ScanSpeed(int speed) + { + targetSpeed = speed; + } + + public string getTargetFileSize(int dlDuration = 2) + { + return (targetSpeed * 1000 * dlDuration).ToString(); + } + + public int getTargetSpeed() + { + return targetSpeed * 1000; + } + } +} diff --git a/windows/frmMain.Designer.cs b/windows/frmMain.Designer.cs index dc0de35e..f8d035a0 100644 --- a/windows/frmMain.Designer.cs +++ b/windows/frmMain.Designer.cs @@ -89,13 +89,13 @@ private void InitializeComponent() this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.scanASingleIPAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.checkForUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.mnuResultsActions = new System.Windows.Forms.ContextMenuStrip(this.components); this.exportResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.importResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.deleteResultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.checkForUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.mnuListView.SuspendLayout(); @@ -121,7 +121,7 @@ private void InitializeComponent() this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(780, 186); + this.txtLog.Size = new System.Drawing.Size(723, 186); this.txtLog.TabIndex = 1; this.txtLog.Text = "Welcome to Cloudflare IP Scanner.\r\n"; // @@ -169,7 +169,7 @@ private void InitializeComponent() this.groupBox1.Location = new System.Drawing.Point(12, 21); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3); - this.groupBox1.Size = new System.Drawing.Size(780, 120); + this.groupBox1.Size = new System.Drawing.Size(723, 120); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; // @@ -193,7 +193,7 @@ private void InitializeComponent() this.toolStrip1.Location = new System.Drawing.Point(3, 16); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.toolStrip1.Size = new System.Drawing.Size(774, 33); + this.toolStrip1.Size = new System.Drawing.Size(717, 33); this.toolStrip1.TabIndex = 16; this.toolStrip1.Text = "toolStrip1"; // @@ -333,7 +333,7 @@ private void InitializeComponent() this.lblDebugMode.BackColor = System.Drawing.SystemColors.Control; this.lblDebugMode.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.lblDebugMode.ForeColor = System.Drawing.Color.Red; - this.lblDebugMode.Location = new System.Drawing.Point(550, 91); + this.lblDebugMode.Location = new System.Drawing.Point(493, 91); this.lblDebugMode.Name = "lblDebugMode"; this.lblDebugMode.Size = new System.Drawing.Size(143, 15); this.lblDebugMode.TabIndex = 13; @@ -347,7 +347,7 @@ private void InitializeComponent() this.linkGithub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.linkGithub.Image = global::WinCFScan.Properties.Resources.github_mark24; this.linkGithub.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.linkGithub.Location = new System.Drawing.Point(699, 88); + this.linkGithub.Location = new System.Drawing.Point(642, 88); this.linkGithub.Name = "linkGithub"; this.linkGithub.Size = new System.Drawing.Size(71, 23); this.linkGithub.TabIndex = 12; @@ -360,10 +360,10 @@ private void InitializeComponent() // btnCopyFastestIP // this.btnCopyFastestIP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnCopyFastestIP.Location = new System.Drawing.Point(623, 55); + this.btnCopyFastestIP.Location = new System.Drawing.Point(566, 55); this.btnCopyFastestIP.Name = "btnCopyFastestIP"; this.btnCopyFastestIP.Size = new System.Drawing.Size(151, 25); - this.btnCopyFastestIP.TabIndex = 11; + this.btnCopyFastestIP.TabIndex = 10; this.btnCopyFastestIP.Text = "Copy fastest IP"; this.btnCopyFastestIP.UseVisualStyleBackColor = true; this.btnCopyFastestIP.Click += new System.EventHandler(this.btnCopyFastestIP_Click); @@ -374,11 +374,12 @@ private void InitializeComponent() this.txtFastestIP.BackColor = System.Drawing.Color.White; this.txtFastestIP.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.txtFastestIP.ForeColor = System.Drawing.Color.Green; - this.txtFastestIP.Location = new System.Drawing.Point(409, 57); + this.txtFastestIP.Location = new System.Drawing.Point(352, 57); this.txtFastestIP.Name = "txtFastestIP"; + this.txtFastestIP.PlaceholderText = "Fastest IP"; this.txtFastestIP.ReadOnly = true; this.txtFastestIP.Size = new System.Drawing.Size(208, 23); - this.txtFastestIP.TabIndex = 10; + this.txtFastestIP.TabIndex = 11; // // lblTotalWorkingIPs // @@ -414,7 +415,7 @@ private void InitializeComponent() // btnLoadIPRanges // this.btnLoadIPRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnLoadIPRanges.Location = new System.Drawing.Point(481, 8); + this.btnLoadIPRanges.Location = new System.Drawing.Point(424, 8); this.btnLoadIPRanges.Name = "btnLoadIPRanges"; this.btnLoadIPRanges.Size = new System.Drawing.Size(94, 23); this.btnLoadIPRanges.TabIndex = 4; @@ -435,7 +436,7 @@ private void InitializeComponent() this.listResults.GridLines = true; this.listResults.Location = new System.Drawing.Point(0, 40); this.listResults.Name = "listResults"; - this.listResults.Size = new System.Drawing.Size(772, 186); + this.listResults.Size = new System.Drawing.Size(715, 186); this.listResults.TabIndex = 4; this.listResults.UseCompatibleStateImageBehavior = false; this.listResults.View = System.Windows.Forms.View.Details; @@ -491,7 +492,7 @@ private void InitializeComponent() // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.txtLog); - this.splitContainer1.Size = new System.Drawing.Size(780, 444); + this.splitContainer1.Size = new System.Drawing.Size(723, 444); this.splitContainer1.SplitterDistance = 254; this.splitContainer1.TabIndex = 7; // @@ -503,7 +504,7 @@ private void InitializeComponent() this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(780, 254); + this.tabControl1.Size = new System.Drawing.Size(723, 254); this.tabControl1.TabIndex = 9; // // tabPageCFRanges @@ -516,7 +517,7 @@ private void InitializeComponent() this.tabPageCFRanges.Location = new System.Drawing.Point(4, 24); this.tabPageCFRanges.Name = "tabPageCFRanges"; this.tabPageCFRanges.Padding = new System.Windows.Forms.Padding(3); - this.tabPageCFRanges.Size = new System.Drawing.Size(772, 226); + this.tabPageCFRanges.Size = new System.Drawing.Size(715, 226); this.tabPageCFRanges.TabIndex = 1; this.tabPageCFRanges.Text = "Cloudflare IP ranges"; this.tabPageCFRanges.UseVisualStyleBackColor = true; @@ -533,7 +534,7 @@ private void InitializeComponent() // btnSelectNoneIPRanges // this.btnSelectNoneIPRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnSelectNoneIPRanges.Location = new System.Drawing.Point(581, 9); + this.btnSelectNoneIPRanges.Location = new System.Drawing.Point(524, 9); this.btnSelectNoneIPRanges.Name = "btnSelectNoneIPRanges"; this.btnSelectNoneIPRanges.Size = new System.Drawing.Size(88, 23); this.btnSelectNoneIPRanges.TabIndex = 2; @@ -544,7 +545,7 @@ private void InitializeComponent() // btnSelectAllIPRanges // this.btnSelectAllIPRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnSelectAllIPRanges.Location = new System.Drawing.Point(678, 9); + this.btnSelectAllIPRanges.Location = new System.Drawing.Point(621, 9); this.btnSelectAllIPRanges.Name = "btnSelectAllIPRanges"; this.btnSelectAllIPRanges.Size = new System.Drawing.Size(88, 23); this.btnSelectAllIPRanges.TabIndex = 1; @@ -563,7 +564,7 @@ private void InitializeComponent() this.headTotalIPs}); this.listCFIPList.Location = new System.Drawing.Point(0, 38); this.listCFIPList.Name = "listCFIPList"; - this.listCFIPList.Size = new System.Drawing.Size(772, 188); + this.listCFIPList.Size = new System.Drawing.Size(715, 188); this.listCFIPList.TabIndex = 0; this.listCFIPList.UseCompatibleStateImageBehavior = false; this.listCFIPList.View = System.Windows.Forms.View.Details; @@ -591,7 +592,7 @@ private void InitializeComponent() this.tabPageResults.Location = new System.Drawing.Point(4, 24); this.tabPageResults.Name = "tabPageResults"; this.tabPageResults.Padding = new System.Windows.Forms.Padding(3); - this.tabPageResults.Size = new System.Drawing.Size(772, 226); + this.tabPageResults.Size = new System.Drawing.Size(715, 226); this.tabPageResults.TabIndex = 0; this.tabPageResults.Text = "Scan Results"; this.tabPageResults.UseVisualStyleBackColor = true; @@ -631,7 +632,7 @@ private void InitializeComponent() this.toolsToolStripMenuItem}); this.mnuMain.Location = new System.Drawing.Point(0, 0); this.mnuMain.Name = "mnuMain"; - this.mnuMain.Size = new System.Drawing.Size(804, 24); + this.mnuMain.Size = new System.Drawing.Size(747, 24); this.mnuMain.TabIndex = 8; this.mnuMain.Text = "menuStrip1"; // @@ -702,6 +703,13 @@ private void InitializeComponent() this.scanASingleIPAddressToolStripMenuItem.Text = "Test a single IP address"; this.scanASingleIPAddressToolStripMenuItem.Click += new System.EventHandler(this.scanASingleIPAddressToolStripMenuItem_Click); // + // checkForUpdateToolStripMenuItem + // + this.checkForUpdateToolStripMenuItem.Name = "checkForUpdateToolStripMenuItem"; + this.checkForUpdateToolStripMenuItem.Size = new System.Drawing.Size(193, 22); + this.checkForUpdateToolStripMenuItem.Text = "Check for update"; + this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click); + // // openFileDialog1 // this.openFileDialog1.FileName = "openFileDialog1"; @@ -743,22 +751,15 @@ private void InitializeComponent() this.deleteResultsToolStripMenuItem.Text = "Delete results"; this.deleteResultsToolStripMenuItem.Click += new System.EventHandler(this.deleteResultsToolStripMenuItem_Click); // - // checkForUpdateToolStripMenuItem - // - this.checkForUpdateToolStripMenuItem.Name = "checkForUpdateToolStripMenuItem"; - this.checkForUpdateToolStripMenuItem.Size = new System.Drawing.Size(193, 22); - this.checkForUpdateToolStripMenuItem.Text = "Check for update"; - this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click); - // // frmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(804, 599); + this.ClientSize = new System.Drawing.Size(747, 599); this.Controls.Add(this.mnuMain); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.groupBox1); - this.MinimumSize = new System.Drawing.Size(820, 480); + this.MinimumSize = new System.Drawing.Size(760, 480); this.Name = "frmMain"; this.Text = "Cloudflare Scan"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing); From bf2638e16c25fd4bbdeed00f6d74d399322f7096 Mon Sep 17 00:00:00 2001 From: goingfine Date: Fri, 3 Mar 2023 18:34:07 +0330 Subject: [PATCH 6/6] some fixes --- windows/assets/v2ray-config/ClientConfig.json | 2 - .../assets/v2ray-config/config.json.template | 6 +- windows/frmMain.Designer.cs | 74 +++++++++++-------- windows/frmMain.cs | 9 ++- 4 files changed, 56 insertions(+), 35 deletions(-) diff --git a/windows/assets/v2ray-config/ClientConfig.json b/windows/assets/v2ray-config/ClientConfig.json index d7d7a22e..7e92a82d 100644 --- a/windows/assets/v2ray-config/ClientConfig.json +++ b/windows/assets/v2ray-config/ClientConfig.json @@ -4,7 +4,5 @@ "Port": "443", "path": "api01", "serverName": "248ecb72-89cf-5be7-923f-b790fca681c5.sudoer.net", - "frontDomain": "fronting.sudoer.net", - "scanDomain": "scan.sudoer.net", "subnetsList": "https://raw.githubusercontent.com/MortezaBashsiz/CFScanner/main/bash/cf.local.iplist" } diff --git a/windows/assets/v2ray-config/config.json.template b/windows/assets/v2ray-config/config.json.template index 9180816e..eeae709b 100644 --- a/windows/assets/v2ray-config/config.json.template +++ b/windows/assets/v2ray-config/config.json.template @@ -35,7 +35,11 @@ }, "tlsSettings": { "serverName": "RANDOMHOST", - "allowInsecure": false + "allowInsecure": false, + "fingerprint": "chrome", + "alpn": [ + "http/1.1" + ] } } }], diff --git a/windows/frmMain.Designer.cs b/windows/frmMain.Designer.cs index f8d035a0..11e4b8c2 100644 --- a/windows/frmMain.Designer.cs +++ b/windows/frmMain.Designer.cs @@ -44,10 +44,11 @@ private void InitializeComponent() this.lblConcurrent = new System.Windows.Forms.ToolStripLabel(); this.comboTargetSpeed = new System.Windows.Forms.ToolStripComboBox(); this.lblTargetSpeed = new System.Windows.Forms.ToolStripLabel(); + this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox(); + this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.prgOveral = new System.Windows.Forms.ToolStripProgressBar(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.btnSkipCurRange = new System.Windows.Forms.ToolStripButton(); this.prgCurRange = new System.Windows.Forms.ToolStripProgressBar(); this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); @@ -121,7 +122,7 @@ private void InitializeComponent() this.txtLog.Name = "txtLog"; this.txtLog.ReadOnly = true; this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtLog.Size = new System.Drawing.Size(723, 186); + this.txtLog.Size = new System.Drawing.Size(690, 186); this.txtLog.TabIndex = 1; this.txtLog.Text = "Welcome to Cloudflare IP Scanner.\r\n"; // @@ -169,7 +170,7 @@ private void InitializeComponent() this.groupBox1.Location = new System.Drawing.Point(12, 21); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3); - this.groupBox1.Size = new System.Drawing.Size(723, 120); + this.groupBox1.Size = new System.Drawing.Size(690, 120); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; // @@ -183,17 +184,18 @@ private void InitializeComponent() this.lblConcurrent, this.comboTargetSpeed, this.lblTargetSpeed, + this.toolStripComboBox1, + this.toolStripLabel3, this.toolStripSeparator1, this.prgOveral, this.toolStripLabel1, - this.toolStripSeparator3, this.btnSkipCurRange, this.prgCurRange, this.toolStripLabel2}); this.toolStrip1.Location = new System.Drawing.Point(3, 16); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; - this.toolStrip1.Size = new System.Drawing.Size(717, 33); + this.toolStrip1.Size = new System.Drawing.Size(684, 33); this.toolStrip1.TabIndex = 16; this.toolStrip1.Text = "toolStrip1"; // @@ -277,6 +279,24 @@ private void InitializeComponent() this.lblTargetSpeed.Size = new System.Drawing.Size(74, 30); this.lblTargetSpeed.Text = "Target Speed"; // + // toolStripComboBox1 + // + this.toolStripComboBox1.AutoSize = false; + this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.toolStripComboBox1.Items.AddRange(new object[] { + "Default"}); + this.toolStripComboBox1.Name = "toolStripComboBox1"; + this.toolStripComboBox1.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.toolStripComboBox1.Size = new System.Drawing.Size(90, 23); + this.toolStripComboBox1.Visible = false; + // + // toolStripLabel3 + // + this.toolStripLabel3.Name = "toolStripLabel3"; + this.toolStripLabel3.Size = new System.Drawing.Size(43, 30); + this.toolStripLabel3.Text = "Config"; + this.toolStripLabel3.Visible = false; + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; @@ -286,7 +306,7 @@ private void InitializeComponent() // this.prgOveral.AutoSize = false; this.prgOveral.Name = "prgOveral"; - this.prgOveral.Size = new System.Drawing.Size(100, 22); + this.prgOveral.Size = new System.Drawing.Size(90, 22); this.prgOveral.ToolTipText = "Overal progress"; // // toolStripLabel1 @@ -295,11 +315,6 @@ private void InitializeComponent() this.toolStripLabel1.Size = new System.Drawing.Size(41, 30); this.toolStripLabel1.Text = "Overal"; // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(6, 33); - // // btnSkipCurRange // this.btnSkipCurRange.AutoSize = false; @@ -317,7 +332,7 @@ private void InitializeComponent() // this.prgCurRange.AutoSize = false; this.prgCurRange.Name = "prgCurRange"; - this.prgCurRange.Size = new System.Drawing.Size(100, 22); + this.prgCurRange.Size = new System.Drawing.Size(90, 22); this.prgCurRange.ToolTipText = "Current IP range progress"; // // toolStripLabel2 @@ -333,7 +348,7 @@ private void InitializeComponent() this.lblDebugMode.BackColor = System.Drawing.SystemColors.Control; this.lblDebugMode.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.lblDebugMode.ForeColor = System.Drawing.Color.Red; - this.lblDebugMode.Location = new System.Drawing.Point(493, 91); + this.lblDebugMode.Location = new System.Drawing.Point(460, 91); this.lblDebugMode.Name = "lblDebugMode"; this.lblDebugMode.Size = new System.Drawing.Size(143, 15); this.lblDebugMode.TabIndex = 13; @@ -347,7 +362,7 @@ private void InitializeComponent() this.linkGithub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.linkGithub.Image = global::WinCFScan.Properties.Resources.github_mark24; this.linkGithub.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.linkGithub.Location = new System.Drawing.Point(642, 88); + this.linkGithub.Location = new System.Drawing.Point(609, 88); this.linkGithub.Name = "linkGithub"; this.linkGithub.Size = new System.Drawing.Size(71, 23); this.linkGithub.TabIndex = 12; @@ -360,7 +375,7 @@ private void InitializeComponent() // btnCopyFastestIP // this.btnCopyFastestIP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnCopyFastestIP.Location = new System.Drawing.Point(566, 55); + this.btnCopyFastestIP.Location = new System.Drawing.Point(533, 55); this.btnCopyFastestIP.Name = "btnCopyFastestIP"; this.btnCopyFastestIP.Size = new System.Drawing.Size(151, 25); this.btnCopyFastestIP.TabIndex = 10; @@ -374,7 +389,7 @@ private void InitializeComponent() this.txtFastestIP.BackColor = System.Drawing.Color.White; this.txtFastestIP.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); this.txtFastestIP.ForeColor = System.Drawing.Color.Green; - this.txtFastestIP.Location = new System.Drawing.Point(352, 57); + this.txtFastestIP.Location = new System.Drawing.Point(319, 57); this.txtFastestIP.Name = "txtFastestIP"; this.txtFastestIP.PlaceholderText = "Fastest IP"; this.txtFastestIP.ReadOnly = true; @@ -415,7 +430,7 @@ private void InitializeComponent() // btnLoadIPRanges // this.btnLoadIPRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnLoadIPRanges.Location = new System.Drawing.Point(424, 8); + this.btnLoadIPRanges.Location = new System.Drawing.Point(391, 8); this.btnLoadIPRanges.Name = "btnLoadIPRanges"; this.btnLoadIPRanges.Size = new System.Drawing.Size(94, 23); this.btnLoadIPRanges.TabIndex = 4; @@ -436,7 +451,7 @@ private void InitializeComponent() this.listResults.GridLines = true; this.listResults.Location = new System.Drawing.Point(0, 40); this.listResults.Name = "listResults"; - this.listResults.Size = new System.Drawing.Size(715, 186); + this.listResults.Size = new System.Drawing.Size(712, 186); this.listResults.TabIndex = 4; this.listResults.UseCompatibleStateImageBehavior = false; this.listResults.View = System.Windows.Forms.View.Details; @@ -492,7 +507,7 @@ private void InitializeComponent() // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.txtLog); - this.splitContainer1.Size = new System.Drawing.Size(723, 444); + this.splitContainer1.Size = new System.Drawing.Size(690, 444); this.splitContainer1.SplitterDistance = 254; this.splitContainer1.TabIndex = 7; // @@ -504,7 +519,7 @@ private void InitializeComponent() this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(723, 254); + this.tabControl1.Size = new System.Drawing.Size(690, 254); this.tabControl1.TabIndex = 9; // // tabPageCFRanges @@ -517,7 +532,7 @@ private void InitializeComponent() this.tabPageCFRanges.Location = new System.Drawing.Point(4, 24); this.tabPageCFRanges.Name = "tabPageCFRanges"; this.tabPageCFRanges.Padding = new System.Windows.Forms.Padding(3); - this.tabPageCFRanges.Size = new System.Drawing.Size(715, 226); + this.tabPageCFRanges.Size = new System.Drawing.Size(682, 226); this.tabPageCFRanges.TabIndex = 1; this.tabPageCFRanges.Text = "Cloudflare IP ranges"; this.tabPageCFRanges.UseVisualStyleBackColor = true; @@ -534,7 +549,7 @@ private void InitializeComponent() // btnSelectNoneIPRanges // this.btnSelectNoneIPRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnSelectNoneIPRanges.Location = new System.Drawing.Point(524, 9); + this.btnSelectNoneIPRanges.Location = new System.Drawing.Point(491, 9); this.btnSelectNoneIPRanges.Name = "btnSelectNoneIPRanges"; this.btnSelectNoneIPRanges.Size = new System.Drawing.Size(88, 23); this.btnSelectNoneIPRanges.TabIndex = 2; @@ -545,7 +560,7 @@ private void InitializeComponent() // btnSelectAllIPRanges // this.btnSelectAllIPRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnSelectAllIPRanges.Location = new System.Drawing.Point(621, 9); + this.btnSelectAllIPRanges.Location = new System.Drawing.Point(588, 9); this.btnSelectAllIPRanges.Name = "btnSelectAllIPRanges"; this.btnSelectAllIPRanges.Size = new System.Drawing.Size(88, 23); this.btnSelectAllIPRanges.TabIndex = 1; @@ -564,7 +579,7 @@ private void InitializeComponent() this.headTotalIPs}); this.listCFIPList.Location = new System.Drawing.Point(0, 38); this.listCFIPList.Name = "listCFIPList"; - this.listCFIPList.Size = new System.Drawing.Size(715, 188); + this.listCFIPList.Size = new System.Drawing.Size(682, 188); this.listCFIPList.TabIndex = 0; this.listCFIPList.UseCompatibleStateImageBehavior = false; this.listCFIPList.View = System.Windows.Forms.View.Details; @@ -592,7 +607,7 @@ private void InitializeComponent() this.tabPageResults.Location = new System.Drawing.Point(4, 24); this.tabPageResults.Name = "tabPageResults"; this.tabPageResults.Padding = new System.Windows.Forms.Padding(3); - this.tabPageResults.Size = new System.Drawing.Size(715, 226); + this.tabPageResults.Size = new System.Drawing.Size(712, 226); this.tabPageResults.TabIndex = 0; this.tabPageResults.Text = "Scan Results"; this.tabPageResults.UseVisualStyleBackColor = true; @@ -632,7 +647,7 @@ private void InitializeComponent() this.toolsToolStripMenuItem}); this.mnuMain.Location = new System.Drawing.Point(0, 0); this.mnuMain.Name = "mnuMain"; - this.mnuMain.Size = new System.Drawing.Size(747, 24); + this.mnuMain.Size = new System.Drawing.Size(714, 24); this.mnuMain.TabIndex = 8; this.mnuMain.Text = "menuStrip1"; // @@ -755,11 +770,11 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(747, 599); + this.ClientSize = new System.Drawing.Size(714, 599); this.Controls.Add(this.mnuMain); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.groupBox1); - this.MinimumSize = new System.Drawing.Size(760, 480); + this.MinimumSize = new System.Drawing.Size(730, 480); this.Name = "frmMain"; this.Text = "Cloudflare Scan"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing); @@ -851,7 +866,8 @@ private void InitializeComponent() private ToolStripSplitButton btnStart; private ToolStripMenuItem mnuPauseScan; private ToolStripButton btnSkipCurRange; - private ToolStripSeparator toolStripSeparator3; private ToolStripMenuItem checkForUpdateToolStripMenuItem; + private ToolStripComboBox toolStripComboBox1; + private ToolStripLabel toolStripLabel3; } } \ No newline at end of file diff --git a/windows/frmMain.cs b/windows/frmMain.cs index 5836aa01..a616ab78 100644 --- a/windows/frmMain.cs +++ b/windows/frmMain.cs @@ -71,14 +71,17 @@ public frmMain() private void checkEnableDebugMode() { - if(configManager.enableDebug) + if (configManager.enableDebug) { comboConcurrent.Text = "1"; comboConcurrent.Enabled = false; lblDebugMode.Visible = true; addTextLog("Debug mode is enabled. In this mode concurrent process is set to 1 and you can see scan debug data in 'debug.txt' file in the app directory."); addTextLog("To exit debug mode delete 'enable-debug' file from the app directory and then re-open the app."); - Tools.logStep($"\n\nApp started. Version: {appVersion}"); + + string systemInfo = $"OS: {System.Runtime.InteropServices.RuntimeInformation.OSDescription} {System.Runtime.InteropServices.RuntimeInformation.OSArchitecture}, " + + $"Cpu Arch: {System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture}, Framework: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"; + Tools.logStep($"\n\nApp started. Version: {appVersion}\n{systemInfo}"); } } @@ -371,7 +374,7 @@ private void oneTimeChecks() } else { - addTextLog("Failed to update client config. check your internet connection or maybe client config update url is blocked by your ISP!"); + addTextLog("Failed to update client config. check your internet connection or maybe client config url is blocked by your ISP!"); } }