mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-31 07:12:23 -07:00
PLG: ICMP v2 + incorrect import #1331
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@ sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
|||||||
|
|
||||||
from const import logPath # noqa: E402, E261
|
from const import logPath # noqa: E402, E261
|
||||||
from plugin_helper import Plugin_Objects # noqa: E402, E261
|
from plugin_helper import Plugin_Objects # noqa: E402, E261
|
||||||
from utils.crypto_utils import string_to_mac_hash # noqa: E402 [flake8 lint suppression]
|
from utils.crypto_utils import string_to_fake_mac # noqa: E402 [flake8 lint suppression]
|
||||||
from logger import mylog, Logger # noqa: E402, E261
|
from logger import mylog, Logger # noqa: E402, E261
|
||||||
from helper import get_setting_value # noqa: E402, E261
|
from helper import get_setting_value # noqa: E402, E261
|
||||||
import conf # noqa: E402, E261
|
import conf # noqa: E402, E261
|
||||||
@@ -120,7 +120,7 @@ def main():
|
|||||||
|
|
||||||
if not mac and fake_mac_enabled:
|
if not mac and fake_mac_enabled:
|
||||||
mylog("verbose", [f"[{pluginName}] Generating FAKE MAC for ip: {ip}"])
|
mylog("verbose", [f"[{pluginName}] Generating FAKE MAC for ip: {ip}"])
|
||||||
mac = string_to_mac_hash(ip)
|
mac = string_to_fake_mac(ip)
|
||||||
|
|
||||||
if not mac:
|
if not mac:
|
||||||
# Skip devices without MAC if fake MAC not allowed
|
# Skip devices without MAC if fake MAC not allowed
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from logger import mylog, Logger # noqa: E402 [flake8 lint suppression]
|
|||||||
from helper import get_setting_value # noqa: E402 [flake8 lint suppression]
|
from helper import get_setting_value # noqa: E402 [flake8 lint suppression]
|
||||||
from const import logPath # noqa: E402 [flake8 lint suppression]
|
from const import logPath # noqa: E402 [flake8 lint suppression]
|
||||||
from models.device_instance import DeviceInstance # noqa: E402 [flake8 lint suppression]
|
from models.device_instance import DeviceInstance # noqa: E402 [flake8 lint suppression]
|
||||||
from utils.crypto_utils import string_to_mac_hash # noqa: E402 [flake8 lint suppression]
|
from utils.crypto_utils import string_to_fake_mac # noqa: E402 [flake8 lint suppression]
|
||||||
import conf # noqa: E402 [flake8 lint suppression]
|
import conf # noqa: E402 [flake8 lint suppression]
|
||||||
from pytz import timezone # noqa: E402 [flake8 lint suppression]
|
from pytz import timezone # noqa: E402 [flake8 lint suppression]
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ def execute_fping(timeout, args, all_devices, plugin_objects, subnets, interface
|
|||||||
else:
|
else:
|
||||||
mylog("none", [f"[{pluginName}] ERROR reverse device lookup failed unexpectedly for {onlineIp}"])
|
mylog("none", [f"[{pluginName}] ERROR reverse device lookup failed unexpectedly for {onlineIp}"])
|
||||||
elif fakeMac:
|
elif fakeMac:
|
||||||
fakeMacFromIp = string_to_mac_hash(onlineIp)
|
fakeMacFromIp = string_to_fake_mac(onlineIp)
|
||||||
plugin_objects.add_object(
|
plugin_objects.add_object(
|
||||||
primaryId = fakeMacFromIp,
|
primaryId = fakeMacFromIp,
|
||||||
secondaryId = onlineIp,
|
secondaryId = onlineIp,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from plugin_helper import Plugin_Objects # noqa: E402 [flake8 lint suppression]
|
|||||||
from logger import mylog, Logger # noqa: E402 [flake8 lint suppression]
|
from logger import mylog, Logger # noqa: E402 [flake8 lint suppression]
|
||||||
from helper import get_setting_value # noqa: E402 [flake8 lint suppression]
|
from helper import get_setting_value # noqa: E402 [flake8 lint suppression]
|
||||||
from const import logPath # noqa: E402 [flake8 lint suppression]
|
from const import logPath # noqa: E402 [flake8 lint suppression]
|
||||||
from utils.crypto_utils import string_to_mac_hash # noqa: E402 [flake8 lint suppression]
|
from utils.crypto_utils import string_to_fake_mac # noqa: E402 [flake8 lint suppression]
|
||||||
import conf # noqa: E402 [flake8 lint suppression]
|
import conf # noqa: E402 [flake8 lint suppression]
|
||||||
from pytz import timezone # noqa: E402 [flake8 lint suppression]
|
from pytz import timezone # noqa: E402 [flake8 lint suppression]
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ def parse_nmap_xml(xml_output, interface, fakeMac):
|
|||||||
if (ip != '' and mac != '') or (ip != '' and fakeMac):
|
if (ip != '' and mac != '') or (ip != '' and fakeMac):
|
||||||
|
|
||||||
if mac == '' and fakeMac:
|
if mac == '' and fakeMac:
|
||||||
mac = string_to_mac_hash(ip)
|
mac = string_to_fake_mac(ip)
|
||||||
|
|
||||||
devices_list.append({
|
devices_list.append({
|
||||||
'name': hostname,
|
'name': hostname,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ from helper import get_setting_value # noqa: E402 [flake8 lint suppression]
|
|||||||
from const import logPath # noqa: E402 [flake8 lint suppression]
|
from const import logPath # noqa: E402 [flake8 lint suppression]
|
||||||
import conf # noqa: E402 [flake8 lint suppression]
|
import conf # noqa: E402 [flake8 lint suppression]
|
||||||
from pytz import timezone # noqa: E402 [flake8 lint suppression]
|
from pytz import timezone # noqa: E402 [flake8 lint suppression]
|
||||||
from utils.crypto_utils import string_to_mac_hash # noqa: E402 [flake8 lint suppression]
|
from utils.crypto_utils import string_to_fake_mac # noqa: E402 [flake8 lint suppression]
|
||||||
|
|
||||||
# Setup timezone & logger using standard NAX helpers
|
# Setup timezone & logger using standard NAX helpers
|
||||||
conf.tz = timezone(get_setting_value('TIMEZONE'))
|
conf.tz = timezone(get_setting_value('TIMEZONE'))
|
||||||
@@ -228,7 +228,7 @@ def gather_device_entries():
|
|||||||
|
|
||||||
# ensure fake mac if enabled
|
# ensure fake mac if enabled
|
||||||
if PIHOLEAPI_FAKE_MAC and is_mac(tmpMac) is False:
|
if PIHOLEAPI_FAKE_MAC and is_mac(tmpMac) is False:
|
||||||
tmpMac = string_to_mac_hash(ip)
|
tmpMac = string_to_fake_mac(ip)
|
||||||
|
|
||||||
entries.append({
|
entries.append({
|
||||||
'mac': tmpMac,
|
'mac': tmpMac,
|
||||||
|
|||||||
Reference in New Issue
Block a user