<menu id="guoca"></menu>
<nav id="guoca"></nav><xmp id="guoca">
  • <xmp id="guoca">
  • <nav id="guoca"><code id="guoca"></code></nav>
  • <nav id="guoca"><code id="guoca"></code></nav>

    Global Functions

    gui_enabled()

    Checks if we’re running inside a GUI (i.e. Wireshark) or not.

    Returns

    Boolean true if a GUI is available, false if it isn’t.

    register_menu(name, action, [group])

    Register a menu item in one of the main menus. Requires a GUI.

    Arguments

    name

    The name of the menu item. Use slashes to separate submenus. (e.g. Lua Scripts → My Fancy Statistics). (string)

    action

    The function to be called when the menu item is invoked. The function must take no arguments and return nothing.

    group (optional)

    Where to place the item in the menu hierarchy. If omitted, defaults to MENU_STAT_GENERIC. One of:

    • MENU_STAT_UNSORTED: Statistics
    • MENU_STAT_GENERIC: Statistics, first section
    • MENU_STAT_CONVERSATION: Statistics → Conversation List
    • MENU_STAT_ENDPOINT: Statistics → Endpoint List
    • MENU_STAT_RESPONSE: Statistics → Service Response Time
    • MENU_STAT_TELEPHONY: Telephony
    • MENU_STAT_TELEPHONY_ANSI: Telephony → ANSI
    • MENU_STAT_TELEPHONY_GSM: Telephony → GSM
    • MENU_STAT_TELEPHONY_LTE: Telephony → LTE
    • MENU_STAT_TELEPHONY_MTP3: Telephony → MTP3
    • MENU_STAT_TELEPHONY_SCTP: Telephony → SCTP
    • MENU_ANALYZE: Analyze
    • MENU_ANALYZE_CONVERSATION: Analyze → Conversation Filter
    • MENU_TOOLS_UNSORTED: Tools

      new_dialog(title, action, …?)

      Displays a dialog, prompting for input. The dialog includes an OK button and Cancel button. Requires a GUI.

    Global Functions

    Example

        if not gui_enabled() then return end
    
        -- Prompt for IP and port and then print them to stdout
        local label_ip = "IP address"
        local label_port = "Port"
        local function print_ip(ip, port)
                print(label_ip, ip)
                print(label_port, port)
        end
        new_dialog("Enter IP address", print_ip, label_ip, label_port)
    
        -- Prompt for 4 numbers and then print their product to stdout
        new_dialog(
                "Enter 4 numbers",
                function (a, b, c, d) print(a * b * c * d) end,
                "a", "b", "c", "d"
                )
    Arguments

    title
    The title of the dialog.
    action
    Action to be performed when the user presses OK.

    Errors
    • GUI not available
    • At least one field required
    • All fields must be strings

    retap_packets()

    Rescans all packets and runs each tap listener without reconstructing the display.

    copy_to_clipboard(text)

    Copy a string into the clipboard. Requires a GUI.

    Arguments

    text

    The string to be copied into the clipboard.

    open_capture_file(filename, filter)

    Open and display a capture file. Requires a GUI.

    Arguments

    filename

    The name of the file to be opened.

    filter

    The display filter to be applied once the file is opened.

    get_filter()

    Get the main filter text.

    set_filter(text)

    Set the main filter text.

    Arguments

    text

    The filter’s text.

    get_color_filter_slot(row)

    Gets the current packet coloring rule (by index) for the current session. Wireshark reserves 10 slots for these coloring rules. Requires a GUI.

    Arguments

    row

    The index (1-10) of the desired color filter value in the temporary coloring rules list.

    Index RGB (hex) Color
    1 ffc0c0 pink 1
    2 ffc0ff pink 2
    3 e0c0e0 purple 1
    4 c0c0ff purple 2
    5 c0e0e0 green 1
    6 c0ffff green 2
    7 c0ffc0 green 3
    8 ffffc0 yellow 1
    9 e0e0c0 yellow 2
    10 e0e0e0 gray

    set_color_filter_slot(row, text)

    Sets a packet coloring rule (by index) for the current session. Wireshark reserves 10 slots for these coloring rules. Requires a GUI.

    Arguments

    row

    The index (1-10) of the desired color in the temporary coloring rules list. The default foreground is black and the default backgrounds are listed below.

    Table 11.2. Default background colors

    Index RGB (hex) Color
    1 ffc0c0 pink 1
    2 ffc0ff pink 2
    3 e0c0e0 purple 1
    4 c0c0ff purple 2
    5 c0e0e0 green 1
    6 c0ffff green 2
    7 c0ffc0 green 3
    8 ffffc0 yellow 1
    9 e0e0c0 yellow 2
    10 e0e0e0 gray

    The color list can be set from the command line using two unofficial preferences: gui.colorized_frame.bg and gui.colorized_frame.fg, which require 10 hex RGB codes (6 hex digits each), e.g.

    wireshark -o gui.colorized_frame.bg:${RGB0},${RGB1},${RGB2},${RGB3},${RGB4},${RGB5},${RGB6},${RGB7},${RGB8},${RGB9}

    For example, this command yields the same results as the table above (and with all foregrounds set to black):

    wireshark -o gui.colorized_frame.bg:ffc0c0,ffc0ff,e0c0e0,c0c0ff,c0e0e0,c0ffff,c0ffc0,ffffc0,e0e0c0,e0e0e0 -o gui.colorized_frame.fg:000000,000000,000000,000000,000000,000000,000000,000000

    text

    The display filter for selecting packets to be colorized .

    apply_filter()

    Apply the filter in the main filter box. Requires a GUI.

    reload()

    Reload the current capture file. Deprecated. Use reload_packets() instead.

    reload_packets()

    Reload the current capture file. Requires a GUI.

    reload_lua_plugins()

    Reload all Lua plugins.

    browser_open_url(url)

    Opens an URL in a web browser. Requires a GUI.

    Arguments

    url

    The url.

    browser_open_data_file(filename)

    Open a file located in the data directory (specified in the Wireshark preferences) in the web browser. If the file does not exist, the function silently ignores the request. Requires a GUI.

    Arguments

    filename

    The file name.

    本文章首發在 網安wangan.com 網站上。

    上一篇 下一篇
    討論數量: 0
    只看當前版本


    暫無話題~
    亚洲 欧美 自拍 唯美 另类