Skip to content

Commit

Permalink
Add existing dissector check
Browse files Browse the repository at this point in the history
  • Loading branch information
markkuleinio committed Aug 6, 2023
1 parent c82448f commit acc2d9a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion zabbix.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down
15 changes: 14 additions & 1 deletion zabbixagent.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit acc2d9a

Please sign in to comment.