From acc2d9a0d1ba2a2595c355073e9b3944c09b6dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markku=20Leini=C3=B6?= Date: Sun, 6 Aug 2023 16:51:26 +0300 Subject: [PATCH] Add existing dissector check --- zabbix.lua | 15 ++++++++++++++- zabbixagent.lua | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/zabbix.lua b/zabbix.lua index 2859f93..d722fa6 100644 --- a/zabbix.lua +++ b/zabbix.lua @@ -1,9 +1,22 @@ local plugin_info = { - version = "2023-01-01.1", + version = "2023-08-06.1", author = "Markku Leiniƶ", repository = "https://github.com/markkuleinio/wireshark-zabbix-dissectors", } set_plugin_info(plugin_info) +if Dissector.get("zabbix") then + local ignore_text = "Your Wireshark version already contains Zabbix protocol dissector compiled in. " .. + "Therefore the Zabbix dissector in your local Lua script is ignored:\n" .. + debug.getinfo(1, "S").source:sub(2) .. + "\nDelete/move the script to remove this message." + if gui_enabled() then + local win = TextWindow.new("Note from Zabbix Lua dissector") + win:set(ignore_text) + else + print(ignore_text) + end + return +end local zabbix_protocol = Proto("Zabbix", "Zabbix Protocol") -- for some reason the protocol name is shown in UPPERCASE in Protocol column -- (and in Proto.name), so let's define a string to override that diff --git a/zabbixagent.lua b/zabbixagent.lua index d3650f9..7840a37 100644 --- a/zabbixagent.lua +++ b/zabbixagent.lua @@ -1,9 +1,22 @@ local plugin_info = { - version = "2022-12-17.1", + version = "2023-08-06.1", author = "Markku Leiniƶ", repository = "https://github.com/markkuleinio/wireshark-zabbix-dissectors", } set_plugin_info(plugin_info) +if Dissector.get("zabbix") or Dissector.get("zabbixagent") then + local ignore_text = "Your Wireshark version already contains Zabbix/ZabbixAgent protocol dissector compiled in. " .. + "Therefore the ZabbixAgent dissector in your local Lua script is ignored:\n" .. + debug.getinfo(1, "S").source:sub(2) .. + "\nDelete/move the script to remove this message." + if gui_enabled() then + local win = TextWindow.new("Note from ZabbixAgent Lua dissector") + win:set(ignore_text) + else + print(ignore_text) + end + return +end local zabbixagent_protocol = Proto("ZabbixAgent", "Zabbix Agent Protocol") -- for some reason the protocol name is shown in UPPERCASE in Protocol column -- (and in Proto.name), so let's define a string to override that