/// <summary> /// This is the nmapAddEntry method. /// It is used to add an Nmap finding to the Record. /// </summary> /// <param name="entry">the whole nmap dataentry finding</param> public void nmapAddEntry(DataEntry entry) { // return if entry is with non-openPort RiskFactor if (entry.getRiskFactor() != RiskFactor.OPEN) { checkNARaw.Add(entry.deepCopy()); return; } string fileName = entry.getFileName(); if (!fileNameRaw.ContainsKey(DataEntry.EntryType.NMAP)) { fileNameRaw.Add(DataEntry.EntryType.NMAP, new List <string>()); } if (!fileNameRaw[DataEntry.EntryType.NMAP].Contains(fileName)) { fileNameRaw[DataEntry.EntryType.NMAP].Add(fileName); } openPortRaw.Add(entry.deepCopy()); // If the entry is not duplicate String ip = entry.getIp(); if (!openPortTableItem.ContainsKey(ip)) { openPortTableItem[ip] = new OpenPortTableItemData(); } openPortTableItem[ip].addNmapOpenPort(((NmapDataEntry)entry).getOpenPortList()); openPortTableItem[ip].addNmapFilteredPort(((NmapDataEntry)entry).getFilteredPortList()); if (!isDuplicate(openPort, entry)) { //// Add ReportItem entry to dictionary //openPort.Add(openPort.Count, entry); // Change risk stat riskStats.addHost(entry.getIp(), entry.getRiskFactor()); } }
//for output excel public void nessusAddRawEntry(DataEntry entry) { List <DataEntry> targetDictionaryRaw = null; // Find which Dictionary the entry to be stored switch (entry.getRiskFactor()) { case RiskFactor.HIGH: targetDictionaryRaw = highRiskRaw; break; case RiskFactor.MEDIUM: targetDictionaryRaw = mediumRiskRaw; break; case RiskFactor.LOW: targetDictionaryRaw = lowRiskRaw; break; case RiskFactor.NONE: targetDictionaryRaw = noneRiskRaw; break; case RiskFactor.OPEN: targetDictionaryRaw = openPortRaw; break; default: targetDictionaryRaw = checkNARaw; break; } if (targetDictionaryRaw != null) { targetDictionaryRaw.Add(entry.deepCopy()); } }
/// <summary> /// This is the mbsaAddEntry method. /// It is used to add an MBSA finding to the Record. /// </summary> /// <param name="entry">the whole mbsa dataentry finding</param> public void mbsaAddEntry(DataEntry entry) { Dictionary <int, DataEntry> targetDictionary = null; List <DataEntry> targetDictionaryRaw = null; // find which Dictionary the entry to be stored switch (entry.getRiskFactor()) { case RiskFactor.HIGH: targetDictionary = highRisk; targetDictionaryRaw = highRiskRaw; break; case RiskFactor.MEDIUM: targetDictionary = mediumRisk; targetDictionaryRaw = mediumRiskRaw; break; case RiskFactor.LOW: targetDictionary = lowRisk; targetDictionaryRaw = lowRiskRaw; break; case RiskFactor.NONE: targetDictionary = noneRisk; targetDictionaryRaw = noneRiskRaw; break; case RiskFactor.OPEN: targetDictionary = openPort; targetDictionaryRaw = openPortRaw; break; case RiskFactor.NA: case RiskFactor.NULL: targetDictionary = checkNA; targetDictionaryRaw = checkNARaw; break; } // return if entry is with unknow RiskFactor if (targetDictionary == null) { return; } string fileName = entry.getFileName(); if (!fileNameRaw.ContainsKey(DataEntry.EntryType.MBSA)) { fileNameRaw.Add(DataEntry.EntryType.MBSA, new List <string>()); } if (!fileNameRaw[DataEntry.EntryType.MBSA].Contains(fileName)) { fileNameRaw[DataEntry.EntryType.MBSA].Add(fileName); } targetDictionaryRaw.Add(entry.deepCopy()); // if the entry if not duplicate if (!isDuplicate(entry)) { // Add ReportItem entry to hashmap (dictionary) targetDictionary.Add(targetDictionary.Count, entry); // Change risk stat riskStats.addHost(entry.getIp(), entry.getRiskFactor()); } }
/// <summary> /// This is the nessusAddEntry method. /// It is used to add an Nessus finding to the Record. /// </summary> /// <param name="pluginId">the pluginID of the nessus finding</param> /// <param name="ip">the host name of the nessus finding</param> /// <param name="entry">the whole nessus dataentry finding</param> public void nessusAddEntry(DataEntry entry) { int pluginId = int.Parse(((NessusDataEntry)entry).getPluginID()); string ip = entry.getIp(); Dictionary <int, DataEntry> targetDictionary = null; List <DataEntry> targetDictionaryRaw = null; // Find which Dictionary the entry to be stored switch (entry.getRiskFactor()) { case RiskFactor.HIGH: targetDictionary = highRisk; targetDictionaryRaw = highRiskRaw; break; case RiskFactor.MEDIUM: targetDictionary = mediumRisk; targetDictionaryRaw = mediumRiskRaw; break; case RiskFactor.LOW: targetDictionary = lowRisk; targetDictionaryRaw = lowRiskRaw; break; case RiskFactor.NONE: targetDictionary = noneRisk; targetDictionaryRaw = noneRiskRaw; break; case RiskFactor.OPEN: targetDictionary = openPort; targetDictionaryRaw = openPortRaw; break; default: targetDictionary = checkNA; targetDictionaryRaw = checkNARaw; break; } // return if entry is with unknow RiskFactor if (targetDictionary == null) { return; } string fileName = entry.getFileName(); if (!fileNameRaw.ContainsKey(DataEntry.EntryType.NESSUS)) { fileNameRaw.Add(DataEntry.EntryType.NESSUS, new List <string>()); } if (!fileNameRaw[DataEntry.EntryType.NESSUS].Contains(fileName)) { fileNameRaw[DataEntry.EntryType.NESSUS].Add(fileName); } targetDictionaryRaw.Add(entry.deepCopy()); if (!openPortTableItem.ContainsKey(ip)) { openPortTableItem[ip] = new OpenPortTableItemData(); } openPortTableItem[ip].addNessusOpenPort(((NessusDataEntry)entry).getPort(), ((NessusDataEntry)entry).getProtocol()); // Change risk stat riskStats.addHost(ip, entry.getRiskFactor()); // Add ReportItem entry to the dictionary (for an non-openPort finding) if (entry.getRiskFactor() != RiskFactor.OPEN) { if (targetDictionary.ContainsKey((int)pluginId)) { //String p_w_p = entry.getportwithprotocol(); //@@@@@System.Windows.Forms.MessageBox.Show(entry.getIpList().IndexOf(ip.Substring(0, ip.Length)).ToString() + "))" + ip + ">>" + ip.Substring(0, ip.IndexOf("("))); //Plan 3targetDictionary[pluginId].addIp(ip, entry.getportwithprotocol()[entry.getIpList().IndexOf(ip.Substring(0,ip.IndexOf("(")))]); //@@@@@ //Plan 2 targetDictionary[pluginId].addIp(ip, entry.getportwithprotocol(), entry.getpluginoutput_findingdetail()); } else { targetDictionary[pluginId] = entry; //plan 2 //targetDictionary[pluginId].combine_ip_with_corresponding_port(); } } // Add Open Port finding to dictionary else { //entry.combine_ip_with_corresponding_port(); // bool isDuplicate = false; // foreach (KeyValuePair<int, DataEntry> keyValuePair in targetDictionary) // { // DataEntry tempEntry = keyValuePair.Value; // List<String> ipList = tempEntry.getIpList(); // foreach (String host in ipList) // { // // merging of open port finding if host exist in open port findings // if (host == entry.getIp()) // { // if (!tempEntry.getDescription().Contains(entry.getDescription())) // { // tempEntry.setDescription(tempEntry.getDescription() + ", " + entry.getDescription()); // } // isDuplicate = true; // break; // } // } // if (isDuplicate) // { // break; // } // } // // If the current entry is not an Duplicate entry // if (!isDuplicate) // { // // Add it to the OpenPort findings // targetDictionary.Add(targetDictionary.Count, entry); // } } }
public void acunetixAddEntry(DataEntry entry) { string ip = entry.getIp(); Dictionary <int, DataEntry> targetDictionary = null; List <DataEntry> targetDictionaryRaw = null; // Find which Dictionary the entry to be stored switch (entry.getRiskFactor()) { case RiskFactor.HIGH: targetDictionary = highRisk; targetDictionaryRaw = highRiskRaw; break; case RiskFactor.MEDIUM: targetDictionary = mediumRisk; targetDictionaryRaw = mediumRiskRaw; break; case RiskFactor.LOW: targetDictionary = lowRisk; targetDictionaryRaw = lowRiskRaw; break; case RiskFactor.NONE: targetDictionary = noneRisk; targetDictionaryRaw = noneRiskRaw; break; case RiskFactor.OPEN: targetDictionary = openPort; targetDictionaryRaw = openPortRaw; break; default: targetDictionary = checkNA; targetDictionaryRaw = checkNARaw; break; } // return if entry is with unknow RiskFactor if (targetDictionary == null) { return; } string fileName = entry.getFileName(); if (!fileNameRaw.ContainsKey(DataEntry.EntryType.Acunetix)) { fileNameRaw.Add(DataEntry.EntryType.Acunetix, new List <string>()); } if (!fileNameRaw[DataEntry.EntryType.Acunetix].Contains(fileName)) { fileNameRaw[DataEntry.EntryType.Acunetix].Add(fileName); } targetDictionaryRaw.Add(entry.deepCopy()); // Add ReportItem entry to hashmap (dictionary) targetDictionary.Add(targetDictionary.Count, entry); // Change risk stat riskStats.addHost(ip, entry.getRiskFactor()); }