Skip to content

WSLUA: Add new lua function register_packet_menu()

Moshe Kaplan requested to merge moshekaplan/wireshark:lua_packet_menus into master

This adds support to Wireshark for custom context menus for packets, so that when a packet's context menu is opened (e.g., by right-clicking), Wireshark can support doing things like "run a program" or "open a URL" with a field from the packet as a parameter. Note that this is similar to ArcSight's integration commands feature.

For example, it could be used like the following:

local function search_robtex(...)
    local fields = {...};
    for i, field in ipairs( fields ) do
        if (field.name == 'http.host') then
            browser_open_url("https://www.robtex.com/dns-lookup/" .. field.value)
            break
        end
    end
end

local function search_google(...)
    local fields = {...};
    for i, field in ipairs( fields ) do
        if (field.name == 'http.host') then
            browser_open_url("https://www.google.com/search?q=" .. field.value)
            break
        end
    end
end

register_packet_menu("HTTP/Search host in Robtex", search_robtex, "http.host");
register_packet_menu("HTTP/Search host in Google", search_google, "http.host");

Fixes issue #14998 (closed)

Edited by Moshe Kaplan

Merge request reports