From 4839211fe148fa7b09b3fa6fbaffc6e6cd9125ae Mon Sep 17 00:00:00 2001 From: elraro Date: Fri, 6 Sep 2024 00:23:17 +0200 Subject: [PATCH] chore: fixed mtscan --- front/plugins/mikrotik_scan/mikrotik.py | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/front/plugins/mikrotik_scan/mikrotik.py b/front/plugins/mikrotik_scan/mikrotik.py index 926ba357..1d627dde 100755 --- a/front/plugins/mikrotik_scan/mikrotik.py +++ b/front/plugins/mikrotik_scan/mikrotik.py @@ -75,19 +75,21 @@ def get_entries(plugin_objects: Plugin_Objects) -> Plugin_Objects: host_name = lease.get('host-name') comment = lease.get('comment') last_seen = lease.get('last-seen') + status = lease.get('status') - mylog('verbose', [f"ID: {lease_id}, Address: {address}, MAC Address: {mac_address}, Host Name: {host_name}, Comment: {comment}, Last Seen: {last_seen}"]) - - plugin_objects.add_object( - primaryId = mac_address, - secondaryId = '', - watched1 = address, - watched2 = host_name, - watched3 = last_seen, - watched4 = '', - extra = '', - helpVal1 = comment, - foreignKey = mac_address) + mylog('verbose', [f"ID: {lease_id}, Address: {address}, MAC Address: {mac_address}, Host Name: {host_name}, Comment: {comment}, Last Seen: {last_seen}, Status: {status}"]) + + if (status == "bound"): + plugin_objects.add_object( + primaryId = mac_address, + secondaryId = '', + watched1 = address, + watched2 = host_name, + watched3 = last_seen, + watched4 = '', + extra = '', + helpVal1 = comment, + foreignKey = mac_address) except TrapError as e: mylog('error', [f"An error occurred: {e}"])