Adding infos related to the capture in the generated report

This commit is contained in:
Félix Aime
2021-01-08 11:49:30 +01:00
parent 68bcf39451
commit f465d46d92
2 changed files with 29 additions and 8 deletions

View File

@ -20,7 +20,8 @@ class Report(object):
capture_directory, "assets/conns.json"))
self.device = self.read_json(os.path.join(
capture_directory, "assets/device.json"))
self.capinfos = self.read_json(os.path.join(
capture_directory, "assets/capinfos.json"))
try:
with open(os.path.join(self.capture_directory, "capture.pcap"), "rb") as f:
self.capture_sha1 = hashlib.sha1(f.read()).hexdigest()
@ -184,7 +185,10 @@ class Report(object):
self.device["mac_address"])
header += "Report generated on {}<br />".format(
datetime.now().strftime("%d/%m/%Y at %H:%M:%S"))
header += "Capture duration: {}<br />".format(
self.capinfos["Capture duration"])
header += "Number of packets: {}<br />".format(
self.capinfos["Number of packets"])
header += "Capture SHA1: {}<br />".format(self.capture_sha1)
header += "</p>"
header += "</div>"