Skip to content

Commit

Permalink
now outputs xlsx and html
Browse files Browse the repository at this point in the history
  • Loading branch information
boberito authored Sep 14, 2022
1 parent 957672f commit c10058b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions mscp_local_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
Reference
)
from openpyxl.chart.series import DataPoint
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import base64
from io import BytesIO


def validate_file(arg):
if (file := Path(arg)).is_file():
Expand Down Expand Up @@ -71,3 +77,20 @@ def validate_file(arg):
else:
savefile = args.output + ".xlsx"
wb.save(savefile)

wb = pd.read_excel(savefile)
htmlsavefile = savefile.replace(".xlsx",".html")
wb.to_html(htmlsavefile)

y = np.array([failed,passed])
mylabels = ["Failed","Passed"]
plt.pie(y, labels = mylabels)
plt.legend(title = "Compliance Scan Results")
# plt.show()
pngsavefile = savefile.replace(".xlsx",".png")
plt.savefig(pngsavefile,dpi=72)

html = '<img src="{}"><br>0 = Passed<br>1 = Finding'.format(pngsavefile)

with open(htmlsavefile, 'r') as original: data = original.read()
with open(htmlsavefile, 'w') as modified: modified.write(html + data)

0 comments on commit c10058b

Please sign in to comment.