private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { ScanOptions options = new ScanOptions(); options.Targets = String.Format("{0}/{1}", host.Addresses[0].ToString(), 32); DialogResult r = options.ShowDialog(this); if (r != System.Windows.Forms.DialogResult.Cancel) { NmapProcess process = new NmapProcess(options); process.ShowDialog(this); if (process.CompletedScan) { NmapRun scan = NmapRun.Parse(process.TempFile); Host = scan.Hosts[0]; } } }
private void mnuFileScan_Click(object sender, EventArgs e) { if (Properties.Settings.Default["nmap_path"].ToString().Length == 0) { OptionsDialog od = new OptionsDialog(); DialogResult dr = od.ShowDialog(this); if (dr == System.Windows.Forms.DialogResult.Cancel) { return; } } ScanOptions scanOptions = new ScanOptions(); DialogResult r = scanOptions.ShowDialog(this); if (r != System.Windows.Forms.DialogResult.Cancel) { NmapProcess process = new NmapProcess(scanOptions); process.ShowDialog(this); if (process.CompletedScan) { saveFileDialog1.Title = "Save Scan..."; saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); saveFileDialog1.FileName = scanOptions.Targets.Replace("/", "-").Replace(",", "_"); saveFileDialog1.Filter = "Nmap Scan Results (*.xml)|*.xml"; r = saveFileDialog1.ShowDialog(this); if (r == System.Windows.Forms.DialogResult.OK) { if (File.Exists(saveFileDialog1.FileName)) { File.Delete(saveFileDialog1.FileName); } File.Move(process.TempFile, saveFileDialog1.FileName); ScanPath = saveFileDialog1.FileName; backgroundWorker1.RunWorkerAsync(saveFileDialog1.FileName); } } else { MessageBox.Show("The scan was incomplete. Please try again.", "What the...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { ScanOptions options = new ScanOptions(); options.Targets = String.Format("{0}/{1}", host.Addresses[0].ToString(), 32); options.ScanType = new ScanOptions.Option("-sT"); options.EnableHostTimeout = false; foreach (ScanOptions.Option option in options.Options) { if (option.Value.Equals("-F")) { option.Selected = true; } } NmapProcess process = new NmapProcess(options); process.ShowDialog(this); if (process.CompletedScan) { NmapRun scan = NmapRun.Parse(process.TempFile); Host = scan.Hosts[0]; } }