|
@@ -16,6 +16,8 @@ import cveparse as cv
|
|
|
import matplotlib.pyplot as plt
|
|
|
import numpy as np
|
|
|
from dateutil import parser
|
|
|
+import plotly.plotly as py
|
|
|
+import plotly.graph_objs as go
|
|
|
|
|
|
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
|
|
|
## Increase the recursion limit by much to allow bs to parse large files
|
|
@@ -460,7 +462,7 @@ def processCVEs(pkg, now, src2dsa, dsa2cve, cvetable, config):
|
|
|
|
|
|
count = sum(cvestats.values())
|
|
|
print(pkg + ' ' + str(count))
|
|
|
- if pkg == 'linux-2.6':
|
|
|
+ if pkg == 'openssl':
|
|
|
# print(src2dsa[pkg])
|
|
|
pkg_plot(pkg, cvestats)
|
|
|
|
|
@@ -485,9 +487,44 @@ def pkg_plot(pkg, cvestats):
|
|
|
for data_dict in items:
|
|
|
x.append(parser.parse(data_dict[0]))
|
|
|
y.append(data_dict[1])
|
|
|
-
|
|
|
- plt.plot_date(x, y)
|
|
|
|
|
|
+ monthyear = []
|
|
|
+ year = []
|
|
|
+ # initialize list
|
|
|
+ for i in range(1995,2017):
|
|
|
+ temp = []
|
|
|
+ for j in range(12):
|
|
|
+ temp.append(0)
|
|
|
+ monthyear.append(temp)
|
|
|
+
|
|
|
+ for i in range(len(x)):
|
|
|
+# print(str(x[i].year) + str(x[i].month))
|
|
|
+ monthyear[x[i].year-1995][x[i].month-1] += y[i]
|
|
|
+
|
|
|
+ #flatten list
|
|
|
+ newy = [item for sublist in monthyear for item in sublist]
|
|
|
+ newx = []
|
|
|
+ yearsx = []
|
|
|
+ year = []
|
|
|
+
|
|
|
+ for i in range(len(monthyear)):
|
|
|
+ year.append(0)
|
|
|
+ cc = 0
|
|
|
+ for j in range(len(monthyear[i])):
|
|
|
+ cc += monthyear[i][j]
|
|
|
+ year[i] = cc
|
|
|
+
|
|
|
+ for i in range(len(year)):
|
|
|
+ yearsx.append(i + 1995)
|
|
|
+
|
|
|
+ for i in range(len(newy)):
|
|
|
+ newx.append(i)
|
|
|
+
|
|
|
+ print(year)
|
|
|
+# plt.plot.hist(yearsx,year)
|
|
|
+ plt.bar(yearsx, year, 1, color='blue')
|
|
|
+
|
|
|
+
|
|
|
# plt.legend(data_dict.keys())
|
|
|
plt.show()
|
|
|
return 0
|