Пример #1
0
        static void GetJvnInfo(string jvnid)
        {
            var doc = XDocument.Parse(MyJvnApi.getVulnDetailInfoAsString(jvnid).Result);

            Console.WriteLine(doc);
            return;

            var title = doc.XPathSelectElement("//vuldef:Title", MyJvnApi.NamespaceManager);

            Console.WriteLine($"# {jvnid} : {title.Value}");

            //Console.WriteLine(title.Value);
            foreach (var e in doc.XPathSelectElements("//vuldef:AffectedItem", MyJvnApi.NamespaceManager))
            {
                //var vendorName = e.XPathSelectElement(".//vuldef:Name", MyJvnApi.NamespaceManager);
                var productName    = e.XPathSelectElement(".//vuldef:ProductName", MyJvnApi.NamespaceManager);
                var versionNumbers = e.XPathSelectElements(".//vuldef:VersionNumber", MyJvnApi.NamespaceManager);
                Console.WriteLine($"## {productName.Value}");
                foreach (var version in versionNumbers)
                {
                    Console.WriteLine($"- {version.Value}");
                }
                break;
                Console.Write("(");
                foreach (var v in versionNumbers)
                {
                    Console.Write($"	{v.Value}");
                }
            }
        }
Пример #2
0
        static void WriteJvnDetail(string jvnid)
        {
            var doc = XDocument.Parse(MyJvnApi.getVulnDetailInfoAsString(jvnid).Result);

            File.WriteAllText(@"d:\work\myjvnapi_test\" + jvnid + ".xml", doc.ToString());
        }