add inxi in parsing and show in details of devs

This commit is contained in:
Cayo Puigdefabregas 2024-11-15 12:47:08 +01:00
parent 85bae67189
commit d1abb206e8
2 changed files with 17 additions and 19 deletions

View file

@ -63,7 +63,7 @@ class Evidence:
def get_phid(self):
if not self.doc:
self.get_doc()
return hashlib.sha3_256(json.dumps(self.doc)).hexdigest()
def get_doc(self):
@ -89,26 +89,23 @@ class Evidence:
self.inxi = ev["output"]
else:
dmidecode_raw = self.doc["data"]["dmidecode"]
inxi_raw = self.doc["data"]["inxi"]
self.dmi = DMIParse(dmidecode_raw)
try:
self.inxi = json.loads(self.doc["data"]["inxi"])
self.inxi = json.loads(inxi_raw)
machine = get_inxi_key(self.inxi, 'Machine')
for m in machine:
system = get_inxi(m, "System")
if system:
self.device_manufacturer = system
self.device_model = get_inxi(m, "product")
self.device_serial_number = get_inxi(m, "serial")
self.device_chassis = get_inxi(m, "Type")
self.device_version = get_inxi(m, "v")
except Exception:
return
self.dmi = DMIParse(dmidecode_raw)
try:
machine = get_inxi_key(self.inxi, 'Machine')
for m in machine:
system = get_inxi(m, "System")
if system:
self.device_manufacturer = system
self.device_model = get_inxi(m, "product")
self.device_serial_number = get_inxi(m, "serial")
self.device_chassis = get_inxi(m, "Type")
self.device_version = get_inxi(m, "v")
except Exception:
return
def get_time(self):
if not self.doc:
self.get_doc()
@ -160,6 +157,9 @@ class Evidence:
if self.inxi:
return self.device_chassis
if self.inxi:
return self.device_chassis
chassis = self.dmi.get("Chassis")[0].get("Type", '_virtual')
lower_type = chassis.lower()
@ -177,7 +177,6 @@ class Evidence:
return self.dmi.serial_number().strip()
def get_version(self):
if self.inxi:
return self.device_version

View file

@ -14,7 +14,6 @@ from django.conf import settings
if settings.DPP:
from dpp.api_dlt import register_device_dlt, register_passport_dlt
logger = logging.getLogger('django')