this get the integrate network card
This commit is contained in:
parent
ebe80ffea6
commit
756570c7b4
|
@ -10,8 +10,9 @@ from evidence.models import Evidence, Annotation
|
||||||
from utils.constants import ALGOS, CHASSIS_DH
|
from utils.constants import ALGOS, CHASSIS_DH
|
||||||
|
|
||||||
|
|
||||||
def get_mac(hwinfo):
|
def get_mac2(hwinfo):
|
||||||
|
# This function get the network card with most lower busid
|
||||||
|
# but maybe is external or maybe is integrate in motherboard
|
||||||
low_ix = None
|
low_ix = None
|
||||||
lnets = []
|
lnets = []
|
||||||
|
|
||||||
|
@ -41,6 +42,23 @@ def get_mac(hwinfo):
|
||||||
return mac
|
return mac
|
||||||
|
|
||||||
|
|
||||||
|
def get_network_cards(child, nets):
|
||||||
|
if child['id'] == 'network':
|
||||||
|
nets.append(child)
|
||||||
|
if child.get('children'):
|
||||||
|
[e(x, nets) for x in child['children']]
|
||||||
|
|
||||||
|
|
||||||
|
def get_mac(lshw):
|
||||||
|
# This funcion get the network card integrated in motherboard
|
||||||
|
nets = []
|
||||||
|
get_network_cards(lshw, nets)
|
||||||
|
integrate = [x for x in nets if "pci@0000:00:" in x.get('businfo', '')]
|
||||||
|
|
||||||
|
if integrate:
|
||||||
|
return integrate[0]['serial']
|
||||||
|
|
||||||
|
|
||||||
class Build:
|
class Build:
|
||||||
def __init__(self, evidence_json, user, check=False):
|
def __init__(self, evidence_json, user, check=False):
|
||||||
self.json = evidence_json
|
self.json = evidence_json
|
||||||
|
|
Loading…
Reference in a new issue