internal SatoriDhcpOsFingerprinter(string satoriDhcpXmlFilename) { fingerprintList = new List <DhcpFingerprint>(); System.IO.FileStream fileStream = new FileStream(satoriDhcpXmlFilename, FileMode.Open, FileAccess.Read); System.Xml.XmlDocument dhcpXml = new System.Xml.XmlDocument(); dhcpXml.Load(fileStream); XmlNode fingerprintsNode = dhcpXml.DocumentElement.FirstChild; //System.Xml.XPath.XPathNavigator navigator=dhcpXml.CreateNavigator(); System.Xml.XPath.XPathNavigator navigator = fingerprintsNode.CreateNavigator(); foreach (XPathNavigator fingerprintNavigator in navigator.Select("fingerprint")) { string osClass = fingerprintNavigator.GetAttribute("os_class", ""); string os = fingerprintNavigator.GetAttribute("os_name", ""); if (os == null || os.Length == 0) { os = fingerprintNavigator.GetAttribute("name", ""); } //string os=fingerprintNavigator.GetAttribute("os",""); DhcpFingerprint fingerprint = new DhcpFingerprint(os, osClass); this.fingerprintList.Add(fingerprint); foreach (XPathNavigator testNav in fingerprintNavigator.Select("dhcp_tests/test")) //used to be "tests/test" { fingerprint.AddTest(testNav.Clone()); } } }
private SatoriDhcpOsFingerprinter(System.IO.Stream fingerprintXmlStream) { fingerprintList = new List <DhcpFingerprint>(); System.Xml.XmlDocument dhcpXml = new System.Xml.XmlDocument(); dhcpXml.Load(fingerprintXmlStream); XmlNode fingerprintsNode = dhcpXml.DocumentElement.FirstChild; //System.Xml.XPath.XPathNavigator navigator=dhcpXml.CreateNavigator(); System.Xml.XPath.XPathNavigator navigator = fingerprintsNode.CreateNavigator(); foreach (XPathNavigator fingerprintNavigator in navigator.Select("fingerprint")) { string osClass = fingerprintNavigator.GetAttribute("os_class", ""); string os = fingerprintNavigator.GetAttribute("os_name", ""); if (os == null || os.Length == 0) { os = fingerprintNavigator.GetAttribute("name", ""); } string deviceType = fingerprintNavigator.GetAttribute("device_type", ""); string deviceVendor = fingerprintNavigator.GetAttribute("device_vendor", ""); //string os=fingerprintNavigator.GetAttribute("os",""); DhcpFingerprint fingerprint = new DhcpFingerprint(os, osClass, deviceType, deviceVendor); this.fingerprintList.Add(fingerprint); foreach (XPathNavigator testNav in fingerprintNavigator.Select("dhcp_tests/test")) //used to be "tests/test" { fingerprint.AddTest(testNav.Clone()); } } }