argParser.add_argument('-y', type=str, help='Filter results by the year') argParser.add_argument('-k', type=str, help='Search for a cpecific pattern or keyword in the summary') argParser.add_argument('-t', default=False, action='store_true', help='Print a summary of vulnerability types for a chosen software product') args = argParser.parse_args() cvss_lower_bound = args.s if args.s else 0.0 sort_type = -1 if args.l else 1 rankinglookup = args.r namelookup = args.n capeclookup = args.a date = '1997' cves = CVEs.last(rankinglookup=rankinglookup, namelookup=namelookup, capeclookup=capeclookup) printer = CVEFilePrinter(cves=cves, rankinglookup=rankinglookup, namelookup=namelookup, capeclookup=capeclookup) if args.p: if args.y: try: date = args.y datetime.strptime(date, '%Y') date = date_parser.parse(date+'-01-01').isoformat() except ValueError: print('ERROR: wrong year format') sys.exit(0) if args.t: (total, hits) = query.count_keywords(product_pattern=args.p, cvss_lower_bound=cvss_lower_bound, start_year=date) print("TOTAL: %i" % total) print ("-------------------------------------------------\n") for (category, count) in hits.items():
argParser.add_argument('-l', default=False, action='store_true', help='Print fix-related links') args = argParser.parse_args() cvss_lower_bound = args.s if args.s else 0.0 product = args.p keyword = args.k if args.k else '.*' start_year = args.b if args.b else 1997 end_year = args.e if args.e else 2050 start_year = date_parser.parse(str(start_year) + '-01-01').isoformat() end_year = date_parser.parse(str(end_year+1) + '-01-01').isoformat() cves = CVEs.last(rankinglookup='', namelookup='', capeclookup='') printer = CVEFilePrinter(cves=cves, rankinglookup='', namelookup='', capeclookup='') if args.p: if args.d: # print_distinct_cves_to_excel(product, keyword, cvss_lower_bound) dump_fixes(product, keyword) elif args.y: print_cve_counts_by_year_to_excel(product, keyword, cvss_lower_bound) elif args.m: access_complexity = args.c if args.c != None else ".*" print_cve_counts_by_month_to_excel(product, keyword, cvss_lower_bound, access_complexity) elif args.t: (total, hits) = query.count_keywords(product_pattern=args.p, cvss_lower_bound=cvss_lower_bound, start_year=start_year, end_year=end_year) print_summary(total, hits) elif args.l: print_fix_links(product=product, regex=keyword)