コード例 #1
0
        override protected void endTag(string tag)
        {
            if (elementStack.Count != 0)
            {
                if (tag.CompareTo("ReportItem") == 0 &&
                    elementStack.Peek().CompareTo("ReportItem") == 0)
                {
                    elementStack.Pop();

                    NessusDataEntry entry = null;
                    entry = new NessusDataEntry(tempPluginName,
                                                tempIpList,
                                                tempDescription,
                                                tempImpact,
                                                tempSeverity,
                                                tempRiskFactor,
                                                tempRecommendation,
                                                tempCveList,
                                                tempBidList,
                                                tempOsvdbList);

                    if (entry.isValid())
                    {
                        tempRecord.nessusAddEntry(int.Parse(tempPluginId), tempIpList, entry);
                    }
                }
                else if (tag.CompareTo("cve") == 0 &&
                         elementStack.Peek().CompareTo("cve") == 0)
                {
                    elementStack.Pop();
                    tempCveList.Add(tempCve);
                }
                else if (tag.CompareTo("bid") == 0 &&
                         elementStack.Peek().CompareTo("bid") == 0)
                {
                    elementStack.Pop();
                    tempBidList.Add(tempBid);
                }
                else if (tag.CompareTo("osvdb") == 0 &&
                         elementStack.Peek().CompareTo("osvdb") == 0)
                {
                    elementStack.Pop();
                    tempOsvdbList.Add(tempOsvdb);
                }
                else if (elementStack.Peek().CompareTo(tag) == 0)
                {
                    elementStack.Pop();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// This is the endTag method.
        /// It is used to handle the end tag from the XML file.
        /// </summary>
        /// <param name="tag">xml end tag name</param>
        override protected void endTag(string tag)
        {
            if (elementStack.Count != 0)
            {
                if (tag.CompareTo("ReportItem") == 0 &&
                    elementStack.Peek().CompareTo("ReportItem") == 0)
                {
                    elementStack.Pop();

                    // check whether is MS id

                    if (tempPluginName.Length >= 2 && tempPluginName.Substring(0, 2).Contains("MS"))
                    {
                        if (tempPluginName.IndexOf(':') != -1)
                        {
                            this.tempMicrosoftID = tempPluginName.Substring(0, tempPluginName.IndexOf(':'));
                        }
                        else
                        {
                            this.tempMicrosoftID = "";
                        }
                    }
                    NessusDataEntry entry = null;
                    entry = new NessusDataEntry(tempPluginName,
                                                tempIpList,
                                                tempDescription,
                                                tempImpact,
                                                tempSeverity,
                                                tempRiskFactor,
                                                tempRecommendation,
                                                tempCveList,
                                                tempBidList,
                                                tempOsvdbList,
                                                tempFileName,
                                                tempPort,
                                                tempProtocol,
                                                tempSvc_name,
                                                tempPluginFamily,
                                                tempPlugin_publication_date,
                                                tempPlugin_modification_date,
                                                tempCvss_vector,
                                                tempCvss_base_score,
                                                tempPlugin_output,
                                                tempPlugin_version,
                                                tempSee_alsoList,
                                                tempPluginId,
                                                tempMicrosoftID);

                    if (entry.isValid())
                    {
                        tempRecord.nessusAddEntry(entry);
                    }
                }
                else if (tag.CompareTo("cve") == 0 &&
                         elementStack.Peek().CompareTo("cve") == 0)
                {
                    elementStack.Pop();
                    tempCveList.Add(tempCve);
                }
                else if (tag.CompareTo("bid") == 0 &&
                         elementStack.Peek().CompareTo("bid") == 0)
                {
                    elementStack.Pop();
                    tempBidList.Add(tempBid);
                }
                else if (tag.CompareTo("xref") == 0 &&
                         elementStack.Peek().CompareTo("xref") == 0)
                {
                    elementStack.Pop();
                    tempOsvdbList.Add(tempOsvdb);
                }
                else if (tag.CompareTo("see_also") == 0 &&
                         elementStack.Peek().CompareTo("see_also") == 0)
                {
                    elementStack.Pop();
                    tempSee_alsoList.Add(tempSee_also);
                }
                else if (elementStack.Peek().CompareTo(tag) == 0)
                {
                    elementStack.Pop();
                }
            }
        }