Commit Graph

523 Commits

Author SHA1 Message Date
Stig Bjørlykke 9cafd342ac Lua: Add get_preference() and set_preference() utility functions.
Support uint, bool, enum, string, range, filename and directory preferences.
Added apply_preferences() to write to file and apply changes.
2020-12-08 22:56:50 +00:00
David Perry 27c00ca0e9 Lua: make TvbRange:raw() return a subset #12046 v2
My initial fix caused several double-offset errors in TvbRange_raw()
because I was adjusting for the TvbRange's offset too early in the
process. The proper fix is to only adjust for it in the final call to
get the data.

I also simplified some of the bounds checks to be based on the values in
the TvbRange instead of calling `tvb_captured_length()` and the like,
because its bounds are already checked against the backing Tvb when it's
first taken.

Massively expanded the lua test suite to account for every combination
of passing offsets and lengths to a Tvb or TvbRange and to the
subsequent `:raw()` call.
2020-12-02 20:09:55 +00:00
Huang Qiangxiong dcf6bdda84 Protobuf/gRPC: add test cases for Protobuf and gRPC
Add case_dissect_protobuf and case_dissect_grpc in test/suite_dissection.py.
Add *.proto into the sub directories of test/protobuf_lang_files/.
Run command like 'pytest --program-path .\run\Debug\ -k "grpc or protobuf"'
in build directory (in windows) to test these cases only.
2020-12-01 12:06:43 +00:00
Jaap Keuter 68313f4972 Avoid python deprecation warning
Fixes ad69ec2e11
2020-11-21 18:58:21 +00:00
John Thacker 7654bb260d QT+epan: Set FI_BITS_OFFSET and FI_BITS_SIZE flags on [u]ints and bitmasks
Set the FI_BITS_OFFSET and FI_BITS_SIZE flags appropriately on [u]int[64]
(and thus chars and booleans) where the bitmask is passed in on the
header_field_info. Also set the flags on bitmask items by ORing the bitmasks
from the constituent fields. These flags are only used right now in the
packet diagram.

This makes the packet diagram display those types of fields correctly without
having to use proto_item_set_bits_offset_len(), so long as the bitmask is
correct and the field width of the type matches the octet length. (If it
doesn't match, that's a dissector bug.)

split bit items are a more complicated case and still not handled correctly.
2020-11-19 12:00:46 +00:00
Gerald Combs 30c392f166 Tools+test: Call python3 explicitly.
PEP 394[1] says,

"In cases where the script is expected to be executed outside virtual
 environments, developers will need to be aware of the following
 discrepancies across platforms and installation methods:

  * Older Linux distributions will provide a python command that refers
    to Python 2, and will likely not provide a python2 command.

  * Some newer Linux distributions will provide a python command that
    refers to Python 3.

  * Some Linux distributions will not provide a python command at all by
    default, but will provide a python3 command by default."

Debian has forced the issue by choosing the third option[2]:

"NOTE: Debian testing (bullseye) has removed the "python" package and
 the '/usr/bin/python' symlink due to the deprecation of Python 2."

Switch our shebang from "#!/usr/bin/env python" to "#!/usr/bin/env
python3" in some places. Remove some 2/3 version checks if we know we're
running under Python 3. Remove the "coding: utf-8" in a bunch of places
since that's the default in Python 3.

[1]https://www.python.org/dev/peps/pep-0394/#for-python-script-publishers
[2]https://wiki.debian.org/Python
2020-11-05 06:46:35 +00:00
Mikael Kanstrup ad69ec2e11 dot11decrypt: Fix WEP decryption
For WPA security association (SA) entries are created on sucessful
PTK derivation from 4-way handshake frames. WEP though don't use
4-way handshake frames for key derivation and therefore no SA entry
is created. Still WEP decryption implementaton expects to find
an SA otherwise the decryption is skipped.

Fix broken WEP decryption by removing the check for an existing SA
entry and instead form the SA on first successful decryption.

Add also a test for WEP decryption.

Fixes: v3.3.0rc0-1263-g099d241046 ("dot11decrypt: Avoid allocating SA on packet decryption")
2020-10-21 11:03:44 +00:00
David Perry c03011b906 Lua: base64_decode: handle unpadded data
As noted in bug #16386, glib's `g_base64_decode_inplace()` aborts
decoding of base64 strings that aren't padded. This addresses that by
adding padding "=" characters if needed to the buffer which will be
decoded.

I added the test case from the bug report to the test suite, though the
location therein may not be ideal.

Closes #16386
2020-10-19 08:38:31 +00:00
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
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
Aurelien Aptel c5926c51e7 SMB2: add tests for chained compression and pattern_v1 2020-09-26 02:23:23 +00:00
Gerald Combs 34f60a1cfc Test: Normalize the line endings everywhere.
Convert CRLF to LF in subprocess output everywhere, not just on Windows.
Note that we normalize output in the Developer's Guide.
2020-09-17 10:05:52 -07:00
Gerald Combs 4cf3a742c8 Test: Normalize the line endings of subprocess output.
On Windows, replace CRLF line endings in subprocess output with LFs.
Stop doing so in individual tests.
2020-09-16 13:35:11 -07: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
Gerald Combs 9b07412277 Qt: Add a packet diagram view.
Add a new top-level view that shows each packet as a series of diagrams
similar to what you'd find in a networking textook or an RFC.

Add proto_item_set_bits_offset_len so that we can display some diagram
fields correctly.

Bugs / to do:
  - Make this a separate dialog instead of a main window view?
  - Handle bitfields / flags

Change-Id: Iba4897a5bf1dcd73929dde6210d5483cf07f54df
Reviewed-on: https://code.wireshark.org/review/37497
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-08-10 18:17:50 +00:00
Gerald Combs af6140d643 Test: Remove an unused routine.
dump_failed_output didn't do anything, so remove it.

Change-Id: If2c1c48ff38987bcd535e95585784eb9981a0f4e
Reviewed-on: https://code.wireshark.org/review/37752
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-08 05:08:23 +00:00
Mikael Kanstrup 42544c8c44 dot11decrypt: Support decryption using TK user input
Add support for TK user input keys. With this Wireshark can
decrypt packet captures where 4WHS frames are missing and
packet captures with non-supported AKMS, for example
802.11r / Fast BSS Transitioning.

Decryption using user TK works as a backup if the normal
decryption flow does not succeed. Having TK decryption keys
added will affect general IEEE 802.11 dissector performance
as each encrypted packet will be tested with every TK.
Worst case scenario is plenty of TKs where none of them
matches encrypted frames.

On successful user TK decryption an SA is formed based on
parameters used to decrypt the frame. This SA is similar to
what is formed when Wireshark detects and derive keys from
4WHS messages. With the SA entry in place the decryption
performance (success case) should be on par with "normal"
decryption flow.

Bug: 16579
Change-Id: I72c2c1e2c6693131d3ba07f8ddb8ff772c1b54a9
Reviewed-on: https://code.wireshark.org/review/37217
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-01 07:23:56 +00:00
Guy Harris 7e7db3e91c sll: add support for LINKTYPE_LINUX_SLL2.
Different header, with a different size, an additional field, and with
fields being in a different order.

Distinguish between V1 and V2 by giving the version.

That means we can no longer use the "ethertype" dissector as it stands,
because the packet type field isn't at the end of the header, right
before the payload; pull the "add the type field to the protocol tree"
functionality out of the "ethertype" dissector and leave it up to the
dissector calling it.

Change-Id: I72b8a2483c0a539919fbe5d35fd7e60bff4bf75a
Reviewed-on: https://code.wireshark.org/review/37169
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-09 03:14:50 +00:00
Peter Wu 6308451f8f test: fix invalid escape sequence warnings
pytest and `pycodestyle test/suite_*.py --select=W605` warned about it.

Change-Id: I015351d1c00d17aa9f04ab17abed00586ee09e89
Reviewed-on: https://code.wireshark.org/review/36771
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-04-11 13:57:10 +00:00
Mikael Kanstrup 3e9ce48d24 dot11decrypt: Fix decryption of MFP enabled connections
MFP enabled connections with SHA-256 key management (IEEE 802.11w) use
EAPOL key version == 3. This case was missing making decryption of such
connections fail. Allow key version 3 to handle these too.

Change-Id: If9e3fcc5c3bbfb46e82b39dfed5b2a74787a4f16
Reviewed-on: https://code.wireshark.org/review/36534
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-23 08:45:57 +00:00
Moshe Kaplan 4a8da5fbde wslua: Fix crash on TvbRange:__tostring for a zero-length TVB
Fields such as 'frame.time_delta' have no byte selection, they are added
with offset 0 and length 0, and evidently 'ws_tvb' is NULL. As
tvb_bytes_to_str expects a non-NULL tvb, explicitly check for this and
add a dummy placeholder. This is intended to be a human-readable string,
so prefer `<EMPTY>` over an empty string.

Change-Id: I32efe4cbefc6bcf0fa9fb94fcf25d7bf1628f3a7
Reviewed-on: https://code.wireshark.org/review/36440
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-03-16 22:42:03 +00:00
Mikael Kanstrup e83b3aead7 tests/suite_decryption: Skip CCMP-256 test with libgcrypt < 1.6
CCMP-256 decryption support is only available with libgcrypt >= 1.6 so
skip corresponding test if lib is too old.

Fixes: v3.3.0rc0-733-geed31f13be ("ieee80211: Add CCMP-256 decryption support")
Change-Id: I6145f2ec49e19d1356915b9b1d8da54332a4a16a
Reviewed-on: https://code.wireshark.org/review/36414
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-03-14 17:53:48 +00:00
Mikael Kanstrup cf4c0552e7 ieee80211: GCMP decryption support
Add support for decrypting GCMP/GCMP-256 encrypted IEEE 802.11 traffic

Bug: 16197
Change-Id: I907d772665141c8be10a9f4a187bd76594c8d2e4
Reviewed-on: https://code.wireshark.org/review/36346
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-03-14 17:53:36 +00:00
Mikael Kanstrup eed31f13be ieee80211: Add CCMP-256 decryption support
Add support for decrypting CCMP-256 encrypted IEEE 802.11 traffic

Bug: 16197
Change-Id: I0c9ee09e5b71cb02e6d2381049fd5bbb02686f7f
Reviewed-on: https://code.wireshark.org/review/36344
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-03-14 06:53:13 +00:00
Gerald Combs f8f6ce55de Test: Make sure we can run Wireshark on macOS.
Run Wireshark tests on macOS only if SECURITYSESSIONID. If this isn't
reliable enough we might be able to get away with running a small UI
utility, e.g. `pbpaste > /dev/null`.

Change-Id: Ieccb87bcc1312f02c22ec2905a80437bf136d964
Reviewed-on: https://code.wireshark.org/review/36195
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2020-02-26 21:54:57 +00:00
Aurelien Aptel 1702e59b55 test/suite_decryption.py: update SMB3+ decryption tests
Update existing tests to the new smb2_seskey_list syntax and add new
tests for decrypting using different combinations of provided keys.

Change-Id: I86fda351ff736cae6029ec2321c45a02c1917226
Reviewed-on: https://code.wireshark.org/review/36137
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-02-23 06:14:06 +00:00
Aurelien Aptel b8f9448c78 SMB2: try to guess encryption settings when not available
When dissecting a capture made in the middle of an existing encrypted
session we cannot decrypt the traffic because we don't know:

* what SMB dialect and encryption algorithm was picked during the
  session establishment
* which host is the server and which host is the client

Since we know the decrypted payload always starts with a valid header
we use this as an heuristic and try all possible decryption settings.

Change-Id: I1daa297ced98e62cf361b9022871c668e56f8f4b
Reviewed-on: https://code.wireshark.org/review/36136
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-02-23 06:13:30 +00:00
Aurelien Aptel 95a37ff2fe SMB2: allow users to give decryption keys directly
Previously users could only give a session key via

    uat:smb2_seskey_list:<id>,<seskey>

which was used to generate the decryption keys, as long as the trace
contained the session establishement.

Users have often asked about how to decrypt traffic captured in the
middle of an existing session but this wasn't possible.

This commit extends uat:smb2_seskey_list with 2 extra columns to store
decryption keys so that traffic can be decrypted at any point of the
session.

This has the side effect of changing the current syntax from:

    ... -o uat:smb2_seskey_list:<id>,<seskey>

To:

    ... -o 'uat:smb2_seskey_list:<id>,<seskey>,"",""'

(make sure the quoting is right)

Change-Id: I810d464b6f3e749de39b4428d73e0d6be29f3152
Reviewed-on: https://code.wireshark.org/review/36135
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2020-02-23 06:12:32 +00:00
Gerald Combs b3efeb2573 Test: Bump the WireGuard Gcrypt version requirement.
WireGuard decryption requires Gcrypt 1.8 or later.

Change-Id: I4a9e910df61a2d8f375e3f90b22511fe59be922c
Reviewed-on: https://code.wireshark.org/review/36128
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2020-02-18 23:33:29 +00:00
Gerald Combs d7bbe384f5 Test+Qt: Add an automatic update check.
Add software_update_info() to the software update module, which returns
the name of our update library if we have one. Use it to add automatic
update information to the compiled information in `wireshark --version`.

Add a "release" test suite, which contains a test for automatic updates.

Ping-Bug: 16381
Change-Id: I867a96bdcfde8be541eca2dc0e84b5000276e7dd
Reviewed-on: https://code.wireshark.org/review/36107
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-02-15 11:13:25 +00:00
Stefan Metzmacher 17a6916a21 epan/to_str: change MAX_BYTE_STR_LEN from 48 to 72
We want things like aes-256 keys to be displayed completely.

Change-Id: I746f3282440c036cfb60263be40e3b3a6ed859c2
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-on: https://code.wireshark.org/review/35703
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-26 19:31:34 +00:00
João Valverde 967c0f2c93 IPv4: Use FT_UINT8 for the 3 bits flags field
XXX comment reworded to be more informative and reflect lack of
consensus on removing RFC 3514.

Change-Id: If15b8f5d7c450192b1b6ebbfa463b19f27de177c
Reviewed-on: https://code.wireshark.org/review/35934
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2020-01-24 18:56:09 +00:00
João Valverde 89beba7ea6 IPv4: Fix display of Fragment Offset field
Bug: 16344
Change-Id: I0fe0bec606a103e0cb96c6b6da0f98f9b12097b7
Fixes: v3.1.0rc0-916-g237ec1349f ("IP: Make dissection of ip.frag_offset RFC 791 compliant")
Reviewed-on: https://code.wireshark.org/review/35918
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-24 05:06:07 +00:00
Anders Broman f04475167a UDP: Add a filter for payload.
A filter for payload makes it easier to exoprt it.

Change-Id: I0732c60c7fac37283fcbe6508d5e27bcd3c603fd
Reviewed-on: https://code.wireshark.org/review/35519
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-01-07 12:34:20 +00:00
Dario Lombardo 69c0a10400 test: fix extcap_name fixture and skip test.
dpauxmon relies on libnl that is linux specific. Skip the test
for other platforms.
Fix skip message while here.

Change-Id: I744d83d0a56e41e1c32e45ade8ca0d9dd29876e1
Reviewed-on: https://code.wireshark.org/review/35525
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-12-20 22:25:31 +00:00
Dario Lombardo a20fcccda4 test: fix CI builds on linux.
Fixes:
- sdjournal is available on linux only.
- The systemd library has been put in the right group in debian-setup.

Change-Id: Ie022f29da4313d17d55201b6e7ea1ab2ae740e18
Reviewed-on: https://code.wireshark.org/review/35478
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-12-19 08:02:37 +00:00
Dario Lombardo f73018eb0c test: add suite_extcaps.
All the shipped extcaps will be tested against:
--help
--extcap-interfaces
--extcap-interface <IFACE> --extcap-dtls
--extcap-interface <IFACE> --extcap-config

Bug: 16268
Change-Id: I7949103940c95c9c23fc5dd3743c15995d3a152d
Reviewed-on: https://code.wireshark.org/review/35409
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-12-17 13:59:17 +00:00
Dario Lombardo 4ee90e4e6f test: fix comment.
Change-Id: I71a28535f2c9081e965004f02ec85ff500f9278b
Reviewed-on: https://code.wireshark.org/review/35428
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-12-14 18:15:19 +00:00
Dario Lombardo 00fd41b619 print: fix ek output with -j option.
Bug: 16207
Change-Id: I95047f76430f5e83083b950a8ed7400e6cdd40ec
Reviewed-on: https://code.wireshark.org/review/35117
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-18 04:41:40 +00:00
Mikael Kanstrup a924de1e3e test/suite_decryption: Add WPA3 SuiteB-192 bit test
Add a test to verify that PTK can be derived for WPA3 SuiteB-192
captures and that encrypted keydata field is decrypted so that
GTK can be dissected.
NOTE: Capture file contains no encrypted data frames as currently
Wireshark does not support decrypting GCMP-256 encrypted data.

Ping-Bug: 16197
Change-Id: I57fbc14a4b4bca58790c4edcee14f1ef73d73fd5
Reviewed-on: https://code.wireshark.org/review/35068
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-11-14 08:28:00 +00:00
Dario Lombardo 12e79f037d test: add ek + raw test to outputformats.
Ping-Bug: 16187
Change-Id: Ie8d6dd1a8ff203bd6270dcfcbbeda953d57733f3
Reviewed-on: https://code.wireshark.org/review/35046
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-11-12 03:17:20 +00:00
Dario Lombardo 2dc1b77827 elastic: print times the right way.
According to https://www.elastic.co/guide/en/elasticsearch/reference/6.7/date.html
a timestamp can be string or integer. Print the absolute times as string and the
relative times as integers.

The format for the time will be "date_nanos" as described here
https://www.elastic.co/guide/en/elasticsearch/reference/current/date_nanos.html

Ping-Bug: 15784
Change-Id: I430939961767fa65d11f2d3c939b203c8c84e88e
Reviewed-on: https://code.wireshark.org/review/34166
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-11-04 17:40:34 +00:00
Alexander Wetzel e7acb32a5a ieee80211: Extended Key ID support
Support Extended Key ID for Individually Addressed Frames from
IEEE 802.11 - 2016.

Extended Key ID allows unicast (PTK) keys to also use key ID 1 and has
an additional RSN attribute "KeyID" in EAPOL #3.

Add the additional attribute KeyID to the RSN parser, stop assuming
unicast keys are only using key ID 0 and add a test case to verify
Extended Key ID parsing and decoding.

Change-Id: I43005c74df561be5524fa3738149781f50dafa14
Reviewed-on: https://code.wireshark.org/review/34883
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2019-11-02 11:40:57 +00:00
Stig Bjørlykke 551745998e wslua: Fix memleak of unregistered ProtoField strings
If a ProtoField object was created, but not linked to a Proto, then the
strings field and all elements (depending on type) would leak.

This is a follow-up to g79fef2ae and fixes the real issue in g44870fb1.

Change-Id: I01880a92bb20fae45f68c754b07daeb07630deec
Reviewed-on: https://code.wireshark.org/review/34872
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Vasil Velichkov <vvvelichkov@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
2019-10-28 15:05:54 +00:00
Vasil Velichkov 44870fb1c2 wslua: Fix two memory leaks in the lua tests
Add the newly create ProtoField to the test_proto.fields in order to be freed.

ERROR: LeakSanitizer: detected memory leaks

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x55e041f5ef86 in realloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x222f86)
    #1 0x7fd8e0919e7d in g_realloc gmem.c:164:16
    #2 0x7fd8e08e457b in g_array_maybe_expand garray.c:820:21
    #3 0x7fd8e08e4b49 in g_array_append_vals garray.c:428:3
    #4 0x7fd8ef112b6e in value_string_from_table /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:294:9
    #5 0x7fd8ef10ee10 in ProtoField_new /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:646:24

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x55e041f5ef86 in realloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x222f86)
    #1 0x7fd8e0919e7d in g_realloc gmem.c:164:16
    #2 0x7fd8e08e457b in g_array_maybe_expand garray.c:820:21
    #3 0x7fd8e08e4b49 in g_array_append_vals garray.c:428:3
    #4 0x7fd8ef111e2e in range_string_from_table /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:226:17
    #5 0x7fd8ef10e43f in ProtoField_new /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:642:24

Fixes: v3.1.1rc0-497-g0371994223 ("wslua: Improve parameter check in ProtoField.new()")
Change-Id: I05b8bf3d78c8a540c6cf33d11dc3f3e01f83b8c5
Reviewed-on: https://code.wireshark.org/review/34834
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>
2019-10-26 13:27:45 +00:00
Stig Bjørlykke 0371994223 wslua: Improve parameter check in ProtoField.new()
Improve paremeter check in ProtoField.new() when using ftypes.CHAR:
- Check valid base types and give an error when not supported instead of
  terminate in a g_error() (base.DEC is not supported).
- Give an error if used with base.UNIT_STRING instead of silently remove
  the flags.
- Support base.RANGE_STRING instead of removing the flag.

Support using base.NONE with a valuestring.
Add ftypes.CHAR to the list of supported types.

Change-Id: I0e3f9698074c807f5da0de23ccd1be7446271135
Reviewed-on: https://code.wireshark.org/review/34783
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-16 07:41:11 +00:00
Peter Wu ba35c23205 test: add support for pytest 5.2.0
pytest 5.2.0 added support for callable scopes. In order to distinguish
those (`@pytest.fixture(scope=fn)`) from decorators (`@pytest.fixture`),
it added extra arguments which was not expected by our wrapper. See
https://github.com/pytest-dev/pytest/pull/5776 for the change.

Fixes the following error:

    ImportError while loading conftest 'test/conftest.py'.
    test/conftest.py:42: in <module>
        from fixtures_ws import *
    test/fixtures_ws.py:198: in <module>
        @fixtures.fixture
    test/fixtures.py:36: in fixture
        return pytest.fixture(scope, params, autouse, ids, name)
    E   TypeError: 'bool' object is not iterable

We do not use non-keyword arguments, so it is safe to use `*` instead of
`*args` in the prototype.

Change-Id: I96220e0e85249ad58880e5de75f8987a0fdc16ef
Reviewed-on: https://code.wireshark.org/review/34672
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-10-02 09:59:39 +00:00
Alexander Gryanko 9fff62e2a8 Qt, http2: Add Follow HTTP/2 Stream functionality
The HTTP/2 protocol multiplexes a single TCP connection into multiple
independent streams. The Follow TCP output can interleave multiple
HTTP/2 streams, making it harder to analyze a single HTTP/2 stream.

Add the ability to select HTTP/2 Streams within a TCP stream.
Internally, the HTTP/2 dissector now stores the known Stream IDs in a
set for every TCP session which allows an amortized O(n) lookup time for
the previous/next/max Stream ID.

[Peter: make the dissector responsible for clamping the HTTP/2 Stream ID
instead of the Qt code, that should permit future optimizations.]

Change-Id: I5d78f29904ae8f227ae36e1a883155c0ed719200
Reviewed-on: https://code.wireshark.org/review/32221
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexander Gryanko <xpahos@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-09-22 05:29:30 +00:00
Michael Mann e90b2401be Add new filters for Ethernet src and dst OUI's as well as their resolved OUI's
Bug: 15393
Change-Id: I931813ce3492557a5673e6bbd0269d34c0d550b2
Reviewed-on: https://code.wireshark.org/review/31416
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-09-15 02:15:40 +00:00