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:
parent
e7e99ce9fe
commit
a4b5f898c8
1 changed files with 10 additions and 2 deletions
|
@ -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":
|
||||||
return self._get_by_ip(search)[::-1]
|
try:
|
||||||
|
return self._get_by_ip(search)[::-1]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
elif search_type == "mac":
|
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
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue