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.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":
|
||||
try:
|
||||
return self._get_by_ip(search)[::-1]
|
||||
except:
|
||||
pass
|
||||
elif search_type == "mac":
|
||||
try:
|
||||
search = EUI(search)
|
||||
return self._get_by_mac(search)[::-1]
|
||||
except:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in a new issue