Commit Graph

28 Commits

Author SHA1 Message Date
Moshe Kaplan f413260df9 WSLUA: Add new lua function register_packet_menu()
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:

```
ROBTEX_URL = "https://www.robtex.com/dns-lookup/"
local function search_robtex(...)
    local fields = {...};

    for i, field in ipairs( fields ) do
        if (field.name == 'http.host') then
            browser_open_url(ROBTEX_URL .. field.value)
            break
        end
    end
end
register_packet_menu("Search host in Robtex", search_robtex, "http.host");
```

Fixes issue #14998
2022-12-07 18:47:14 +00:00
Gerald Combs 647978b8be Qt: Manually connect our "Analyze" menu actions. 2022-12-04 22:54:01 +00:00
João Valverde a0d77e9329 dfilter: Return an error object instead of string
Return an struct containing error information. This simplifies
the interface to more easily provide richer diagnostics in the future.

Add an error code besides a human-readable error string to allow
checking programmatically for errors in a robust manner. Currently
there is only a generic error code, it is expected to increase
in the future.

Move error location information to the struct. Change callers and
implementation to use the new interface.
2022-11-28 15:46:44 +00:00
Chuck Craft 81bd7b1415 Qt: filter_dialog - make Cancel button functional
Works properly when called from Capture/Display filter bookmark.
This change duplicates that code.
2022-10-31 14:14:00 +00:00
Patricia Lindner ceed050c47 LTP: Enhance with generated items, sequence analysis, and statistics
This change adds computed values for reports, sequence analysis between
segments, conversation and endpoint taps, and a new statistics menu
and dialog.
2022-10-13 09:30:55 +00:00
João Valverde afa2579124 Qt: Fix compilation with Qt 6.4
error: conversion function from 'gchar *' (aka 'char *') to 'QVariant' invokes a deleted function
            return entry->hostname;
                   ^~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qvariant.h:199:5: note: 'QVariant<char *, false>' has been explicitly marked deleted here
    QVariant(T) = delete;
    ^
2022-10-01 21:53:11 +01:00
Gerald Combs 7d3a50a02e Qt: Fix our packet comment connections.
Use new-style connections for our packet comment actions. Fix our slots
to match 24a09965e6.
2022-09-28 10:19:31 -07:00
Gerald Combs fcdb77dce9 Qt: Manually connect our "Capture" menu actions. 2022-09-25 14:25:21 -07:00
Gerald Combs fc461d1592 Qt: Manually connect our "Go" menu actions. 2022-09-25 13:37:37 -07:00
Gerald Combs a135d741a7 Qt: Manually connect our "View" menu actions. 2022-09-25 19:50:34 +00:00
Gerald Combs 24a09965e6 Qt: More menu action cleanup.
We use the convention "actionSomeThing" for action names. Rename some
member functions that used that convention.

Manually connect another action.
2022-09-24 16:03:00 -07:00
Gerald Combs de387814bb Qt: Manually connect our "File" menu actions. 2022-09-23 19:41:32 +00:00
Gerald Combs 720090fb86 Qt: Manually connect more "Edit" menu actions.
Followup to ce44047584.
2022-09-23 19:38:07 +00:00
Gerald Combs ce44047584 Qt: Manually connect our "Edit" menu actions.
Use manual, new-style connections for each of our "Edit" menu actions.
KDE's clazy project recommends them over auto-connnections:

https://github.com/KDE/clazy/blob/1.11/docs/checks/README-connect-by-name.md

Use queued connections for the mark, ignore, and other actions that might
run a nested event loop.
Fixes #18344.
2022-09-20 16:39:30 +00:00
Tomasz Moń 6346cf945a Qt: Connect menu actions with Qt::QueuedConnection
Prevent crash due to premature menu object deletion caused by call to
QCoreApplication::processEvents() by executing the slot only after menu
handling has finished.

Fixes #18251 and #18270
2022-09-10 22:34:48 +00:00
Tomasz Moń 2d1380ae5b
capture: Move capture pipe polling out of UI
Both CLI and Qt interfaces spin GLib mainloop. Move the capture pipe
polling into common code to reduce code duplication.
2022-07-30 16:42:12 +02:00
Roland Knall f210edeaf0 Ui: Further simplify ws_ui_util
Remove duplicate functionality for jumping to packet and
remove unused function to move to the end. Furthermore
move the code for redraws of visible packets directly
into the calling code
2022-06-28 14:39:27 +02:00
Roland Knall ef8ed9dff9 Ui: Remove time column reformat callback
The code can be placed directly to packet list model
and does not need to be a generic callback
2022-06-28 14:23:05 +02:00
Roland Knall 1d42fcdd76 Ui: Remove call to recoloring
No callback needed, we can call the model directly
2022-06-28 14:06:49 +02:00
Roland Knall 212abb7efe Qt: Autoset limit to display filter for expert dialog
Autoset the "Limit to display filter" if a display filter
was present, when the dialog was opened
2022-06-12 15:30:12 +00:00
Roland Knall 3029a4a4d9 Qt: Remove unnecessary cli option
There was an option that was never used, in that you
could set your protocol tap as a first tab in the
Conversations and Endpoint dialogs.
2022-06-08 17:42:58 +02:00
John Thacker ea2ddd40f5 Qt: Fix leak in CaptureFileDialog
Instead of instantiating CaptureFileDialog with a reference to
the filter (which means allocating a new empty QString when using
it for Save As and Export Packets, which don't use a filter), pass
the filter reference into the open and merge functions.

This plugs a memory leak that happened each time the Save As or
Export Packets dialog was created.
2022-06-02 12:31:01 +00:00
John Thacker e1a6913a2b qt: Ignore gcc 12.1 optimization bug with Qt
The Qt implicit casts from QByteArray to QString all use
size = -1, meaning to the end of the string.

This causes gcc 12.1 with -O2 to produce a very dubious stringop-overread
warning, by computing both sides of a branch even when it shouldn't:

/usr/include/qt5/QtCore/qstring.h:706:69: error: ‘size_t strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
  706 |         return fromUtf8_helper(str, (str && size == -1) ? int(strlen(str)) : size);
      |                                                               ~~~~~~^~~~~

There's also a similar error with QByteArray.constData(), even though
isEmpty() should return True when the QByteArray is NULL.
(Adding isNull() prevents the warning but is redundant.)

Use DIAG_OFF and DIAG_ON to ignore the warning on GCC 12.1 and higher.
Fix #18090.
2022-05-23 12:14:03 +00:00
Roland Knall aca0c5d175 Qt: Remove unrequired setTab
setTab(0) should not be required, as this belongs in the constructor as being
part of the general setup of the dialog itself. Outside code should not setup
the correct startview of the dialog.

(the problem exists in the first place, as the wrong tab may be selected via
the .ui file after editing that)
2022-04-22 17:05:29 +00:00
Roland Knall 374c5997da Qt: Remove unnecessary signal/slot
getPoints never worked in the new system therefore it is removed. SparkLineDelegate uses the underlying model to ensure the correct data being transmitted
2022-04-22 09:37:10 +00:00
Gerald Combs ca04f4c8cb Qt: Update our dynamic menu groups.
Add log-specific statistics groups, and use them to limit the dynamic
menu items in Wireshark and Logwolf.
2022-04-12 12:14:03 -07:00
Chuck Craft 6e9b19dcb0 Qt: only Show/Export Packet Bytes when field is selected and has_packet_bytes
This will also exclude generated [] and Lua added fields.
2022-04-08 18:47:42 +00:00
Gerald Combs d8008cb89e Qt: Split MainWindow into WiresharkMainWindow and LogwolfMainWindow.
Rename the main_window class and UIC files to wireshark_main_window and
the MainWindow class to WiresharkMainWindow. Copy wireshark_main_window
/ WiresharkMainWindow to logwolf_main_window / LogwolfMainWindow.

Remove the Wireless menu from Logwolf.
2022-04-04 09:39:27 -07:00