8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +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 Jean-Romain Garnier
parent e7e99ce9fe
commit a4b5f898c8

View file

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