8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 15:12:25 +00:00

Auto format MAC addresses inmachine history search

This commit is contained in:
Jean-Romain Garnier 2020-04-24 23:02:55 +02:00 committed by Gabriel Detraz
parent 5b687ec203
commit 1f622d19f1

View file

@ -26,6 +26,7 @@ from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.db.models import Q from django.db.models import Q
from django.apps import apps from django.apps import apps
from netaddr import EUI
from machines.models import IpList from machines.models import IpList
from machines.models import Interface from machines.models import Interface
@ -149,9 +150,16 @@ class MachineHistorySearch:
self.events = [] self.events = []
if search_type == "ip": if search_type == "ip":
try:
return self._get_by_ip(search)[::-1] return self._get_by_ip(search)[::-1]
except:
pass
elif search_type == "mac": elif search_type == "mac":
try:
search = EUI(search)
return self._get_by_mac(search)[::-1] return self._get_by_mac(search)[::-1]
except:
pass
return None return None