diff --git a/mRemoteV1/Resources/Language/Language.Designer.cs b/mRemoteV1/Resources/Language/Language.Designer.cs index d37249b5..e5814a64 100644 --- a/mRemoteV1/Resources/Language/Language.Designer.cs +++ b/mRemoteV1/Resources/Language/Language.Designer.cs @@ -7507,6 +7507,15 @@ namespace mRemoteNG { } } + /// + /// Looks up a localized string similar to Timeout (seconds). + /// + internal static string TimeoutInSeconds { + get { + return ResourceManager.GetString("TimeoutInSeconds", resourceCulture); + } + } + /// /// Looks up a localized string similar to Unlock. /// diff --git a/mRemoteV1/Resources/Language/Language.resx b/mRemoteV1/Resources/Language/Language.resx index 921d20cc..64eecd3c 100644 --- a/mRemoteV1/Resources/Language/Language.resx +++ b/mRemoteV1/Resources/Language/Language.resx @@ -2631,4 +2631,7 @@ This page will walk you through the process of upgrading your connections file o Use UTF8 encoding for RDP "Load Balance Info" property + + Timeout (seconds) + \ No newline at end of file diff --git a/mRemoteV1/Tools/PortScanner.cs b/mRemoteV1/Tools/PortScanner.cs index 864ba701..2ee08ca6 100644 --- a/mRemoteV1/Tools/PortScanner.cs +++ b/mRemoteV1/Tools/PortScanner.cs @@ -17,17 +17,24 @@ namespace mRemoteNG.Tools private readonly List _ports = new List(); private Thread _scanThread; private readonly List _scannedHosts = new List(); + private readonly int _timeoutInMilliseconds; #region Public Methods - public PortScanner(IPAddress ipAddress1, IPAddress ipAddress2, int port1, int port2) + public PortScanner(IPAddress ipAddress1, IPAddress ipAddress2, int port1, int port2, int timeoutInMilliseconds = 5000) { var ipAddressStart = IpAddressMin(ipAddress1, ipAddress2); var ipAddressEnd = IpAddressMax(ipAddress1, ipAddress2); var portStart = Math.Min(port1, port2); var portEnd = Math.Max(port1, port2); - + + if (timeoutInMilliseconds < 0) + throw new ArgumentOutOfRangeException(nameof(timeoutInMilliseconds)); + + _timeoutInMilliseconds = timeoutInMilliseconds; + + _ports.Clear(); for (var port = portStart; port <= portEnd; port++) { @@ -87,7 +94,7 @@ namespace mRemoteNG.Tools try { pingSender.PingCompleted += PingSender_PingCompleted; - pingSender.SendAsync(ipAddress, ipAddress); + pingSender.SendAsync(ipAddress, _timeoutInMilliseconds, ipAddress); } catch (Exception ex) { diff --git a/mRemoteV1/UI/Window/PortScanWindow.Designer.cs b/mRemoteV1/UI/Window/PortScanWindow.Designer.cs index d9ef1c12..d526782e 100644 --- a/mRemoteV1/UI/Window/PortScanWindow.Designer.cs +++ b/mRemoteV1/UI/Window/PortScanWindow.Designer.cs @@ -36,120 +36,126 @@ namespace mRemoteNG.UI.Window private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PortScanWindow)); - this.ipStart = new mRemoteNG.UI.Controls.IPTextBox(); - this.ipEnd = new mRemoteNG.UI.Controls.IPTextBox(); - this.lblStartIP = new mRemoteNG.UI.Controls.Base.NGLabel(); - this.lblEndIP = new mRemoteNG.UI.Controls.Base.NGLabel(); - this.btnScan = new Controls.Base.NGButton(); - this.olvHosts = new mRemoteNG.UI.Controls.Base.NGListView(); - this.resultsMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); - this.importHTTPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importHTTPSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importRDPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importRloginToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importSSH2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importTelnetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importVNCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.btnImport = new Controls.Base.NGButton(); - this.cbProtocol = new Controls.Base.NGComboBox(); - this.lblOnlyImport = new mRemoteNG.UI.Controls.Base.NGLabel(); - this.clmHost = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmSSH = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmTelnet = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmHTTP = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmHTTPS = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmRlogin = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmRDP = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmVNC = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmOpenPorts = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.clmClosedPorts = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); - this.prgBar = new mRemoteNG.UI.Controls.Base.NGProgressBar(); - this.pnlPorts = new System.Windows.Forms.Panel(); - this.portEnd = new Controls.Base.NGNumericUpDown(); - this.portStart = new Controls.Base.NGNumericUpDown(); - this.Label2 = new mRemoteNG.UI.Controls.Base.NGLabel(); - this.Label1 = new mRemoteNG.UI.Controls.Base.NGLabel(); - this.pnlImport = new System.Windows.Forms.Panel(); - ((System.ComponentModel.ISupportInitialize)(this.olvHosts)).BeginInit(); - this.resultsMenuStrip.SuspendLayout(); - this.pnlPorts.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.portEnd)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.portStart)).BeginInit(); - this.pnlImport.SuspendLayout(); - this.SuspendLayout(); - // - // ipStart - // - this.ipStart.Location = new System.Drawing.Point(12, 25); - this.ipStart.Name = "ipStart"; - this.ipStart.Size = new System.Drawing.Size(130, 20); - this.ipStart.TabIndex = 10; - this.ipStart.ToolTipText = ""; - // - // ipEnd - // - this.ipEnd.Location = new System.Drawing.Point(148, 25); - this.ipEnd.Name = "ipEnd"; - this.ipEnd.Size = new System.Drawing.Size(130, 20); - this.ipEnd.TabIndex = 15; - this.ipEnd.ToolTipText = ""; - // - // lblStartIP - // - this.lblStartIP.AutoSize = true; - this.lblStartIP.Location = new System.Drawing.Point(12, 7); - this.lblStartIP.Name = "lblStartIP"; - this.lblStartIP.Size = new System.Drawing.Size(46, 13); - this.lblStartIP.TabIndex = 0; - this.lblStartIP.Text = "Start IP:"; - // - // lblEndIP - // - this.lblEndIP.AutoSize = true; - this.lblEndIP.Location = new System.Drawing.Point(148, 7); - this.lblEndIP.Name = "lblEndIP"; - this.lblEndIP.Size = new System.Drawing.Size(42, 13); - this.lblEndIP.TabIndex = 5; - this.lblEndIP.Text = "End IP:"; - // - // btnScan - // - this.btnScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnScan.Image = global::mRemoteNG.Resources.Search; - this.btnScan.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; - this.btnScan.Location = new System.Drawing.Point(597, 12); - this.btnScan.Name = "btnScan"; - this.btnScan.Size = new System.Drawing.Size(95, 55); - this.btnScan.TabIndex = 20; - this.btnScan.Text = "&Scan"; - this.btnScan.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; - this.btnScan.UseVisualStyleBackColor = true; - this.btnScan.Click += new System.EventHandler(this.btnScan_Click); - // - // olvHosts - // - this.olvHosts.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PortScanWindow)); + this.ipStart = new mRemoteNG.UI.Controls.IPTextBox(); + this.ipEnd = new mRemoteNG.UI.Controls.IPTextBox(); + this.lblStartIP = new mRemoteNG.UI.Controls.Base.NGLabel(); + this.lblEndIP = new mRemoteNG.UI.Controls.Base.NGLabel(); + this.btnScan = new mRemoteNG.UI.Controls.Base.NGButton(); + this.olvHosts = new mRemoteNG.UI.Controls.Base.NGListView(); + this.resultsMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.importHTTPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importHTTPSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importRDPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importRloginToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importSSH2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importTelnetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.importVNCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.btnImport = new mRemoteNG.UI.Controls.Base.NGButton(); + this.cbProtocol = new mRemoteNG.UI.Controls.Base.NGComboBox(); + this.lblOnlyImport = new mRemoteNG.UI.Controls.Base.NGLabel(); + this.clmHost = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmSSH = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmTelnet = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmHTTP = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmHTTPS = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmRlogin = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmRDP = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmVNC = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmOpenPorts = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.clmClosedPorts = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn())); + this.prgBar = new mRemoteNG.UI.Controls.Base.NGProgressBar(); + this.pnlPorts = new System.Windows.Forms.Panel(); + this.numericSelectorTimeout = new mRemoteNG.UI.Controls.Base.NGNumericUpDown(); + this.lblTimeout = new System.Windows.Forms.Label(); + this.portEnd = new mRemoteNG.UI.Controls.Base.NGNumericUpDown(); + this.portStart = new mRemoteNG.UI.Controls.Base.NGNumericUpDown(); + this.Label2 = new mRemoteNG.UI.Controls.Base.NGLabel(); + this.Label1 = new mRemoteNG.UI.Controls.Base.NGLabel(); + this.pnlImport = new System.Windows.Forms.Panel(); + ((System.ComponentModel.ISupportInitialize)(this.olvHosts)).BeginInit(); + this.resultsMenuStrip.SuspendLayout(); + this.pnlPorts.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericSelectorTimeout)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.portEnd)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.portStart)).BeginInit(); + this.pnlImport.SuspendLayout(); + this.SuspendLayout(); + // + // ipStart + // + this.ipStart.Location = new System.Drawing.Point(12, 25); + this.ipStart.Name = "ipStart"; + this.ipStart.Size = new System.Drawing.Size(130, 20); + this.ipStart.TabIndex = 10; + this.ipStart.ToolTipText = ""; + // + // ipEnd + // + this.ipEnd.Location = new System.Drawing.Point(148, 25); + this.ipEnd.Name = "ipEnd"; + this.ipEnd.Size = new System.Drawing.Size(130, 20); + this.ipEnd.TabIndex = 15; + this.ipEnd.ToolTipText = ""; + // + // lblStartIP + // + this.lblStartIP.AutoSize = true; + this.lblStartIP.Location = new System.Drawing.Point(12, 7); + this.lblStartIP.Name = "lblStartIP"; + this.lblStartIP.Size = new System.Drawing.Size(46, 13); + this.lblStartIP.TabIndex = 0; + this.lblStartIP.Text = "Start IP:"; + // + // lblEndIP + // + this.lblEndIP.AutoSize = true; + this.lblEndIP.Location = new System.Drawing.Point(148, 7); + this.lblEndIP.Name = "lblEndIP"; + this.lblEndIP.Size = new System.Drawing.Size(42, 13); + this.lblEndIP.TabIndex = 5; + this.lblEndIP.Text = "End IP:"; + // + // btnScan + // + this.btnScan._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER; + this.btnScan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnScan.Image = global::mRemoteNG.Resources.Search; + this.btnScan.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; + this.btnScan.Location = new System.Drawing.Point(801, 12); + this.btnScan.Name = "btnScan"; + this.btnScan.Size = new System.Drawing.Size(95, 55); + this.btnScan.TabIndex = 20; + this.btnScan.Text = "&Scan"; + this.btnScan.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.btnScan.UseVisualStyleBackColor = true; + this.btnScan.Click += new System.EventHandler(this.btnScan_Click); + // + // olvHosts + // + this.olvHosts.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.olvHosts.CellEditUseWholeCell = false; - this.olvHosts.ContextMenuStrip = this.resultsMenuStrip; - this.olvHosts.FullRowSelect = true; - this.olvHosts.GridLines = true; - this.olvHosts.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.olvHosts.HideSelection = false; - this.olvHosts.Location = new System.Drawing.Point(12, 73); - this.olvHosts.Name = "olvHosts"; - this.olvHosts.ShowGroups = false; - this.olvHosts.Size = new System.Drawing.Size(680, 290); - this.olvHosts.TabIndex = 26; - this.olvHosts.UseCompatibleStateImageBehavior = false; - this.olvHosts.View = System.Windows.Forms.View.Details; - // - // resultsMenuStrip - // - this.resultsMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.olvHosts.CellEditUseWholeCell = false; + this.olvHosts.ContextMenuStrip = this.resultsMenuStrip; + this.olvHosts.Cursor = System.Windows.Forms.Cursors.Default; + this.olvHosts.DecorateLines = true; + this.olvHosts.FullRowSelect = true; + this.olvHosts.GridLines = true; + this.olvHosts.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.olvHosts.HideSelection = false; + this.olvHosts.Location = new System.Drawing.Point(12, 73); + this.olvHosts.Name = "olvHosts"; + this.olvHosts.ShowGroups = false; + this.olvHosts.Size = new System.Drawing.Size(884, 290); + this.olvHosts.TabIndex = 26; + this.olvHosts.UseCompatibleStateImageBehavior = false; + this.olvHosts.View = System.Windows.Forms.View.Details; + // + // resultsMenuStrip + // + this.resultsMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.importHTTPToolStripMenuItem, this.importHTTPSToolStripMenuItem, this.importRDPToolStripMenuItem, @@ -157,75 +163,77 @@ namespace mRemoteNG.UI.Window this.importSSH2ToolStripMenuItem, this.importTelnetToolStripMenuItem, this.importVNCToolStripMenuItem}); - this.resultsMenuStrip.Name = "resultsMenuStrip"; - this.resultsMenuStrip.Size = new System.Drawing.Size(150, 158); - // - // importHTTPToolStripMenuItem - // - this.importHTTPToolStripMenuItem.Name = "importHTTPToolStripMenuItem"; - this.importHTTPToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importHTTPToolStripMenuItem.Text = "Import HTTP"; - this.importHTTPToolStripMenuItem.Click += new System.EventHandler(this.importHTTPToolStripMenuItem_Click); - // - // importHTTPSToolStripMenuItem - // - this.importHTTPSToolStripMenuItem.Name = "importHTTPSToolStripMenuItem"; - this.importHTTPSToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importHTTPSToolStripMenuItem.Text = "Import HTTPS"; - this.importHTTPSToolStripMenuItem.Click += new System.EventHandler(this.importHTTPSToolStripMenuItem_Click); - // - // importRDPToolStripMenuItem - // - this.importRDPToolStripMenuItem.Name = "importRDPToolStripMenuItem"; - this.importRDPToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importRDPToolStripMenuItem.Text = "Import RDP"; - this.importRDPToolStripMenuItem.Click += new System.EventHandler(this.importRDPToolStripMenuItem_Click); - // - // importRloginToolStripMenuItem - // - this.importRloginToolStripMenuItem.Name = "importRloginToolStripMenuItem"; - this.importRloginToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importRloginToolStripMenuItem.Text = "Import Rlogin"; - this.importRloginToolStripMenuItem.Click += new System.EventHandler(this.importRloginToolStripMenuItem_Click); - // - // importSSH2ToolStripMenuItem - // - this.importSSH2ToolStripMenuItem.Name = "importSSH2ToolStripMenuItem"; - this.importSSH2ToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importSSH2ToolStripMenuItem.Text = "Import SSH2"; - this.importSSH2ToolStripMenuItem.Click += new System.EventHandler(this.importSSH2ToolStripMenuItem_Click); - // - // importTelnetToolStripMenuItem - // - this.importTelnetToolStripMenuItem.Name = "importTelnetToolStripMenuItem"; - this.importTelnetToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importTelnetToolStripMenuItem.Text = "Import Telnet"; - this.importTelnetToolStripMenuItem.Click += new System.EventHandler(this.importTelnetToolStripMenuItem_Click); - // - // importVNCToolStripMenuItem - // - this.importVNCToolStripMenuItem.Name = "importVNCToolStripMenuItem"; - this.importVNCToolStripMenuItem.Size = new System.Drawing.Size(149, 22); - this.importVNCToolStripMenuItem.Text = "Import VNC"; - this.importVNCToolStripMenuItem.Click += new System.EventHandler(this.importVNCToolStripMenuItem_Click); - // - // btnImport - // - this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnImport.Location = new System.Drawing.Point(594, 3); - this.btnImport.Name = "btnImport"; - this.btnImport.Size = new System.Drawing.Size(75, 31); - this.btnImport.TabIndex = 101; - this.btnImport.Text = "&Import"; - this.btnImport.UseVisualStyleBackColor = true; - this.btnImport.Click += new System.EventHandler(this.btnImport_Click); - // - // cbProtocol - // - this.cbProtocol.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbProtocol.FormattingEnabled = true; - this.cbProtocol.Items.AddRange(new object[] { + this.resultsMenuStrip.Name = "resultsMenuStrip"; + this.resultsMenuStrip.Size = new System.Drawing.Size(150, 158); + // + // importHTTPToolStripMenuItem + // + this.importHTTPToolStripMenuItem.Name = "importHTTPToolStripMenuItem"; + this.importHTTPToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importHTTPToolStripMenuItem.Text = "Import HTTP"; + this.importHTTPToolStripMenuItem.Click += new System.EventHandler(this.importHTTPToolStripMenuItem_Click); + // + // importHTTPSToolStripMenuItem + // + this.importHTTPSToolStripMenuItem.Name = "importHTTPSToolStripMenuItem"; + this.importHTTPSToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importHTTPSToolStripMenuItem.Text = "Import HTTPS"; + this.importHTTPSToolStripMenuItem.Click += new System.EventHandler(this.importHTTPSToolStripMenuItem_Click); + // + // importRDPToolStripMenuItem + // + this.importRDPToolStripMenuItem.Name = "importRDPToolStripMenuItem"; + this.importRDPToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importRDPToolStripMenuItem.Text = "Import RDP"; + this.importRDPToolStripMenuItem.Click += new System.EventHandler(this.importRDPToolStripMenuItem_Click); + // + // importRloginToolStripMenuItem + // + this.importRloginToolStripMenuItem.Name = "importRloginToolStripMenuItem"; + this.importRloginToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importRloginToolStripMenuItem.Text = "Import Rlogin"; + this.importRloginToolStripMenuItem.Click += new System.EventHandler(this.importRloginToolStripMenuItem_Click); + // + // importSSH2ToolStripMenuItem + // + this.importSSH2ToolStripMenuItem.Name = "importSSH2ToolStripMenuItem"; + this.importSSH2ToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importSSH2ToolStripMenuItem.Text = "Import SSH2"; + this.importSSH2ToolStripMenuItem.Click += new System.EventHandler(this.importSSH2ToolStripMenuItem_Click); + // + // importTelnetToolStripMenuItem + // + this.importTelnetToolStripMenuItem.Name = "importTelnetToolStripMenuItem"; + this.importTelnetToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importTelnetToolStripMenuItem.Text = "Import Telnet"; + this.importTelnetToolStripMenuItem.Click += new System.EventHandler(this.importTelnetToolStripMenuItem_Click); + // + // importVNCToolStripMenuItem + // + this.importVNCToolStripMenuItem.Name = "importVNCToolStripMenuItem"; + this.importVNCToolStripMenuItem.Size = new System.Drawing.Size(149, 22); + this.importVNCToolStripMenuItem.Text = "Import VNC"; + this.importVNCToolStripMenuItem.Click += new System.EventHandler(this.importVNCToolStripMenuItem_Click); + // + // btnImport + // + this.btnImport._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER; + this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnImport.Location = new System.Drawing.Point(798, 3); + this.btnImport.Name = "btnImport"; + this.btnImport.Size = new System.Drawing.Size(75, 31); + this.btnImport.TabIndex = 101; + this.btnImport.Text = "&Import"; + this.btnImport.UseVisualStyleBackColor = true; + this.btnImport.Click += new System.EventHandler(this.btnImport_Click); + // + // cbProtocol + // + this.cbProtocol._mice = mRemoteNG.UI.Controls.Base.NGComboBox.MouseState.HOVER; + this.cbProtocol.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbProtocol.FormattingEnabled = true; + this.cbProtocol.Items.AddRange(new object[] { "SSH2", "Telnet", "HTTP", @@ -233,190 +241,214 @@ namespace mRemoteNG.UI.Window "Rlogin", "RDP", "VNC"}); - this.cbProtocol.Location = new System.Drawing.Point(157, 6); - this.cbProtocol.Name = "cbProtocol"; - this.cbProtocol.Size = new System.Drawing.Size(122, 21); - this.cbProtocol.TabIndex = 28; - // - // lblOnlyImport - // - this.lblOnlyImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblOnlyImport.AutoSize = true; - this.lblOnlyImport.Location = new System.Drawing.Point(5, 13); - this.lblOnlyImport.Name = "lblOnlyImport"; - this.lblOnlyImport.Size = new System.Drawing.Size(104, 13); - this.lblOnlyImport.TabIndex = 1; - this.lblOnlyImport.Text = "Protocol to import:"; - // - // clmHost - // - this.clmHost.AspectName = "HostIPorName"; - this.clmHost.FillsFreeSpace = true; - this.clmHost.Text = "Hostname/IP"; - this.clmHost.Width = 130; - // - // clmSSH - // - this.clmSSH.AspectName = "SshName"; - this.clmSSH.Text = "SSH"; - this.clmSSH.Width = 50; - // - // clmTelnet - // - this.clmTelnet.AspectName = "TelnetName"; - this.clmTelnet.Text = "Telnet"; - this.clmTelnet.Width = 50; - // - // clmHTTP - // - this.clmHTTP.AspectName = "HttpName"; - this.clmHTTP.Text = "HTTP"; - this.clmHTTP.Width = 50; - // - // clmHTTPS - // - this.clmHTTPS.AspectName = "HttpsName"; - this.clmHTTPS.Text = "HTTPS"; - this.clmHTTPS.Width = 50; - // - // clmRlogin - // - this.clmRlogin.AspectName = "RloginName"; - this.clmRlogin.Text = "Rlogin"; - this.clmRlogin.Width = 50; - // - // clmRDP - // - this.clmRDP.AspectName = "RdpName"; - this.clmRDP.Text = "RDP"; - this.clmRDP.Width = 50; - // - // clmVNC - // - this.clmVNC.AspectName = "VncName"; - this.clmVNC.Text = "VNC"; - this.clmVNC.Width = 50; - // - // clmOpenPorts - // - this.clmOpenPorts.AspectName = "OpenPortsName"; - this.clmOpenPorts.FillsFreeSpace = true; - this.clmOpenPorts.Text = "Open Ports"; - this.clmOpenPorts.Width = 150; - // - // clmClosedPorts - // - this.clmClosedPorts.AspectName = "ClosedPortsName"; - this.clmClosedPorts.FillsFreeSpace = true; - this.clmClosedPorts.Text = "Closed Ports"; - this.clmClosedPorts.Width = 150; - // - // prgBar - // - this.prgBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.cbProtocol.Location = new System.Drawing.Point(157, 6); + this.cbProtocol.Name = "cbProtocol"; + this.cbProtocol.Size = new System.Drawing.Size(122, 21); + this.cbProtocol.TabIndex = 28; + // + // lblOnlyImport + // + this.lblOnlyImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblOnlyImport.AutoSize = true; + this.lblOnlyImport.Location = new System.Drawing.Point(5, 13); + this.lblOnlyImport.Name = "lblOnlyImport"; + this.lblOnlyImport.Size = new System.Drawing.Size(104, 13); + this.lblOnlyImport.TabIndex = 1; + this.lblOnlyImport.Text = "Protocol to import:"; + // + // clmHost + // + this.clmHost.AspectName = "HostIPorName"; + this.clmHost.FillsFreeSpace = true; + this.clmHost.Text = "Hostname/IP"; + this.clmHost.Width = 130; + // + // clmSSH + // + this.clmSSH.AspectName = "SshName"; + this.clmSSH.Text = "SSH"; + this.clmSSH.Width = 50; + // + // clmTelnet + // + this.clmTelnet.AspectName = "TelnetName"; + this.clmTelnet.Text = "Telnet"; + this.clmTelnet.Width = 50; + // + // clmHTTP + // + this.clmHTTP.AspectName = "HttpName"; + this.clmHTTP.Text = "HTTP"; + this.clmHTTP.Width = 50; + // + // clmHTTPS + // + this.clmHTTPS.AspectName = "HttpsName"; + this.clmHTTPS.Text = "HTTPS"; + this.clmHTTPS.Width = 50; + // + // clmRlogin + // + this.clmRlogin.AspectName = "RloginName"; + this.clmRlogin.Text = "Rlogin"; + this.clmRlogin.Width = 50; + // + // clmRDP + // + this.clmRDP.AspectName = "RdpName"; + this.clmRDP.Text = "RDP"; + this.clmRDP.Width = 50; + // + // clmVNC + // + this.clmVNC.AspectName = "VncName"; + this.clmVNC.Text = "VNC"; + this.clmVNC.Width = 50; + // + // clmOpenPorts + // + this.clmOpenPorts.AspectName = "OpenPortsName"; + this.clmOpenPorts.FillsFreeSpace = true; + this.clmOpenPorts.Text = "Open Ports"; + this.clmOpenPorts.Width = 150; + // + // clmClosedPorts + // + this.clmClosedPorts.AspectName = "ClosedPortsName"; + this.clmClosedPorts.FillsFreeSpace = true; + this.clmClosedPorts.Text = "Closed Ports"; + this.clmClosedPorts.Width = 150; + // + // prgBar + // + this.prgBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.prgBar.Location = new System.Drawing.Point(12, 50); - this.prgBar.Name = "prgBar"; - this.prgBar.Size = new System.Drawing.Size(571, 16); - this.prgBar.Step = 1; - this.prgBar.TabIndex = 28; - // - // pnlPorts - // - this.pnlPorts.Controls.Add(this.portEnd); - this.pnlPorts.Controls.Add(this.portStart); - this.pnlPorts.Controls.Add(this.Label2); - this.pnlPorts.Controls.Add(this.Label1); - this.pnlPorts.Location = new System.Drawing.Point(284, 7); - this.pnlPorts.Name = "pnlPorts"; - this.pnlPorts.Size = new System.Drawing.Size(307, 38); - this.pnlPorts.TabIndex = 18; - // - // portEnd - // - this.portEnd.Location = new System.Drawing.Point(232, 12); - this.portEnd.Maximum = new decimal(new int[] { + this.prgBar.Location = new System.Drawing.Point(15, 51); + this.prgBar.Name = "prgBar"; + this.prgBar.Size = new System.Drawing.Size(775, 16); + this.prgBar.Step = 1; + this.prgBar.TabIndex = 28; + // + // pnlPorts + // + this.pnlPorts.Controls.Add(this.numericSelectorTimeout); + this.pnlPorts.Controls.Add(this.lblTimeout); + this.pnlPorts.Controls.Add(this.portEnd); + this.pnlPorts.Controls.Add(this.portStart); + this.pnlPorts.Controls.Add(this.Label2); + this.pnlPorts.Controls.Add(this.Label1); + this.pnlPorts.Location = new System.Drawing.Point(284, 7); + this.pnlPorts.Name = "pnlPorts"; + this.pnlPorts.Size = new System.Drawing.Size(506, 38); + this.pnlPorts.TabIndex = 18; + // + // numericSelectorTimeout + // + this.numericSelectorTimeout.Location = new System.Drawing.Point(436, 12); + this.numericSelectorTimeout.Maximum = new decimal(new int[] { + 2147482, + 0, + 0, + 0}); + this.numericSelectorTimeout.Name = "numericSelectorTimeout"; + this.numericSelectorTimeout.Size = new System.Drawing.Size(67, 22); + this.numericSelectorTimeout.TabIndex = 17; + // + // lblTimeout + // + this.lblTimeout.AutoSize = true; + this.lblTimeout.Location = new System.Drawing.Point(315, 14); + this.lblTimeout.Name = "lblTimeout"; + this.lblTimeout.Size = new System.Drawing.Size(102, 13); + this.lblTimeout.TabIndex = 16; + this.lblTimeout.Text = "Timeout (seconds):"; + // + // portEnd + // + this.portEnd.Location = new System.Drawing.Point(232, 12); + this.portEnd.Maximum = new decimal(new int[] { 65535, 0, 0, 0}); - this.portEnd.Name = "portEnd"; - this.portEnd.Size = new System.Drawing.Size(67, 22); - this.portEnd.TabIndex = 15; - this.portEnd.Enter += new System.EventHandler(this.portEnd_Enter); - // - // portStart - // - this.portStart.Location = new System.Drawing.Point(79, 12); - this.portStart.Maximum = new decimal(new int[] { + this.portEnd.Name = "portEnd"; + this.portEnd.Size = new System.Drawing.Size(67, 22); + this.portEnd.TabIndex = 15; + this.portEnd.Enter += new System.EventHandler(this.portEnd_Enter); + // + // portStart + // + this.portStart.Location = new System.Drawing.Point(79, 12); + this.portStart.Maximum = new decimal(new int[] { 65535, 0, 0, 0}); - this.portStart.Name = "portStart"; - this.portStart.Size = new System.Drawing.Size(67, 22); - this.portStart.TabIndex = 5; - this.portStart.Enter += new System.EventHandler(this.portStart_Enter); - // - // Label2 - // - this.Label2.AutoSize = true; - this.Label2.Location = new System.Drawing.Point(162, 16); - this.Label2.Name = "Label2"; - this.Label2.Size = new System.Drawing.Size(54, 13); - this.Label2.TabIndex = 10; - this.Label2.Text = "End Port:"; - // - // Label1 - // - this.Label1.AutoSize = true; - this.Label1.Location = new System.Drawing.Point(3, 17); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(58, 13); - this.Label1.TabIndex = 0; - this.Label1.Text = "Start Port:"; - // - // pnlImport - // - this.pnlImport.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.portStart.Name = "portStart"; + this.portStart.Size = new System.Drawing.Size(67, 22); + this.portStart.TabIndex = 5; + this.portStart.Enter += new System.EventHandler(this.portStart_Enter); + // + // Label2 + // + this.Label2.AutoSize = true; + this.Label2.Location = new System.Drawing.Point(160, 14); + this.Label2.Name = "Label2"; + this.Label2.Size = new System.Drawing.Size(54, 13); + this.Label2.TabIndex = 10; + this.Label2.Text = "End Port:"; + // + // Label1 + // + this.Label1.AutoSize = true; + this.Label1.Location = new System.Drawing.Point(7, 14); + this.Label1.Name = "Label1"; + this.Label1.Size = new System.Drawing.Size(58, 13); + this.Label1.TabIndex = 0; + this.Label1.Text = "Start Port:"; + // + // pnlImport + // + this.pnlImport.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pnlImport.Controls.Add(this.btnImport); - this.pnlImport.Controls.Add(this.lblOnlyImport); - this.pnlImport.Controls.Add(this.cbProtocol); - this.pnlImport.Location = new System.Drawing.Point(12, 369); - this.pnlImport.Name = "pnlImport"; - this.pnlImport.Size = new System.Drawing.Size(680, 40); - this.pnlImport.TabIndex = 102; - // - // PortScanWindow - // - this.AcceptButton = this.btnImport; - this.ClientSize = new System.Drawing.Size(704, 421); - this.Controls.Add(this.pnlImport); - this.Controls.Add(this.olvHosts); - this.Controls.Add(this.pnlPorts); - this.Controls.Add(this.prgBar); - this.Controls.Add(this.btnScan); - this.Controls.Add(this.lblEndIP); - this.Controls.Add(this.lblStartIP); - this.Controls.Add(this.ipEnd); - this.Controls.Add(this.ipStart); - this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Name = "PortScanWindow"; - this.TabText = "Port Scan"; - this.Text = "Port Scan"; - this.Load += new System.EventHandler(this.PortScan_Load); - ((System.ComponentModel.ISupportInitialize)(this.olvHosts)).EndInit(); - this.resultsMenuStrip.ResumeLayout(false); - this.pnlPorts.ResumeLayout(false); - this.pnlPorts.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.portEnd)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.portStart)).EndInit(); - this.pnlImport.ResumeLayout(false); - this.pnlImport.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); + this.pnlImport.Controls.Add(this.btnImport); + this.pnlImport.Controls.Add(this.lblOnlyImport); + this.pnlImport.Controls.Add(this.cbProtocol); + this.pnlImport.Location = new System.Drawing.Point(12, 369); + this.pnlImport.Name = "pnlImport"; + this.pnlImport.Size = new System.Drawing.Size(884, 40); + this.pnlImport.TabIndex = 102; + // + // PortScanWindow + // + this.AcceptButton = this.btnImport; + this.ClientSize = new System.Drawing.Size(908, 421); + this.Controls.Add(this.pnlImport); + this.Controls.Add(this.olvHosts); + this.Controls.Add(this.pnlPorts); + this.Controls.Add(this.prgBar); + this.Controls.Add(this.btnScan); + this.Controls.Add(this.lblEndIP); + this.Controls.Add(this.lblStartIP); + this.Controls.Add(this.ipEnd); + this.Controls.Add(this.ipStart); + this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "PortScanWindow"; + this.TabText = "Port Scan"; + this.Text = "Port Scan"; + this.Load += new System.EventHandler(this.PortScan_Load); + ((System.ComponentModel.ISupportInitialize)(this.olvHosts)).EndInit(); + this.resultsMenuStrip.ResumeLayout(false); + this.pnlPorts.ResumeLayout(false); + this.pnlPorts.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericSelectorTimeout)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.portEnd)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.portStart)).EndInit(); + this.pnlImport.ResumeLayout(false); + this.pnlImport.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); } internal System.Windows.Forms.Panel pnlImport; @@ -431,5 +463,7 @@ namespace mRemoteNG.UI.Window private System.Windows.Forms.ToolStripMenuItem importSSH2ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importTelnetToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importVNCToolStripMenuItem; - } + private System.Windows.Forms.Label lblTimeout; + private Controls.Base.NGNumericUpDown numericSelectorTimeout; + } } diff --git a/mRemoteV1/UI/Window/PortScanWindow.cs b/mRemoteV1/UI/Window/PortScanWindow.cs index d8cdced9..8175e045 100644 --- a/mRemoteV1/UI/Window/PortScanWindow.cs +++ b/mRemoteV1/UI/Window/PortScanWindow.cs @@ -90,6 +90,7 @@ namespace mRemoteNG.UI.Window olvHosts.Columns.AddRange(new[]{clmHost, clmSSH, clmTelnet, clmHTTP, clmHTTPS, clmRlogin, clmRDP, clmVNC, clmOpenPorts, clmClosedPorts}); ShowImportControls(true); cbProtocol.SelectedIndex = 0; + numericSelectorTimeout.Value = 5; } catch (Exception ex) { @@ -147,6 +148,7 @@ namespace mRemoteNG.UI.Window clmClosedPorts.Text = Language.strClosedPorts; Label2.Text = $"{Language.strEndPort}:"; Label1.Text = $"{Language.strStartPort}:"; + lblTimeout.Text = $"{Language.TimeoutInSeconds}"; TabText = Language.strMenuPortScan; Text = Language.strMenuPortScan; } @@ -176,7 +178,7 @@ namespace mRemoteNG.UI.Window System.Net.IPAddress ipAddressStart = System.Net.IPAddress.Parse(ipStart.Text); System.Net.IPAddress ipAddressEnd = System.Net.IPAddress.Parse(ipEnd.Text); - _portScanner = new PortScanner(ipAddressStart, ipAddressEnd, (int) portStart.Value, (int) portEnd.Value); + _portScanner = new PortScanner(ipAddressStart, ipAddressEnd, (int) portStart.Value, (int) portEnd.Value, ((int)numericSelectorTimeout.Value)*1000); _portScanner.BeginHostScan += PortScanner_BeginHostScan; _portScanner.HostScanned += PortScanner_HostScanned;