Beispiel #1
0
        public XmlElement ToXml(XmlDocument document)
        {
            XmlElement sourceNode = document.CreateElement("idmef:Source", "http://iana.org/idmef");

            sourceNode.SetAttribute("ident", ident);
            sourceNode.SetAttribute("spoofed", spoofed.ToString());
            if (i_face != null)
            {
                sourceNode.SetAttribute("interface", i_face);
            }

            if (node != null)
            {
                sourceNode.AppendChild(node.ToXml(document));
            }
            if (user != null)
            {
                sourceNode.AppendChild(user.ToXml(document));
            }
            if (process != null)
            {
                sourceNode.AppendChild(process.ToXml(document));
            }
            if (service != null)
            {
                sourceNode.AppendChild(service.ToXml(document));
            }

            return(sourceNode);
        }
        public XmlElement ToXml(XmlDocument document)
        {
            XmlElement analyzerNode = document.CreateElement("idmef:Analyzer", "http://iana.org/idmef");

            if (!string.IsNullOrEmpty(analyzerId))
            {
                analyzerNode.SetAttribute("analyzerid", analyzerId);
            }
            if (!string.IsNullOrEmpty(name))
            {
                analyzerNode.SetAttribute("name", name);
            }
            if (!string.IsNullOrEmpty(manufacturer))
            {
                analyzerNode.SetAttribute("manufacturer", manufacturer);
            }
            if (!string.IsNullOrEmpty(model))
            {
                analyzerNode.SetAttribute("model", model);
            }
            if (!string.IsNullOrEmpty(clazz))
            {
                analyzerNode.SetAttribute("class", clazz);
            }
            if (!string.IsNullOrEmpty(osType))
            {
                analyzerNode.SetAttribute("ostype", osType);
            }
            if (!string.IsNullOrEmpty(osVersion))
            {
                analyzerNode.SetAttribute("osversion", osVersion);
            }

            if (node != null)
            {
                analyzerNode.AppendChild(node.ToXml(document));
            }
            if (process != null)
            {
                analyzerNode.AppendChild(process.ToXml(document));
            }
            if (analyzer != null)
            {
                analyzerNode.AppendChild(analyzer.ToXml(document));
            }

            return(analyzerNode);
        }
        public XmlElement ToXml(XmlDocument document)
        {
            XmlElement targetNode = document.CreateElement("idmef:Target", "http://iana.org/idmef");

            targetNode.SetAttribute("ident", ident);
            targetNode.SetAttribute("decoy", decoy.ToString());
            if (i_face != null)
            {
                targetNode.SetAttribute("interface", i_face);
            }

            if (node != null)
            {
                targetNode.AppendChild(node.ToXml(document));
            }
            if (user != null)
            {
                targetNode.AppendChild(user.ToXml(document));
            }
            if (process != null)
            {
                targetNode.AppendChild(process.ToXml(document));
            }
            if (service != null)
            {
                targetNode.AppendChild(service.ToXml(document));
            }
            if ((file != null) && (file.Length > 0))
            {
                foreach (var f in file)
                {
                    if (f != null)
                    {
                        targetNode.AppendChild(f.ToXml(document));
                    }
                }
            }

            return(targetNode);
        }