Commit Graph

2523 Commits

Author SHA1 Message Date
Guy Harris e013c5ec7f Clean up URLs.
Add ui/urls.h to define some URLs on various of our websites.  Use the
GitLab URL for the wiki.  Add a macro to generate wiki URLs.

Update wiki URLs in comments etc.

Use the #defined URL for the docs page in
WelcomePage::on_helpLabel_clicked; that removes the last user of
topic_online_url(), so get rid of it and swallow it up into
topic_action_url().
2020-10-02 20:13:42 -07:00
Gerald Combs 4105e65add Tools: Handle leading "#"s in gen-bugnote.
GitLab's version of Markdown denotes issue IDs with a leading "#".
2020-09-30 09:56:53 -07:00
Tom Yan c69d8dd410 extract_asn1_from_spec.pl: add version into exported asn file 2020-09-28 14:53:26 +00:00
Martin Mathieson 6dd9c098ad check_typed_item_calls.py: add --consecutive flag
Add a check to point out where consecutive items have the same filter
but different labels.  Quite a few of these look like bugs.

Also, make some REs raw strings, as identified as an issue in
https://gitlab.com/wireshark/wireshark/-/merge_requests/346
2020-09-28 08:01:21 +00:00
Pascal Quantin 0b99248593 Windows: upgrade Npcap to 1.00 2020-09-27 14:22:19 +02:00
Jeff Widman 8d7ebc732e Fix issues discovered by common python linters
Fix some issues discovered by common python linters including:
* switch `None` comparisons to use `is` rather than `==`. Identity !=
equality, and I've spent 40+ hours before tracking down a subtle bug
caused by exactly this issue. Note that this may introduce a problem if
one of the scripts is depending on this behavior, in which case the
comparison should be changed to `True`/`False` rather than `None`.
* Use `except Exception:` as bare `except:` statements have been
discouraged for years. Ideally for some of these we'd examine if there
were specific exceptions that should be caught, but for now I simply
caught all. Again, this could introduce very subtle behavioral changes
under Python 2, but IIUC, that was all fixed in Python 3, so safe to
move to `except Exception:`.
* Use more idiomatic `if not x in y`--> `if x not in y`
* Use more idiomatic 2 blank lines. I only did this at the beginning,
until I realized how overwhelming this was going to be to apply, then I
stopped.
* Add a TODO where an undefined function name is called, so will fail
whenever that code is run.
* Add more idiomatic spacing around `:`. This is also only partially
cleaned up, as I gave up when I saw how `asn2wrs.py` was clearly
infatuated with the construct.
* Various other small cleanups, removed some trailing whitespace and
improper indentation that wasn't a multiple of 4, etc.

There is still _much_ to do, but I haven't been heavily involved with
this project before, so thought this was a sufficient amount to put up
and see what the feedback is.

Linters that I have enabled which highlighted some of these issues
include:
* `pylint`
* `flake8`
* `pycodestyle`
2020-09-26 04:38:18 +00:00
Tom Yan d0256f168a extract_asn1_from_spec.pl : fix export of S1AP 2020-09-25 07:37:25 +00:00
Martin Mathieson fc64ba242a More dissector spelling fixes. 2020-09-24 16:40:51 +00:00
Tom Yan 68f59bd1f4 extract_asn1_from_spec.pl : update comments 2020-09-24 09:18:13 +00:00
Pascal Quantin b562109562 extract_asn1_from_spec.pl: fix export of X2AP, NGAP, XnAP, E1AP and F1AP
And remove S1AP as it does not use the ASN1START/ASN1STOP keywords.
2020-09-24 07:09:43 +00:00
Tom Yan 71223de4a3 Add : extract asn from (36|38)\.413|(36|38).423|38\.463|38\.473) 2020-09-24 05:33:59 +00:00
Gerald Combs 586121fad4 Shellcheck fixes.
Note that ChmodBPF requires a newer version of shellcheck. Fix an issue
found after upgrading to 0.7.1.
2020-09-21 22:09:13 +00:00
Martin Mathieson f962539374 check_typed_item_calls.py: Scan plugins folder too 2020-09-19 12:34:02 +00:00
Christian Kreibich c5d5023654 A Community ID implementation for Wireshark.
This adds a protocol post-dissector for Community ID support to
Wireshark/tshark: https://github.com/corelight/community-id-spec

The protocol is disabled by default. It establishes one new filter
value, "communityid".

Includes test cases and baselines to verify correct Community ID
strings based on similar testsuites in the existing Zeek and Python
implementations.
2020-09-16 09:25:38 -07:00
Gerald Combs 194b3b406a Update our issue tracker URL in some places.
Replace bugs.wireshark.org links with their equivalent
gitlab.com/wireshark/wireshark/issues links in the AsciiDoctor buglink
macro and the please_report_bug function. Update the bug URLs in
comments in the tools and test directories.
2020-09-16 01:29:07 +00:00
Guy Harris 3417380d65 ncp: fix display of DS_FULL_CLASS_DEFS.
The last item in the reply information is an ACL.  Display it as such.
2020-09-15 04:04:33 -07:00
Guy Harris 395d2e7425 NCP: add more comments to tools/ncp2222.py.
Point to more NCP and NDS documentation.
2020-09-15 02:08:48 -07:00
Martin Mathieson 82827278f7 More dissector string spelling fixes.
Finally, it is becoming difficult to find more.
2020-09-13 09:03:08 +01:00
Guy Harris 272502790b Add FT_STRINGZTRUNC.
FT_STRINGZPAD is for null-*padded* strings, where the field is in an
area of specified length, and, if the string is shorter than that
length, all bytes past the end of the string are NULs.

FT_STRINGZTRUNC is for null-*truncated* strings, where the field is in
an area of specified length and, if the string is shorter than that
length, there's a null character (which might be more than one byte, for
UCS-2, UTF-16, or UTF-32), and anything after that is not guaranteed to
have any particular value.

Use IS_FT_STRING() in some places rather than enumerating all the string
types, so that those places get automatically changed if the set of
string types changes.
2020-09-12 14:16:12 -07:00
Guy Harris 20ae645964 ncp: add a comment about possibly null-truncated strings.
In File Search Continue requests, the path is a single byte giving the
string length, followed by that many bytes containing the string value.

However, in at least some File Search Continue requests, the string
length value is longer than the string, and there's a NUL, followed by
other non-zero cruft, in the string.
2020-09-11 01:36:52 -07:00
Gerald Combs 9e36a4fadd tools: Migrate gen-bugnote to GitLab.
Update gen-bugnote to fetch issue titles from GitLab's issue API.
2020-09-09 00:56:38 +00:00
Georg Richter 2f1cf93174 MySQL: Added support for MariaDB protocol
MariaDB and MySQL are not longer drop-in compatible, they differ in very
different directions
for protocol and api. This patch contains support for MariaDB specific
commands and extensions:

- MariaDB specific character sets and collations (also updated MySQL
collations)
- MariaDB extended capabilities in greeting and login packets
- Support for MARIADB_STMT_BULK_EXECUTE command
- Removal of "5.5.5-" prefix in the version string.
2020-09-08 09:02:02 +02:00
Martin Mathieson d461bf3025 Yet more spelling fixes.
Includes small updates to the script and wireshark dictionary.
Probably the last spelling fixes from me for a while.
2020-09-07 16:35:13 +01:00
Martin Mathieson de115f6cd5 check_spelling.py: fix a variable name, and add a few dictionary words. 2020-09-07 09:36:53 +01:00
Martin Mathieson 22e02a9d06 Add spell-checking script.
check_spelling.py scans Wireshark source or documentation files,
using the general dictionary from pyspellcheck, augmented by the contents
of wireshark_words.txt.

Can scan:
- entire folders (recursively)
- individual files
- open files
- files affected by recent git changes
2020-09-06 18:47:58 +00:00
Uli Heilmeier 30e13d7717 Gitlab: Add templates for issues
Adding templates for reporting a Bug and Feature Request
Exclude .gitlab from checklicenses.py
2020-09-06 17:15:40 +00:00
Gerald Combs 7ab6440416 Tools: Clean up checkAPI and add ui/qt.
Remove the --check-addtext and --build flags. They were used for
checkAddTextCalls, which was removed in e2735ecfdd.

Add the sources in ui/qt except for qcustomplot.{cpp,h}. Fix issues in
main.cpp, rtp_audio_stream.cpp, and wireshark_zip_helper.cpp.

Rename "index"es in packet-usb-hid.c.
2020-09-05 07:41:29 +00:00
Gerald Combs fd075df3f8 tools: Make the "Allow commits" error more obnoxious.
Add ANSI codes and emoji so that the error stands out in the pipeline
output. Clarify the text.
2020-09-04 09:22:04 +00:00
Gerald Combs 7476911490 tools: Force "Allow commits from members..." in merge requests.
Add a verify_merge_request routine to validate-commit.py. If the
required CI_MERGE_REQUEST_XXX environment variables are set it uses them
to query the GitLab API to see if "allow_collaboration" is true in the
current merge request.

This is a ham-fisted way of ensuring that committers can rebase and can
be removed if and when https://gitlab.com/gitlab-org/gitlab/-/issues/23308
is fixed.
2020-09-02 18:44:05 -07:00
Gerald Combs 3e0ebabdec CI+tools: Install lintian.
Install lintian instead of devscripts (which pulls in lintian + many
other packages) in .gitlab-ci.yml. Add lintian to DEBDEPS_LIST in
debian-setup.sh.
2020-09-01 08:46:08 +00:00
Mikael Kanstrup 97ade16979 nl80211: Fix abbreviated field names for NAN
Python's lstrip apparently doesn't strip a prefix but instead strips
all supplied characters from beginning of a string. Using lstrip
in generate-nl80211-fields.py script to remove the 'nl80211_' prefix
happened to work for everything but a few NAN related enums.
Introduce a remove_prefix function and regenerate the nl80211
dissector code to fix the abbreviated field names for NAN.
2020-08-28 13:07:13 +02:00
Pascal Quantin 429fa65c80 Windows: upgrade Npcap to 0.9997 2020-08-26 18:52:41 +00:00
Gerald Combs 97dcaf97fc Convert Gerrit URLs to GitLab.
Convert various code.wireshark.org URLs to their
gitlab.com/wireshark/wireshark equivalents.

Change-Id: I0150d1bd14208eb451a7de818dce6573363b1d27
2020-08-24 23:31:32 +00:00
Dario Lombardo b586f25789
tools: rename validate-clang-check.py to validate-clang-check.sh.
This reflects the actual language used in the code (sh).
2020-08-24 14:26:23 +02:00
Gerald Combs 50550708cc Add merge request jobs to GitLab CI and migrate commit validation.
Copy the Buildbot petri dish builder steps to corresponding GitLab CI
jobs. Update validate-commit.py to look for old "Bug:" and "Ping-Bug:"
references and have it call `git stripspace` directly. tools/commit-msg
was specific to Gerrit, so remove it.

Change-Id: Icbc54709052f44c941db9ad6a5dcf596292782a2
2020-08-23 17:46:18 -07:00
Martin Mathieson 3b67c5b308 TFS: Add some commonly-defined string pairs to tfs.c
'check_tfs.py --common'    can look for tfs values that appear multiple times.
Current output prior to these dssector changes was:

('No Extension', 'Extension') appears 3 times in:  ['epan/dissectors/packet-bssap.c', 'epan/dissectors/packet-camel.c', 'epan/dissectors/packet-gsm_map.c']
('Optimised for signalling traffic', 'Not optimised for signalling traffic') appears 3 times in:  ['epan/dissectors/packet-gsm_a_gm.c', 'epan/dissectors/packet-gsm_map.c', 'epan/dissectors/packet-gtp.c']
('Data PDU', 'Control PDU') appears 3 times in:  ['epan/dissectors/packet-pdcp-lte.c', 'epan/dissectors/packet-pdcp-nr.c', 'epan/dissectors/packet-rlc-nr.c']
('Message sent to originating side', 'Message sent from originating side') appears 3 times in:  ['epan/dissectors/packet-q2931.c', 'epan/dissectors/packet-q931.c', 'epan/dissectors/packet-q933.c']
('User', 'Provider') appears 3 times in:  ['epan/dissectors/packet-q2931.c', 'epan/dissectors/packet-q931.c', 'epan/dissectors/packet-q933.c']

The first and last ones were made common, the others seem a little too specialised.

Checking some of the existing items in tfs.c (using QtCreator's 'Find Usages'),
some of the common items are used a lot, but many of them are not referenced.

Change-Id: Ia4006d2c4fa7cafbc3b004dc7a367a986dbeb0c4
Reviewed-on: https://code.wireshark.org/review/38177
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-17 02:58:01 +00:00
Martin Mathieson ce81473b7f check_tfs.py: Import subprocess module (needed for querying git)
Change-Id: I177000fb05bb9323ddbb280eb0b79c30cd60a3f3
Reviewed-on: https://code.wireshark.org/review/38170
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-08-15 16:08:53 +00:00
Martin Mathieson 42cac8dcfd check_typed_item_calls.py: add optional checks for labels and bitmask.
Most of the detected non-contiguous mask bitmasks seem to be valid - they often
represent multiple unassigned/reserved bits that have been conflated into
one hf item.

A set of exceptions has been added to the script - a couple of genuine
buts will be addressed presently in a separate commit.

Change-Id: I87fcf6ee532819097c2daf20b4b1338abb4402d8
Reviewed-on: https://code.wireshark.org/review/38103
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-15 05:50:39 +00:00
Joerg Mayer c3066b647e make-version.pl: Update sample output in comments to more modern git version 2.24.3 (Apple Git-128)
Change-Id: I2c204d315fd2648953b536a825f6c7d9c9b04827
Reviewed-on: https://code.wireshark.org/review/38138
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2020-08-13 19:53:15 +00:00
Martin Mathieson 9a7b30aea8 Fix tfs strings that have leading or trailing space characters.
Change-Id: I3e456e24f171ea2073806ad56606e6ce9092890c
Reviewed-on: https://code.wireshark.org/review/38096
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-09 13:31:33 +00:00
Pascal Quantin e9f6958c46 Windows: upgrade Npcap to 0.9996
Change-Id: Ia8f0f2ecada1a94c0bcdaaa5c560575ab945b002
Reviewed-on: https://code.wireshark.org/review/38098
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-08-09 13:22:33 +00:00
Martin Mathieson fd03c85d0f check_typed_item_calls.py: Look for items with the wrong type passed to APIs
Look for calls to certain proto APIs that require hf items of a certain type,
then check that the items passed in have one of the allowed types.

Currently takes around a minute to scan epan/dissectors.  There are
a few issues that have not yet been fixed..

Hopefully this can be added to the PetriDish at some point.

Change-Id: Ic9eadcc3f1de03223606b5dca1cb45edcbe95e85
Reviewed-on: https://code.wireshark.org/review/38039
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-08 09:55:18 +00:00
Martin Mathieson 1dd8bb2811 Find and fix dissectors that should be using a default tfs.
Found using tools/check_tfs.py, included in this commit.
Here are the reports that were fixed here:

Examining:
All dissector modules

epan/dissectors/packet-assa_r3.c tfs_mortisepins_flags - could have used tfs_high_low from tfs.c instead:  {High,Low}
epan/dissectors/packet-btle.c tfs_present_bit - could have used tfs_present_not_present from tfs.c instead:  {Present,Not Present}
epan/dissectors/packet-dhcp.c tfs_fqdn_s - could have used tfs_server_client from tfs.c instead:  {Server,Client}
epan/dissectors/packet-docsis-macmgmt.c mdd_tfs_on_off - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-docsis-macmgmt.c mdd_tfs_en_dis - could have used tfs_enabled_disabled from tfs.c instead:  {Enabled,Disabled}
epan/dissectors/packet-docsis-macmgmt.c req_not_req_tfs - could have used tfs_requested_not_requested from tfs.c instead:  {Requested,Not Requested}
epan/dissectors/packet-docsis-tlv.c on_off_tfs - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-docsis-tlv.c activation_tfs - could have used tfs_active_inactive from tfs.c instead:  {Active,Inactive}
epan/dissectors/packet-docsis.c ena_dis_tfs - could have used tfs_enabled_disabled from tfs.c instead:  {Enabled,Disabled}
epan/dissectors/packet-ecmp.c tfs_not_expected_expected - could have used tfs_odd_even from tfs.c instead:  {Odd,Even}
epan/dissectors/packet-erf.c erf_link_status_tfs - could have used tfs_up_down from tfs.c instead:  {Up,Down}
epan/dissectors/packet-h263.c on_off_flg - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-h263.c cpm_flg - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-interlink.c flags_set_notset - could have used tfs_set_notset from tfs.c instead:  {Set,Not set}
epan/dissectors/packet-ip.c tos_set_low - could have used tfs_low_normal from tfs.c instead:  {Low,Normal}
epan/dissectors/packet-ip.c tos_set_high - could have used tfs_high_normal from tfs.c instead:  {High,Normal}
epan/dissectors/packet-isakmp.c flag_r - could have used tfs_response_request from tfs.c instead:  {Response,Request}
epan/dissectors/packet-isis-lsp.c tfs_metric_supported_not_supported - could have used tfs_no_yes from tfs.c instead:  {No,Yes}
epan/dissectors/packet-kerberos.c supported_tfs - could have used tfs_supported_not_supported from tfs.c instead:  {Supported,Not supported}
epan/dissectors/packet-kerberos.c set_tfs - could have used tfs_set_notset from tfs.c instead:  {Set,Not set}
epan/dissectors/packet-mac-lte.c mac_lte_scell_status_vals - could have used tfs_activated_deactivated from tfs.c instead:  {Activated,Deactivated}
epan/dissectors/packet-p_mul.c no_yes - could have used tfs_no_yes from tfs.c instead:  {No,Yes}
epan/dissectors/packet-pgm.c opts_present - could have used tfs_present_not_present from tfs.c instead:  {Present,Not Present}
epan/dissectors/packet-rsl.c rsl_ms_fpc_epc_mode_vals - could have used tfs_inuse_not_inuse from tfs.c instead:  {In use,Not in use}
epan/dissectors/packet-sita.c tfs_sita_on_off - could have used tfs_on_off from tfs.c instead:  {On,Off}
epan/dissectors/packet-vines.c tfs_vine_rtp_no_yes - could have used tfs_no_yes from tfs.c instead:  {No,Yes}
epan/dissectors/packet-vnc.c button_mask_tfs - could have used tfs_pressed_not_pressed from tfs.c instead:  {Pressed,Not pressed}
27 issues found
Change-Id: I7e53b491f20289955c9e9caa8357197d9010a5aa
Reviewed-on: https://code.wireshark.org/review/38087
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-07 21:27:26 +00:00
Gerald Combs 6b4fae1a0b Windows: Switch from the WpdPack SDK to vcpkg's libpcap.
Switch from WinPcap's WpdPack SDK to a libpcap package built with vcpkg.
We explictly load wpcap.dll on Windows, so make sure we don't link with
pcap.lib.

Move timestamp code from capture-pcap-util-unix.c to
capture-pcap-util.c. Add timestap routines to capture-wpcap.c and make a
couple of other updates.

Change-Id: If0e3dbeb7378c42ed9e3f91b2f15add95d22a2bb
Reviewed-on: https://code.wireshark.org/review/37905
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-21 04:33:13 +00:00
Martin Kacer 9b5f07d829 json2pcap: Added pcap masking and anonymization support
The script includes the following changes:
- Added pcap masking and anonymization support
- Support to mask/anonymize only portion of field
- Added reading from stdin
- Changed json to ijson library to support large files
- Migrated from text2pcap to scapy for pcap generation
- Added version to script

The development repo is located here
https://github.com/H21lab/json2pcap

Change-Id: I8fc5e282caa604e188f05818f7a2f8875afb8b73
Reviewed-on: https://code.wireshark.org/review/37371
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2020-07-16 14:50:09 +00:00
Martin Mathieson 7e4ff6f826 cppcheck.sh and check_dissector_urls.py: Show which files are being examined.
Change-Id: Ib5ecb215050dea6bf2f03014d544dac49e56fe12
Reviewed-on: https://code.wireshark.org/review/37865
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-07-15 11:32:42 +00:00
Pascal Quantin d8db04bf5f Windows: upgrade Npcap to 0.9995
Change-Id: Ib06b0bc5b51513c008bfa126c87590c6836913ff
Reviewed-on: https://code.wireshark.org/review/37860
Petri-Dish: Pascal Quantin <pascal@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
2020-07-14 15:26:54 +00:00
Martin Mathieson 70119bb905 check_dissector_urls.py: Add options to control which files to scan
The intention is to try to run this on the Petri-dish buildbot,
where it could run with '--commits 1' to warn about files touched
in the most recent commit.

Change-Id: Ie924d39e093d1fef8cfbdf02d15bbede386b2862
Reviewed-on: https://code.wireshark.org/review/37826
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-12 05:05:08 +00:00
Tomas Kukosa 1257bd379a asn2wrs: support for (SIZE(A..B),...) constraint
Change-Id: Icf4c6c7c91cbdc22aff2363b0d21b24d123da482
Reviewed-on: https://code.wireshark.org/review/37824
Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-12 05:02:56 +00:00
Peter Wu 1cbaaf3e8d tls: Update list of CT logs to 2020-05-29
Avoid string literals while at it to avoid -Wpointer-sign warnings with
GCC 10. This has the additional benefit of avoiding storing the trailing
NUL byte after the data, resulting in a tiny reduction in binary size.
This compound literal syntax is supported since C99 which is permitted
by doc/README.developer.

Change-Id: I35f4d3a46aa78e12915d92136f1de0891131bede
Reviewed-on: https://code.wireshark.org/review/37818
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-10 05:11:26 +00:00