Browse Source

small changes

Nikolaos Alexopoulos 7 years ago
parent
commit
cdae435680
8 changed files with 41 additions and 19 deletions
  1. BIN
      .apt-sec.py.swp
  2. BIN
      .apt-sec.swp
  3. BIN
      .cveparse.py.swp
  4. BIN
      .debian_advisory.py.swp
  5. BIN
      .output.ext.swp
  6. 1 1
      .~lock.output.ext#
  7. 40 3
      apt-sec.py
  8. 0 15
      output.ext

BIN
.apt-sec.py.swp


BIN
.apt-sec.swp


BIN
.cveparse.py.swp


BIN
.debian_advisory.py.swp


BIN
.output.ext.swp


+ 1 - 1
.~lock.output.ext#

@@ -1 +1 @@
-,nik,laptop237.tk.informatik.tu-darmstadt.de,14.11.2016 17:47,file:///home/nik/.config/libreoffice/4;
+,nik,laptop237.tk.informatik.tu-darmstadt.de,16.11.2016 14:00,file:///home/nik/.config/libreoffice/4;

+ 40 - 3
apt-sec.py

@@ -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

File diff suppressed because it is too large
+ 0 - 15
output.ext


Some files were not shown because too many files changed in this diff