8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Fix searching for malformated IP or MAC addresses in machine history search

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

View file

@ -27,6 +27,7 @@ from django.contrib.auth.models import Group
from django.db.models import Q
from django.apps import apps
from netaddr import EUI
macaddress.fields import default_dialect
from machines.models import IpList
from machines.models import Interface
@ -156,12 +157,12 @@ class MachineHistorySearch:
pass
elif search_type == "mac":
try:
search = EUI(search)
search = EUI(search, dialect=default_dialect())
return self._get_by_mac(search)[::-1]
except:
pass
return None
return []
def _add_revision(self, user, machine, interface):
"""