Commit Graph

25 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
Dario Lombardo ea929d6401 wsutils: add local implementation of g_memdup2.
g_memdup() was deprecated and replaced with g_memdup2() in GLib 2.68,
we provide our own copy of g_memdup2() for older GLib versions.
2021-03-25 09:38:10 +00:00
Moshe Kaplan e16166a74c Detect and replace bad allocation patterns
Adds a pre-commit hook for detecting and replacing
occurrences of `g_malloc()` and `wmem_alloc()` with
`g_new()` and `wmem_new()`, to improve the
readability of Wireshark's code, and
occurrences of
`g_malloc(sizeof(struct myobj) * foo)`
with
`g_new(struct myobj, foo)`
to prevent integer overflows

Also fixes all existing occurrences across
the codebase.
2020-12-22 14:56:38 +00:00
Stig Bjørlykke 499d912f4b funnel: Free callback data
Free allocated callback data in FunnelStringDialog, TextWindow and
registered menu items. Also free strings used in FunnelStringDialog.

Bug: 16177
Change-Id: I9a129b8975a55d1dc89fe851116feebe82763bca
Reviewed-on: https://code.wireshark.org/review/34945
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-11-05 15:21:30 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Stig Bjørlykke 6cab8c57bd funnel: Fix memleaks in funnel_remove_menu
The loop to remove all matching callbacks was skipping every second
entry which would give some leaks when reloading Lua plugins.

Add funnel_cleanup() to be called in epan_cleanup() at shutdown
to remove all allocated menu entries.

Change-Id: I3a50ba2070c8675fee1385f25e9e109db57c2dc5
Reviewed-on: https://code.wireshark.org/review/31769
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2019-01-28 10:57:30 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
João Valverde 14c68a3631 Fix warning for funnel.c [-Wcast-qual]
Change-Id: Ib80b2f56ab76d72e89f6a0fbe2d0903d1029ed19
Reviewed-on: https://code.wireshark.org/review/13448
Reviewed-by: João Valverde <j@v6e.pt>
2016-01-21 02:44:10 +00:00
Stig Bjørlykke ecc4f756bd Added Reload Lua plugins.
This is initial support for reloading Lua plugins without
restarting the application.

Still todo:
- Deregister FileHandlers
- Support deregister ProtoField with existing abbrev (same_name_hfinfo)
- Add a progress dialog when reloading many plugins
- Search for memory leakages in wslua functions

Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1
Reviewed-on: https://code.wireshark.org/review/5028
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-08-11 12:09:07 +00:00
Gerald Combs e91ca72a44 Qt: Add initial Lua support.
Add a FunnelStatistics class, which is the main interface between the Qt
UI and the Funnel API.

Add FunnelTextDialog, which implements the text_window, ProgDlg, menu,
and other routines. Add FunnelStringDialog, which implements dlg_new.

We currently only support "Tools" menu items (MENU_TOOLS_UNSORTED, aka
REGISTER_TOOLS_GROUP_UNSORTED). Add a disabled placeholder to the
"Tools" menu in case we don't load any scripts.

Use "struct progdlg" instead of needlessly casting to
funnel_progress_window_t.

To do:
- Add support for MENU_STAT_UNSORTED, MENU_STAT_GENERIC, etc.
- Make the firewall config generator a Lua script?
- Add FunnelGraphDialog? It seems like it would be useful to
  make QCustomPlot accessible to Lua scripts.

Ping-Bug: 9845
Change-Id: Iefff02e9032ed1853666f7902509ed08b431e7a7
Reviewed-on: https://code.wireshark.org/review/9523
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-07-07 20:49:30 +00:00
Bill Meier 23e78cd6bd Add editor modelines; Adjust whitespace as needed.
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50
Reviewed-on: https://code.wireshark.org/review/4594
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-10 14:50:08 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Bill Meier 0df5a9390d From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397

svn path=/trunk/; revision=48438
2013-03-20 01:18:10 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 1372515b02 More eradication of old-style function definitions.
svn path=/trunk/; revision=37216
2011-05-17 22:18:32 +00:00
Stig Bjørlykke 671bb28270 Only include config.h in C files, to avoid multiple inclusion.
svn path=/trunk/; revision=30180
2009-09-28 17:40:07 +00:00
Luis Ontanon 42c3239a1a luis.ontanon@gmail.com => luis@ontanon.org
svn path=/trunk/; revision=25937
2008-08-05 21:03:46 +00:00
Luis Ontanon 2e7726b3ff * rename REGISTER_STAT_GROUP_E -> register_stat_group_t
* Add a "Tools" menu
* allow wslua's register_menu to register menu items into more menus


svn path=/trunk/; revision=19338
2006-09-27 17:12:42 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Luis Ontanon 50d651fe5b * add an option to funnel_register_menu to retap the packets right after been called
* add a set_close_cllback function to the textwindow mini-api to set a callback to be called when the window gets closed.
* fix few issues regarding the closing of the window


svn path=/trunk/; revision=17165
2006-02-05 20:02:41 +00:00
Luis Ontanon 2e36cb403a - add a register_menu funnel
- remove the field_menu altoghether (It was not what I thought)
- move a declaration to the start of a function to allow VC6 to compile



svn path=/trunk/; revision=17161
2006-02-05 03:59:56 +00:00
Luis Ontanon 14f8c316ff define funnel_register_field_menu even if it is not implemented.
svn path=/trunk/; revision=17155
2006-02-04 22:49:44 +00:00
Luis Ontanon e487660dfc The funneled GUI mini API.
A very reduced set of gui ops (by now just a text window) that can be funneled to dissectors (even plugins) via epan.


svn path=/trunk/; revision=17149
2006-02-04 19:56:50 +00:00