## find all packages for each bin pkg10 = pkg_subset(graphdata,cve10) pkg7 = pkg_subset(graphdata,cve7) pkg5 = pkg_subset(graphdata,cve5) pkg0 = pkg_subset(graphdata,cve0) ## find all servers for each bin svr10 = svr_subset(graphdata, pkg10) svr7 = svr_subset(graphdata, pkg7) svr5 = svr_subset(graphdata, pkg5) svr0 = svr_subset(graphdata, pkg0) cvebins[d]['1. Worst CVSS=10'] = len(svr10) cvebins[d]['2. Critical 7 <= CVSS <10'] = len(svr7) cvebins[d]['3. Medium 5 <= CVSS <7'] = len(svr5) cvebins[d]['4. Low 0 <= CVSS <5'] = len(svr0) mypprint(cvebins) params = {} params['filename'] = outfilename params['title'] = 'Servers With CVEs by Date' params['ylabel'] = 'Number of Servers That Have 1 or more package-versions with a CVE' params['xlabel'] = 'Dates' params['colors'] = ['lime', 'gold', 'blueviolet', 'red'] # linestyles can be str 'dotted' or tuple (0, (1, 5)) params['linestyle'] = [(0, (1, 2)), (0, (3, 1, 1, 1)), (0, (5, 3)), 'solid'] multi_line_image(cvebins, params)
## output will be a dictionary (date as key) of dictionaries ## per-date dictionaries will have keys of groups and total ## input is two environmental variables: GDBPATH, DATELIST ## GDBPATH is path to graphdb directory ## DATELIST is ascii text of python list of dates of form yyyy.mm.dd ## command line should contain filename for output image if (len(sys.argv) != 2): print("There should be one argument, filename for output image") exit() else: f = sys.argv[1] data = multi_date_number_servers() params = {} params['filename'] = f params['title'] = 'Number of Servers by Date' params['ylabel'] = 'Number of Servers' params['xlabel'] = 'Dates' params['colors'] = [ 'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:brown' ] # linestyles can be str 'dotted' or tuple (0, (1, 5)) params['linestyle'] = [(0, (1, 2)), (0, (3, 1, 1, 1)), (0, (5, 3)), 'solid', (0, (3, 1, 1, 3, 1, 1))] multi_line_image(data, params)