mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
Fix searching for malformated IP or MAC addresses in machine history search
This commit is contained in:
parent
a4b5f898c8
commit
d881833488
1 changed files with 3 additions and 2 deletions
|
@ -27,6 +27,7 @@ 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 netaddr import EUI
|
||||||
|
macaddress.fields import default_dialect
|
||||||
|
|
||||||
from machines.models import IpList
|
from machines.models import IpList
|
||||||
from machines.models import Interface
|
from machines.models import Interface
|
||||||
|
@ -156,12 +157,12 @@ class MachineHistorySearch:
|
||||||
pass
|
pass
|
||||||
elif search_type == "mac":
|
elif search_type == "mac":
|
||||||
try:
|
try:
|
||||||
search = EUI(search)
|
search = EUI(search, dialect=default_dialect())
|
||||||
return self._get_by_mac(search)[::-1]
|
return self._get_by_mac(search)[::-1]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return None
|
return []
|
||||||
|
|
||||||
def _add_revision(self, user, machine, interface):
|
def _add_revision(self, user, machine, interface):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue