Commit Graph

566 Commits

Author SHA1 Message Date
Peter Wu 31f4c0dce1 WireGuard: implement responder handshake decryption
Transport data decryption will follow later.

Bug: 15011
Change-Id: Ib755e43ff54601405b21aeb0045b15d158bc283b
Reviewed-on: https://code.wireshark.org/review/28991
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08 11:25:45 +00:00
Peter Wu c30b9fc891 WireGuard: add keylog for initiation decryption with ephemeral keys
As UATs are currently unable to receive keys dynamically without manual
user interaction followed by rescanning of the pcap, add a mechanism
like ssl.keylog_file. Such keys can be extracted using the tools from
contrib/examples/extract-handshakes/ in the WireGuard source tree.

Now decryption of Initiation messages is also possible when keys
(Epriv_i) are captured from the initiator side.

Bug: 15011
Change-Id: If998bf26e818487187cc618d2eb6d4d8f5b2cc0a
Reviewed-on: https://code.wireshark.org/review/28990
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08 11:25:33 +00:00
Peter Wu 5b61737dc9 WireGuard: implement initiation message decryption with static keys
Enable decryption of the static and timestamp fields when the private
static key of the responder is known. Decryption of the initiation and
response messages using private ephemeral keys will be done later.

Bug: 15011
Change-Id: Ifc9729059694700333b6677374ab467c8cb64263
Reviewed-on: https://code.wireshark.org/review/28989
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08 11:25:22 +00:00
Peter Wu cf9f1cac07 WireGuard: implement peer identification based on MAC1
Using long-term static public keys, it is possible to identify the
recipient of a handshake message. Add a new UAT where such keys can be
configured. Allow private keys to be configured as well since this
enables decryption of the Initiation handshake message.

Bug: 15011
Change-Id: I0d4df046824eac6c333e0df75f69f73d10ed8e5e
Reviewed-on: https://code.wireshark.org/review/28988
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-08-08 11:25:08 +00:00
Peter Wu 9ca8a9f87c test: do not silently ignore feature detection failures
When ASAN memleak detection is enabled, any memory leak would result in
an exception and subsequently all features are marked as missing.
With the default profile, any Lua plugin or certain configurations could
cause a memory leak. To avoid such interference, set the configuration
path to a dummy location and warn whenever an error happens nonetheless.

Do not call setProgramPath() immediately, there is no "tshark" binary in
the current working directory anymore. Rely on test.py to set the path.

Change-Id: Idccc3d68eb6f6bb64d3a0b32897acecc65e0dfb6
Reviewed-on: https://code.wireshark.org/review/28867
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
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>
2018-07-26 23:16:04 +00:00
Jaap Keuter d7c4e482b7 Remove executable file permission from lua test files
Change-Id: I18b3f145bb48a78edabed3cca03691d15cd06842
Reviewed-on: https://code.wireshark.org/review/28809
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-07-23 09:31:48 +00:00
Gerald Combs 61dd06ed9f Lua: Switch from disable_lua to enable_lua.
Deprecate "disable_lua" in favor of "enable_lua". Configuration options
typically use "true" or a similar value to enable features. Using
"disable_lua = false" to enable Lua seems odd.

Change-Id: I224acad0559d409ea0a28b5555d1eb898564328c
Reviewed-on: https://code.wireshark.org/review/28773
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>
2018-07-20 06:42:38 +00:00
Peter Wu 0ce2cdda8b Tests: add minimal pytest support
pytest is a powerful test framework. The initial motivation is to have
much better detailed reporting when a test fails, see for example
https://docs.pytest.org/en/latest/

Additionally, it has full parallelization support at the test level (via
the pytest-xdist plugin) instead of being limited to the suite level
(which currently has to be hard-coded via CMakeLists.txt).

Usage with the build dir in /tmp/wsbuild and src dir in /tmp/wireshark:

    export WS_BIN_PATH=/tmp/wsbuild/run
    pytest /tmp/wireshark/tests

For parallelization support and verbose printing:

    pip install pytest-xdist
    pytest -nauto -v /tmp/wireshark/tests

To limit yourself to a case based on a pattern:

    pytest -nauto -v /tmp/wireshark/tests -k test_unit_ctest_coverage

Tested on Arch Linux with Python 3.6.5, pytest-3.6.2, xdist-1.22.2.
pytest -n8 finished in 82 seconds while ctest -j8 required 87 seconds.

Change-Id: I832f4dd9f988d6656df795327e81610accf54b9f
Reviewed-on: https://code.wireshark.org/review/28651
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-17 09:04:01 +00:00
Peter Wu caa8efa0d2 tests: add regression tests for Follow TCP Stream
Verified that the tests failed without the fixes for the linked bugs.
The tests have full statement coverage(*1) for check_follow_fragments
and follow_tcp_tap_listener. For details and Scapy script, see:
https://git.lekensteyn.nl/peter/wireshark-notes/commit/crafted-pkt/badsegments.py?id=4ecf9d858b49e76d8a9c29df01ce1bd523ae6704

 (*1) except for `if (data_length <= data_offset) { data_length = 0; }`

Change-Id: I625536df375272cf6c9116231194c39df1217fae
Ping-Bug: 13700
Ping-Bug: 14944
Reviewed-on: https://code.wireshark.org/review/28618
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-06 12:11:09 +00:00
Peter Wu ca42331437 tcp: add support for reassembling out-of-order segments
Currently out-of-order segments will result in cutting a stream into
two pieces while the out-of-order segment itself is ignored. For
example, a stream of segments "ABDCE" is interpreted as "AB", "DE" with
"C" ignored. This behavior breaks TLS decryption or prevent application
layer PDUs (such as HTTP requests/responses) from being reconstructed.
To fix this, buffer segments when a gap is detected.

The proposed approach extends the "multi-segment PDU" (MSP) mechanism
which is normally used for linking multiple, sequential TCP segments
into a single PDU. When a gap is detected between segments, it is
assumed that the segments within this gap are out-of-order and will be
received (or retransmitted) later.

The current implementation has a limitation though, if multiple gaps
exist, then the subdissector will only be called when all gaps are
filled (the subdissector will receive segments later than necessary).
For example with "ACEBD", "ABC" can already be processed after "B" is
received (with "E" still buffered), but due to how MSP are extended, it
must receive "D" too before it reassembles "ABCDE". In practice this
could mean that the request/response times between HTTP requests and
responses are slightly off, but at least the stream is correct now.
(These limitations are documented in the User's Guide.)

As the feature fails at least the 802.11 decryption test where packets
are missing (instead of OoO), hide this feature behind a preference.

Tested with captures containing out-of-order TCP segments from the
linked bug reports, comparing the effect of toggling the preference on
the summary output of tshark, the verbose output (-V) and the two-pass
output (-2 or -2V). Captures marked with "ok" just needed "simple"
out-of-order handling. Captures marked with "ok2" additionally required
the reassembly API change to set the correct reassembled length.

This change does "regress" on bug 10289 though when the preference is
enabled as retransmitted single-segment PDUs are now passed to
subdissectors. I added a TODO comment for this unrelated cosmetic issue.

Bug: 3389   # capture 2907 (HTTP) ok
Bug: 4727   # capture 4590 (HTTP) ok
Bug: 9461   # capture 12130 (TLS/HTTP/RPC-over-HTTP +key 12131) ok
Bug: 12006  # capture 14236 (HTTP) ok2; capture 15261 (HTTP) ok
Bug: 13517  # capture 15370 (HTTP) ok; capture 16059 (MQ) ok
Bug: 13754  # capture 15593 (MySQL) ok2
Bug: 14649  # capture 16305 (WebSocket) ok
Change-Id: If3938c5c1c96db8f7f50e39ea779f623ce657d56
Reviewed-on: https://code.wireshark.org/review/27943
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-28 06:10:35 +00:00
Gerald Combs 293be57265 Test: Add sharkd tests.
Change-Id: I0e5049700ab9285196ce6b4567bd2d034529e763
Reviewed-on: https://code.wireshark.org/review/28327
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>
2018-06-21 03:30:30 +00:00
Gerald Combs d88c5df0cf Test+CMake: Make our test grouping more fine-grained.
Split our tests by suite_*.group_* instead of suite_*. There are quite a
few dfilter tests and this should make them more parallelizable.

Change-Id: I52371409618cda70dc99811e8de1fb1ad9d9a3b6
Reviewed-on: https://code.wireshark.org/review/28329
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-06-18 19:36:26 +00:00
Gerald Combs 55304159fc Test: Add UTF-8 filter tests.
Change-Id: Ic1e961802e716b5c446428efa068a6205faab954
Reviewed-on: https://code.wireshark.org/review/27912
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-30 21:16:38 +00:00
Peter Wu a1e5a15780 wslua: fix NSTime:__tostring for negative values
"nstime_t{A, B}" is defined as "A + B * 10^9" rather than an integer
part A and fractional part B.

Bug: 14720
Change-Id: I5321db7d5ecea8f976291d2a22667b02162194e2
Reviewed-on: https://code.wireshark.org/review/27775
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-25 12:50:18 +00:00
Gerald Combs f01ff0cb0c Test: Consolidate our environments.
Move WIRESHARK_QUIT_AFTER_CAPTURE to the default environment instead of
running the capture tests in a separate environment.

Change-Id: I5198df35f512ffe8c0d7f091a7b50d5fdb9c4ff6
Reviewed-on: https://code.wireshark.org/review/27711
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-22 16:34:03 +00:00
Gerald Combs 2ecf69f773 Test: Be more paranoid about our log output.
Run our CTest tests with PYTHONIOENCODING=UTF-8.

If someone runs our tests manually and their output encoding isn't
UTF-8, print replacement characters instead of failing with an error.

Open our log files with "errors='backslashreplace'" in case their
contents aren't UTF-8.

Change-Id: Ifa4d12c2b5e272cf3903f3e0c6102e4d961562f1
Reviewed-on: https://code.wireshark.org/review/27686
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-21 18:03:42 +00:00
Peter Wu 177ea9e75a test: require Libgcrypt 1.6 for TDLS test
Dot11DecryptTDLSDeriveKey in epan/crypt/dot11decrypt.c requires Libcrypt
1.6 for MIC verification. Skip the test if unavailable.

Change-Id: I0b859c0ecf135182a6249a67b9b5ea9e34ad92b6
Reviewed-on: https://code.wireshark.org/review/27614
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-05-17 15:30:25 +00:00
Peter Wu 5ec2265d2f test: add test for resolved addresses
Tests that the documented "-z hosts,ipv4" filter actually works and that
the resolved addresses table is correct (it implicitly tests that the
definition of WS_INET_ADDRSTRLEN in wsutil/inet_addr.h is sane).

Change-Id: If7babe665ea5ecb37e38078a9809c88873cb323c
Ping-Bug: 14667
Reviewed-on: https://code.wireshark.org/review/27454
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-12 06:29:55 +00:00
Gerald Combs f72481a144 Test: Make sure we run our display filter tests.
Change the test suite list in CMakeLists.txt to a static list. Add a
CTest coverage unit test.

Change-Id: I8459f320a2d0707618d6d56abdfce80274fddd2d
Reviewed-on: https://code.wireshark.org/review/27377
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-06 23:56:41 +00:00
Gerald Combs 230d7d4e90 Test: Integrate ftsanity directly into our tests.
Move tools/ftsanity.py to test/suite_unittests.py.

Change-Id: I8582b19c0544d032eb0566bc1e82be385e904c11
Reviewed-on: https://code.wireshark.org/review/27341
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-05 16:10:24 +00:00
Gerald Combs 7591ed848e Test: Add dftest to our tests.
Move the dfilter tests and captures from tools to test.

Change-Id: I2e6a6cc1d383c985ba07c76c93ae1c57d3c8f84c
Reviewed-on: https://code.wireshark.org/review/27339
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-04 22:44:32 +00:00
Gerald Combs 751e9463ce Test: Fix default capture interface discovery.
Change-Id: Id033a0e4e1e81ae9e84774b2d76f95049a2e2b3a
Reviewed-on: https://code.wireshark.org/review/27315
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-03 19:45:36 +00:00
Gerald Combs 58da452d22 Test: Remove the Bash test scripts.
They've been replaced by the Python scripts.

Change-Id: I8add9c9ea0a6bdd68b2fa3841977863c0ea9a761
Reviewed-on: https://code.wireshark.org/review/27243
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-02 04:09:26 +00:00
Gerald Combs 44537199a2 Test: Add wslua.
Change-Id: I904796d13550c04df1958715d6528548385c3109
Reviewed-on: https://code.wireshark.org/review/27241
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-02 00:35:20 +00:00
Gerald Combs 74fd569018 Test: Fix capinfos output and command paths.
Convert capinfos output to UTF-8 in getCaptureInfo.

Normalize our command paths, otherwise "./run/RelWithDebInfo/..." might
be interpreted as the command "." with flags "/run", "/RelWithDebInfo",
etc. on Windows.

Change-Id: Ib7336a016db3ee0805739fc44913cb9c6895aaad
Reviewed-on: https://code.wireshark.org/review/27239
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-01 18:46:13 +00:00
Gerald Combs d25e7c8d91 Test: More fixes and updates.
Move UAT file creation to config.py.

Run the text2pcap and some of the clopts tests under our default
environment.

Use "in" instead of "has_key".

Change-Id: Ie5c70fb33c29676672bed7bf8205cff0bba77f8a
Reviewed-on: https://code.wireshark.org/review/27234
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-05-01 00:37:41 +00:00
Gerald Combs ed38488211 Test: Add unittests.
Note that these require the "test-programs" target.

Change-Id: I1bea381eaa48504fcd76f88e1c6f2edece0a78a2
Reviewed-on: https://code.wireshark.org/review/27231
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-30 22:38:37 +00:00
Gerald Combs bd5a7d0295 Test: More fixups.
Change-Id: I5869d995754ce9e8a128feaef6911b3c05c79e85
Reviewed-on: https://code.wireshark.org/review/27233
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-30 22:19:29 +00:00
Gerald Combs c353a12cc0 Test: Add a missing global.
Change-Id: I5410b427b452678b24d7ee079ec48cc8300de3a0
Reviewed-on: https://code.wireshark.org/review/27232
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-30 21:58:34 +00:00
Gerald Combs edd9e8387e Test: Add text2pcap.
Change-Id: Ib7cebcb911e2a59812fe03655a112acd3521e5a3
Reviewed-on: https://code.wireshark.org/review/27230
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-30 21:43:30 +00:00
Gerald Combs d32ccb5c87 Test: Add name resolution.
Change-Id: I7b289de5c807b61e1825b30c7f98bfc50caa9625
Reviewed-on: https://code.wireshark.org/review/27228
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-30 18:50:10 +00:00
Peter Wu b9f915eeef Lua: ensure that DATA_DIR and USER_DIR have trailing slashes
These directories have had trailing slashes for years and users seem to
rely on it, so restore this assumption for backwards compatibility. The
underlying API function (Dir.persconffile_path()) is not changed because
trailing slashes were not documented for that function.

For consistency, ensure that all Lua Dir functions return paths without
trailing slashes.

Bug: 14619
Change-Id: Ia299864999578884b1ad1cd48f1bd883bce6879d
Fixes: v2.5.0rc0-579-gfb052a637f ("Use g_build_filename() instead, fix indentation")
Reviewed-on: https://code.wireshark.org/review/27166
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-04-30 10:33:46 +00:00
Gerald Combs f5a7ddf8aa Test: Quote our Python executable.
Change-Id: Ica80406d6420b9f97792a19b192f8a7d764e673b
Reviewed-on: https://code.wireshark.org/review/27185
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-27 23:12:02 +00:00
Gerald Combs 50061856dd Test: Add mergecap.
Change-Id: Ib21f4866cff27e22a4dc13300c3c38fa962a860f
Reviewed-on: https://code.wireshark.org/review/27184
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-27 22:42:05 +00:00
Gerald Combs e6d129bf23 Test: Add fileformats and I/O.
Add the fileformats and I/O suites. Move some more common code to
subprocesstest.py and add a diffOutput method.

Change-Id: I2ec34e46539022bdce78520645fdca6dfc1a8c1a
Reviewed-on: https://code.wireshark.org/review/27183
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-27 19:52:04 +00:00
Gerald Combs 9b3be1711f test: Miscellaneous fixups.
In util_slow_dhcp.py, open stdout as O_BINARY on Windows.

Have ctest pass --verbose to test.py.

Call config.canCapture at test time so that we don't inadvertently skip
some tests.

Stringify our dumpcap config check.

Fix our Gcrypt variable.

Change-Id: I884ec23ddfc7c28b79d4a860c6c43c308598e6db
Reviewed-on: https://code.wireshark.org/review/27182
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-27 17:15:19 +00:00
Gerald Combs 0ad4239249 Start porting our test scripts to Python. Add ctest support.
Create Python versions of our various test shell scripts. Add CMake
tests for each suite. Tests can now be run directly via test.py, via the
"test" target, or via ctest, e.g.

  ctest --verbose --jobs 3

Add a testing chapter to the Developer's Guide.

Add a way to disable ctest in dpkg-buildpackage.

Suites completed:
- capture
- clopts
- decryption
- dissection

Remaining suites:
- fileformats
- io
- mergecap
- nameres
- text2pcap
- unittests
- wslua

Change-Id: I8936e05edefc76a86b6a7a5da302e7461bbdda0f
Reviewed-on: https://code.wireshark.org/review/27134
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-04-26 19:27:19 +00:00
Guy Harris 372b820255 Get rid of more .libs stuff.
Again, no more autotools/libtool, so no more .libs, as that's a
libtoolism.

Change-Id: I909c18b969ca8e04a252ff45f7f3e6bc9d0c8476
Reviewed-on: https://code.wireshark.org/review/27138
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-04-25 04:24:21 +00:00
Pascal Quantin aae825cf77 Remove remnants of WS_QT_BIN_PATH
Change-Id: If1152b285df143dd7cf75abf9ecbc2d0251306df
Reviewed-on: https://code.wireshark.org/review/27021
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2018-04-19 08:01:27 +00:00
Gerald Combs fc153057e8 Remove GTK+ tests.
Change-Id: Iba2f9c669c81cfae675ab584ad0250f69aadb987
Reviewed-on: https://code.wireshark.org/review/26819
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>
2018-04-09 08:28:33 +00:00
Dario Lombardo fdd426e410 spdx: more licenses converted.
Change-Id: Ia1650bc02511f7bd47fb90be91b623177f05bcbd
Reviewed-on: https://code.wireshark.org/review/26337
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-09 04:48:20 +00:00
Dario Lombardo 8a5385b9c9 More licenses converted to SPDX.
Change-Id: Id4f987dcdacf06622d70263f4659a4400e30dc39
Reviewed-on: https://code.wireshark.org/review/26332
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 13:35:49 +00:00
Gerald Combs 2934683aa1 Fix a typo in the I/O tests.
Change-Id: I45bfa6eb9245d0f470a0316141f81c99cc5a9754
Reviewed-on: https://code.wireshark.org/review/25797
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-02-14 22:30:15 +00:00
Gerald Combs a106c762ef Test: Fix the plugin check.
Change-Id: I9724fa36070635bfd1392167eb362cf8631611fa
Reviewed-on: https://code.wireshark.org/review/25267
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-11 16:32:10 +00:00
Gerald Combs 93ea677ec4 Test: Add a plugin check.
Add a test for `tshark -G plugins`.

Change-Id: I9ddced8ad5c200bd11433c7b30038f83da8d7460
Reviewed-on: https://code.wireshark.org/review/25253
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-11 06:33:39 +00:00
Guy Harris af0f49e80d Use pcapng as the name of the file format.
At one point, I remember a discussion resulting in the official name of
the next-generation replacement for pcap format being changed to
"pcapng", with no hyphen.

Make Wireshark reflect that.

Change-Id: Ie66fb13a0fe3a8682143106dab601952e9154e2a
Reviewed-on: https://code.wireshark.org/review/25214
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-09 00:38:51 +00:00
Graham Bloice b0b5bda7cb Revert "Windows tests:"
This reverts commit b4fc532372.

No longer required.

Change-Id: I0ec135d7b54f2aa1b8369fe8192fd2e725ffd5a8
Reviewed-on: https://code.wireshark.org/review/24409
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2017-11-14 17:46:06 +00:00
Graham Bloice b4fc532372 Windows tests:
Add some debug info to the failing tests by displaying
the LANG var.

Change-Id: I0a7316d06a6aca035b46c3e6211ac8e93425e295
Reviewed-on: https://code.wireshark.org/review/24407
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2017-11-14 16:27:08 +00:00
Michael Mann b1302f0f28 Remove circuit_id from Lua tests
It was removed from packet_info when circuit API was removed.  Remove
tests that call circuit_id for testing.

Change-Id: I88e54b288d9d8f99b63e0828663b3025c57e0ec8
Reviewed-on: https://code.wireshark.org/review/24400
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-13 20:27:17 +00:00
Simon Graham ffb8bbd372 Add support for dissecting UDT over DTLS
Includes adding per-conversation data to store whether we are over
DTLS or UDP and registering as a heuristic sub-dissector for DTLS.
Future changes will add more use of the conversation structure.

Also included is a capture of UDT over DTLS in test/captures/udt-dtls.pcapng.gz,
the associated private key for the session in test/keys/udt-dtls.key and a
new test in the decryption suite to check this works.

Change-Id: I76826d3b35768d0b58f5335063884616968e5784
Reviewed-on: https://code.wireshark.org/review/22533
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-09 18:25:08 +00:00
Ryan Doyle f24ffb0bcd http2: reassemble entity bodies in data frames
This commit reassembles data frames to build up the full entity body. It does
this for both client/server request and responses. Additionally, it also
decompresses bodies if they have the correct content-encoding header provided
and are not partial bodies.

Bug: 13543
Change-Id: I1661c9ddd09c1f6cf5a08b2b1921f95103aebb52
Reviewed-on: https://code.wireshark.org/review/20737
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-22 16:22:59 +00:00
Silvio Gissi 59add43eec Lua: Add "tonumber" method to NSTime
Absolute and Relative time fields could not be converted to seconds
without converting to string and parsing to number.

Fixed conversion in generated code that was subject to precision loss

Usage:
f=Field.new("frame.delta_time")
delta=f().value:tonumber()

Change-Id: I6ef91c6238a6c2ed9adf6cae03f8913f0a09332e
Reviewed-on: https://code.wireshark.org/review/22316
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-21 23:50:27 +00:00
Guy Harris 1a7f9b957f Revert "Temporary debugging hack, the sequel - fewer printouts, flush before crash."
This reverts commit fa3aa67817.

Change-Id: I974606b2c7963d92832b74e05681431442542202
Reviewed-on: https://code.wireshark.org/review/22200
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-18 02:01:17 +00:00
Guy Harris fa3aa67817 Temporary debugging hack, the sequel - fewer printouts, flush before crash.
Change-Id: I867c1f78554fc6fabd2579107fe679a6f6033c0c
Reviewed-on: https://code.wireshark.org/review/22199
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-18 01:01:46 +00:00
Guy Harris e77817cc92 Revert "Temporary hack to try to debug tshark -G values crash on 32-bit Windows."
This reverts commit 573a4c9cd5.

Change-Id: Ia967e1e7ae617556cb2d0247fa45026f610bafa8
Reviewed-on: https://code.wireshark.org/review/22198
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-17 23:42:19 +00:00
Guy Harris 573a4c9cd5 Temporary hack to try to debug tshark -G values crash on 32-bit Windows.
Change-Id: I837a1e724f58f3e85ae4d7c77715e185a4b1ebeb
Reviewed-on: https://code.wireshark.org/review/22197
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-17 21:55:01 +00:00
Peter Wu 57b0527821 Add ChaCha20-Poly1305 decryption support for TLS 1.2 and 1.3
Implements all seven AEAD_CHACHA20_POLY1305 cipher suites from RFC 7905
(for TLS 1.2) and the final missing one for TLS 1.3 (draft -20).

New test captures (created using OpenSSL_1_1_0-pre6-2528-g042597b0a)
also serve as tests for TLS 1.3 decryption support.

Change-Id: Ice6d639c9c7b7bc23a6ff5fb4832d02694abd8c4
Ping-Bug: 12779
Reviewed-on: https://code.wireshark.org/review/21902
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-06-02 22:04:21 +00:00
Rado Radoulov ae8b18d618 New Lua function TreeItem:referenced(ProtoField | Dissector).
This function returns TRUE/FALSE depending whether the specified ProtoField/Dissector
needs to be dissected. By using this function in conjunction with the TreeItem.visible
attribute, Lua dissectors can be significantly sped up by making less C interop calls
which are relatively slow in terms of dissection especially when using sub-protocols
where the dissection of an entire protocol can be skipped.

Added tests for TreeItem:referenced to protofield.lua

Change-Id: I44feacb91a2a5b0e3c28c0ccd8d6b04cccd67261
Reviewed-on: https://code.wireshark.org/review/21387
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-05-05 08:38:40 +00:00
Guy Harris 357cfd3b03 A bunch of "{Mac} OS X" -> "macOS" changes.
Avoid anachronisms, however; there was no "macOS 10.0" or even "OS X
10.0", for example.  It was "Mac OS X" until 10.8 (although 10.7 was
sometimes called "OS X" and sometimes called "Mac OS X"), and it was "OS
X" from 10.8 to 10.11.

Change-Id: Ie4a848997dcc6c45c2245c1fb84ec526032375c3
Reviewed-on: https://code.wireshark.org/review/20933
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-05 19:16:22 +00:00
Stig Bjørlykke 1dde988265 Lua: Add some ProtoField tests
Add tests for abbrev and name validation.
Add tests for signed integer base values.

Change-Id: I0bd65c6633b44ae998880f528c22afc22c87529d
Reviewed-on: https://code.wireshark.org/review/20568
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-19 15:14:18 +00:00
Stig Bjørlykke a8478844f3 Lua: Run protofield test with tree
Only perform the protofield with a tree.

Change-Id: I93caeb505d1138a57c846ea6c295e5a44d72023c
Reviewed-on: https://code.wireshark.org/review/20564
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
2017-03-16 14:19:55 +00:00
Stig Bjørlykke 0837dd23ec Lua: Add absolute time base values
Add ABSOLUTE_TIME_* defines to the base table in init.lua for use
in ProtoField.absolute_time.

Change-Id: I5c99eafdac97655d71fd4f3374294cd587afaf0a
Reviewed-on: https://code.wireshark.org/review/20543
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-15 18:44:44 +00:00
Stig Bjørlykke ba49a8526c Lua: Add some ProtoField tests.
Test usage of base.UNIT_STRING.

Change-Id: I9c97b58b3cc6db65713e83609900880e157237f2
Reviewed-on: https://code.wireshark.org/review/19357
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-03-14 13:58:18 +00:00
Jakub Zawadzki 74f4664f93 Remove executable bit, from not executable files.
Change-Id: I8afa246172cd8d5a86513ade2f482566e3f9957a
Reviewed-on: https://code.wireshark.org/review/20272
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2017-02-26 17:49:34 +00:00
Gerald Combs 0165b8c40c Enable some more tests.
The "Microsecond pcap-ng via stdin" and "Nanosecond pcap-ng via stdin"
tests work here on macOS and Windows (likely due to g8a141fe), so
enable them.

Change-Id: I148d02f0cc23162d782457e1d8f0e7c2c0dc6932
Reviewed-on: https://code.wireshark.org/review/19877
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-01-31 16:45:25 +00:00
Peter Wu 58fb6e1acd test: add (D)TLS test for AEAD ciphers
TLS and DTLS share the same code for decryption of AEAD ciphers.
Add tests for all possible AEAD cipher modes (GCM, CCM, CCM_8).
PSK is used to reduce the handshake size (removing certificates).

The decryption suite passes these tests on:

* Libgcrypt 1.6.5 (Ubuntu 14.04)
* Libgcrypt 1.7.6 (Arch Linux)
* Libgcrypt 1.4.5 (CentOS 6). Note that the GnuTLS packages are too old,
  so tests that depend on RSA keys fail here (but the new tests pass).

Change-Id: If0dc5b94223fb247062e23960ff66dfdd4f7a902
Reviewed-on: https://code.wireshark.org/review/19850
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-31 06:46:45 +00:00
Franklin "Snaipe" Mathieu e95519b7f9 lua: Added new integer sizes in TvbRange
* Added support for 3-byte integers in :int() and :le_int()
* Added support for 5, 6, and 7-byte integers in :int64() and :le_int64()

Change-Id: If9ab4ea806191bc63effe45a081b9c65693c2367
Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
Reviewed-on: https://code.wireshark.org/review/18672
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-11-06 09:01:16 +00:00
Snaipe d8db5646ef lua: Added support for FT_IPv6 fields
* Implement Tvb:ipv6()
* Handle FT_IPv6 protofields during insertion in the lua tree
* Implement Address.ipv6(hostname)

Change-Id: I585c392681b3aef02ed8ee956f74051d77fb28d4
Signed-off-by: Franklin "Snaipe" Mathieu <snaipe@diacritic.io>
Reviewed-on: https://code.wireshark.org/review/18442
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-25 19:18:35 +00:00
Peter Wu 1b9d46a950 tests: do not invoke missing unit tests
If the "test-programs" target is not built, then it should not try to
invoke the last program (wireshark-gtk in my case).

Change-Id: Ida60a71d1dc47305ef8abe10e6c96c8a1cb8dcbb
Reviewed-on: https://code.wireshark.org/review/18346
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-21 22:36:22 +00:00
Peter Wu 7f6a4926d2 test: make GTK support optional
Current Ubuntu buildbot is failing because GTK support was removed.
Tests should not fail if GTK is not available, so make it optional.

Change-Id: I1640c8bcea5208299f6846eb366e105c39a3ebf3
Reviewed-on: https://code.wireshark.org/review/18345
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-21 20:38:46 +00:00
Gerald Combs 59c3704404 Add a Kerberos decryption test.
Test Kerberos decryption using files from krb-816.zip on the
SampleCaptures page.

Change-Id: Ic1360b637ca6a1f6cb86d09a6aebfd7f5ff89419
Reviewed-on: https://code.wireshark.org/review/18275
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-19 10:07:13 +00:00
Peter Wu 537705a8b2 wslua: prepare for split class/instance (meta)methods
Previously the metatables for classes were the same for the class and
its instances. This results in issues like calling __gc on the class
table on exit.

Make it possible to declare separate class methods (functions) and
instance methods. Observe that all attributes apply to the instances
only, so make these just available on the instance.

The attribute/methods lookup method (via __index/__newindex) have been
rewritten to use upvalues, removing the technical need for the
properties __getters/__setters/__methods. The "lua globals" test still
checks for these, but it could be removed in the future.

To fix bug 12968, the __gc method is removed from the class method.
Future patches should remove the WSLUA_REGISTER_CLASS,
WSLUA_REGISTER_META and WSLUA_REGISTER_ATTRIBUTES macros completely and
create split class functions/methods (such that __call for an instance
cannot accidentally be invoked on the class).

Removed duplicate "fragmented" property from Pinfo (which triggered an
error) and replaced exit() by g_error() for debugger friendliness.
Remove lua_shiftstring since checkstring always returns non-NULL.

Bug: 12968
Change-Id: I57f8a93d08bb84c79b0e94cf2c82d8402fc16646
Reviewed-on: https://code.wireshark.org/review/18026
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-10-18 20:41:34 +00:00
Joerg Mayer 95c944884a More wlan_mgt cleanup:
- Fix test script to use wlan instead of wlan_mgt
  - Remove a now useless test in the dissector

Change-Id: I9a7644947c3002c759a7ae5728a8559682cfd4fd
Reviewed-on: https://code.wireshark.org/review/18215
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-10-16 14:03:55 +00:00
Balint Reczey b1cc056b12 Remove nghttp2 code and use system' nghttp2
Update debian, macos (setup / homebrew) download script
Update testsuite (don't try HPACK when build without nghttp2)

Change-Id: I365e5e17bc4fab4acd81b4c39ea7189a5d1ee112
Reviewed-on: https://code.wireshark.org/review/17347
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-13 19:26:10 +00:00
João Valverde 754d03cb82 Disable wslua GRegex unit test
It's broken for recent GLib versions and there is no time frame for
a fix.

Ping-Bug: 12997
Change-Id: Ia687af9b0df8fc37121179ba20761c878bf57057
Reviewed-on: https://code.wireshark.org/review/18140
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-10 21:49:08 +00:00
Peter Wu 7a674c006b ssl: fix TLS renegotiation, add test for this
A handshake starts a new session, be sure to clear the previous state to
avoid creating a decoder with wrong secrets.

Renegotiations are also kind of transparant to the application layer, so
be sure to re-use an existing SslFlow. This fixes the Follow SSL stream
functionality which would previously ignore everything except for the
first session.

The capture file contains a crafted HTTP request/response over TLS 1.2,
interleaved with renegotiations. The HTTP response contains the Python
script used to generate the traffic. Surprise!

Change-Id: I0110ce76893d4a79330845e53e47e10f1c79e47e
Reviewed-on: https://code.wireshark.org/review/17480
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-06 13:45:30 +00:00
Peter Wu 7c7497a77e ssl,http: rename http-over-ssl to http-over-tls
This name is displayed in the SSL prototcol tree (Application Data
Protocol: http-over-tls), rename to avoid possible user confusion.

Modify the SSL dissector such that both "http" and "http-over-tls"
invoke the same dissector function.

Change-Id: I2d52890a8ec8fa88b6390b133a11df607a5ec3dc
Reviewed-on: https://code.wireshark.org/review/17481
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-04 13:18:54 +00:00
Guy Harris c8157aa6b4 Go back to having only one SocketCAN LINKTYPE_ value.
Libpcap just backed out the "host-endian" SocketCAN LINKTYPE_ value; we
don't need it any more.

Change-Id: I33a7dc21207a0009e20b4abaefe1119eb649c39a
Reviewed-on: https://code.wireshark.org/review/17327
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-25 21:14:48 +00:00
Michał Skalski c7ca0e88df dissector ISAKMP IKEv2: fixed bug with libgcrypt-1.6.x and AEAD ciphers
IKEv2: 
Fixed bug with AEAD ciphers with 8- and 12-byte length ICVs and
libgcrypt 1.6.x - gcry_cipher_checktag() returned INVALID_LENGTH.
Fixed for merged changeset https://code.wireshark.org/review/17078


Added support for verification of encrypted data with HMAC_MD5_128
[RFC4595] and HMAC_SHA1_160 [RFC4595] integrity algorithms

Added IKEv2 decryption suite for few combinations of encryption and
integrity algorithms: 3DES-CBC/SHA1_160, AES-128-CCM-12, AES-128-CCM-12
(using CTR mode), AES-192-CTR/SHA2-512, AES-256-CBC/SHA2-256,
AES-256-CCM-16, AES-256-GCM-16, AES-256-GCM-8


Change-Id: Ic564b25f1fd41e913c605322b7b8aa030cf90ddf
Reviewed-on: https://code.wireshark.org/review/17213
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-08-23 10:07:38 +00:00
Mirko Parthey 302660bf57 ISAKMP: Add regression tests
Add regression tests for bugs 12610 and 12620

Bug: 12610
Bug: 12620
Change-Id: I6325a3ccb3e27fd4d3be52190e8763737b99fe73
Reviewed-on: https://code.wireshark.org/review/17083
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-08-20 06:48:31 +00:00
Guy Harris 8963303df7 Adjust to the split of the SocketCAN encapsulation.
Change-Id: Ibbe97f15854163163ad2bdf3b425c63d4cbfed50
Reviewed-on: https://code.wireshark.org/review/17158
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-19 02:49:25 +00:00
João Valverde 47fbdc297a Fix unit test location for out of tree autotools build
Make it find test programs under the build tree.

Change-Id: Ie7ff547417e8f248bb58f6c96896977ca4e710d1
Reviewed-on: https://code.wireshark.org/review/17048
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-15 10:00:59 +00:00
Guy Harris 8a141febc8 Use -r rather than -i for the "via stdin" tests.
TShark, at least when running in one-pass mode, now supports reading
from the standard input if the file format is one that *can* be read
purely sequentially; both pcap and pcapng can be read purely
sequentially (unlike, for example, Microsoft Network Monitor format,
where you have to read the frame table, at the end of the file, before
you can read the frames, meaning you have to seek backwards, which you
can't do on a pipe).

Using -r 1) tests the "read from standard input" path, which we should
do in versions that support it, and 2) means we can check whether, for
the crashes we're seeing on 32-bit Windows 8.1, it's a problem with
reading from the standard input in general, or just a problem with
*capturing* from the standard input.

Change-Id: I67da34de43f47dd8c63fa2f2072be41148cfe5a7
Reviewed-on: https://code.wireshark.org/review/16968
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-09 02:14:28 +00:00
João Valverde 0ceff86a83 test.sh: Don't abort on failed test
This behavior severely limits the usefulness of the test suite. An option
to configure it would still be nice.

Change-Id: I2bc96a043cc4ec76f334a3bfe48967703ef1be5e
Reviewed-on: https://code.wireshark.org/review/16890
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-06 12:14:49 +00:00
Guy Harris 746e04976e Fix copyright.
I'd just copied and pasted the copyright notice from test/test.sh; Ulf
wrote test/test.sh, but didn't write test/run_and_catch_crashes - I did,
but, hey, might as well give the copyright to Gerald.  Fix the date as
well.

Change-Id: Id307f354289ca72931dd83f472d879d733618e3c
Reviewed-on: https://code.wireshark.org/review/16910
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-05 18:31:09 +00:00
Guy Harris 73c7cc67b6 Put the usual copyright notice on test/run_and_catch_crashes.
Change-Id: I397e5483baa79b5bf043d746aabab6c54499fabc
Reviewed-on: https://code.wireshark.org/review/16903
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-05 18:15:42 +00:00
Gerald Combs 3aedb1e256 Add an ESP decryption test.
Add an ESP decryption test using the capture+keys from bug 12671.

Change-Id: I5f7ce477ec74d59c1043345728a1444842912b96
Ping-Bug: 12671
Reviewed-on: https://code.wireshark.org/review/16733
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Tested-by: Gerald Combs <gerald@wireshark.org>
2016-07-28 18:14:52 +00:00
Guy Harris 473910b76d We no longer add default names to interfaces in an IDB.
The way you say "this interface's name is unknown" is by not giving it
an if_name option, not by giving it an if_name option that says "this
isn't known".  Remove the if_name option from the interfaces in this
capture file.

Change-Id: Ie3569c81bd065e48278cfa83b82b06ea6b5258af
Reviewed-on: https://code.wireshark.org/review/16455
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-15 03:21:04 +00:00
Peter Wu 9b91e64fee test: ensure temporary directory outside source tree
The whole point of using mktemp is to get a temporary directory outside
the source tree. Commit v2.1.0rc0-1027-ge01f8fb tried to fix the
invocation for *BSD (including OS X), but by adding a template it
dropped the implicit --tmpdir option for GNU mktemp on Linux..

Use the GNU mktemp invocation and if it fails (for example, because a
template is expected for BSD/OS X), provide a template.

Change-Id: I77bbc7dc2045e4fa756e102afa080860b0857713
Reviewed-on: https://code.wireshark.org/review/16178
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-06-27 22:42:01 +00:00
Pascal Quantin 6baa1b544c Remove Nmake build system
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61
Reviewed-on: https://code.wireshark.org/review/15777
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-15 19:21:57 +00:00
Gerald Combs dfc545d8f2 Test: Revert debugging output.
Revert "Test: Make capture_step_stdin more verbose." and "Test: more
suite-capture debugging." Tests on the Windows 8.1 builder have been
passing since recommended OS updates were installed on the 24th.

This reverts commits 7f710ef2b5 and
f52c3c468a.

Change-Id: I7cf10a38ba001426baea5fc76a34610c3a26ced2
Reviewed-on: https://code.wireshark.org/review/15590
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-05-27 18:44:10 +00:00
Gerald Combs 37df3400dc Test: capture_step_stdin updates.
In capture_step_stdin, print information about our test capture if we
fail.

Change-Id: I046f9d22b1bb2d52d96926f50379ab51e6279eb3
Reviewed-on: https://code.wireshark.org/review/15125
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-26 21:58:12 +00:00
Gerald Combs 7f710ef2b5 Test: more suite-capture debugging.
Change-Id: I94967aeabdf2786868c3f7fce9e95633332d4948
Reviewed-on: https://code.wireshark.org/review/15123
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-26 20:52:08 +00:00
Gerald Combs f52c3c468a Test: Make capture_step_stdin more verbose.
Add some verbosity to the stdin capture test. Hopefully this will shed
some light on the Windows 8 builder failures.

Change-Id: Ife2bbbaeed7a1e4a7ddd1c1f86322ba25d154f4c
Reviewed-on: https://code.wireshark.org/review/15122
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-26 19:22:57 +00:00
Guy Harris 256a7be13e The dissector for HTTP-over-SSL is now called "http-over-ssl", not just "http".
The "http" dissector is what's used for protocols other than TCP, SCTP,
and SSL/TLS.

Change-Id: Ib5138d3a082f1017b7ef190e5128a21eb9a49e92
Reviewed-on: https://code.wireshark.org/review/14947
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-17 06:39:01 +00:00
Guy Harris 954afef645 There are two separate IP-over-Infiniband encapsulations.
pcap files and snoop files have different headers, so there's no
IP_OVER_IB encapsulation type, there are separate types for pcap and
snoop.

Change-Id: I00146e478d05bb11c634df0c386329db8de5635d
Reviewed-on: https://code.wireshark.org/review/14774
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-02 07:41:34 +00:00
João Valverde aedc4af6c1 Use absolute path for test suite TEST_OUTDIR
Error out if it can't be created.

Change-Id: I1a087f0e0cc064be7a417b9a2e66cf3c940e02fa
Reviewed-on: https://code.wireshark.org/review/14565
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-23 15:15:22 +00:00
Guy Harris c9c0effa4b Try putting the output directly into the error message.
When the tests are run in the buildbot, messages such as

	Error during test execution: see {pathname}

aren't very useful.

Change-Id: I4509ea58c162c264c316358019a1cbc01cd93e31
Reviewed-on: https://code.wireshark.org/review/14135
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-25 03:24:18 +00:00
Guy Harris f31449076c Initial support for FreeBSD USB captures.
(There's also work needed in libpcap; that's also in progress.)

Change-Id: Iff5a34c139a000865e2d78cc17a4af5ff24fb44b
Reviewed-on: https://code.wireshark.org/review/14025
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-20 11:12:48 +00:00
Guy Harris 4e85b62ae5 Allow test of the -D and -L options to succeed or fail with a permissions error.
We cannot easily predict what will happen, given the configuration of
the OS, the permissions on files, the availability of extcap devices,
the version of libpcap/WinPcap/NPcap (present or future), etc., etc.,
etc..  Allow those tests to succeed (as would be the case if you have
the necessary permissions) or fail with a non-command-line-syntax error
(as would be the case if you don't have the necessary permissions), but
not to fail with a command-line syntax error.

Change-Id: I76af898d5f146fcf3507c06f101acb578085e6fa
Reviewed-on: https://code.wireshark.org/review/13957
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-15 20:17:54 +00:00
Vasil Velichckov d5c1449d1b [text2pcap] Fix parsing of hash sign at the end of the line
Change-Id: I4ff1ef28aba353fd7548cb5c0603fc29479aa854
Reviewed-on: https://code.wireshark.org/review/13294
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-04 05:13:16 +00:00
Cedric Izoard 6991149557 [airpdcap] Add support to decrypt TDLS traffic
- When scanning for keys, check for TDLS action frames
  (need to have TLDS response or confirm to derive the key)
- When deriving PTK, also check MIC to ensure the key has been correctly
  computed.
- As SA is between two STAs (and not STA and AP), store highest MAC
  address in sa.bssid, and the other one in sa.sta
  => Add new function (AirPDcapGetSaAddress) that will check for TDLS
  case.
- Add test in decryption suite

Bug: 11312
Change-Id: Ieccb6a23a0ffbf3b705dac9b67c856ae2d3eeca9
Reviewed-on: https://code.wireshark.org/review/13664
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-04 04:54:30 +00:00
Alexis La Goutte a57c3bcc87 suite-decrypt: fix mixed indent (use tabs)
Change-Id: I80f2afb6e0cc44af6466fa255e91a40b29c4ca13
Reviewed-on: https://code.wireshark.org/review/13685
Reviewed-by: cedric izoard <cedric.izoard@ceva-dsp.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-03 12:38:21 +00:00
Alexis La Goutte a47c850d50 suite-mergecap: fix indent (use tabs)
Change-Id: I9b3fb7d09d8dc90366167b1072dcdd4efc6f0516
Reviewed-on: https://code.wireshark.org/review/13684
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-03 12:36:46 +00:00
Alexis La Goutte 05384709a0 Suite test: fix modelines for bash script (emac)
c-basic-offset -> sh-basic-offset

Change-Id: I16b19b608fbdb7f0408f7c31871fae746c8c4f50
Reviewed-on: https://code.wireshark.org/review/13683
Reviewed-by: cedric izoard <cedric.izoard@ceva-dsp.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-03 12:35:30 +00:00
Pascal Quantin 699c61f3db Update Lua tests after g9eda2fa
Change-Id: I3e9849afc8df9d81d0d9e0a4eaa9800d9c1ce8ec
Reviewed-on: https://code.wireshark.org/review/13517
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-01-24 21:49:12 +00:00
Cedric Izoard 9b1e318b8e test: Add test in decryption test suite for 802.11w
- Add a test to check decryption of management frames

Bug: 11995
Change-Id: I588d0f17b9e5efc841266b9dae4764e5e931be3f
Reviewed-on: https://code.wireshark.org/review/13259
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-14 03:15:35 +00:00
Guy Harris e01f8fb3ad Explicitly specify the template for the mktemp command.
Not all versions of mktemp support omitting the template; in particular,
the one provided by some BSD-flavored OSes don't.

Change-Id: I657e002559dce165c677a473aa10bb17cc506037
Reviewed-on: https://code.wireshark.org/review/12592
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-13 18:05:36 +00:00
Gerald Combs 4454fb02c7 Ping on Windows isn't necessarily IPv4-only.
The default prefix policy on modern versions of Windows prefers IPv6.
This in combination with the fact that our ping target (www.wireshark.org)
currently has both A and AAAA records might result in ICMPv6 traffic
instead of ICMPv4. Update the capture test suite accordingly.

Change-Id: I5c88f24fb9458526ffd44c5003f09247b6999ce7
Reviewed-on: https://code.wireshark.org/review/12553
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-12-12 01:52:54 +00:00
Guy Harris 0c6c08a60a Change Lua tests to reflect the disappearance of WTAP_ENCAP_IEEE_802_11_AIROPEEK.
The old global tests don't work; get rid of them.  Fix the values of the
Lua globals in the new test, and get rid of IEEE_802_11_AIROPEEK.

(Yes, if you have a Lua script that depends on IEEE_802_11_AIROPEEK
being defined, or that depends on the values of the Wiretap
encapsulations not changing, it breaks.  Fix it.)

Change-Id: I245c1c0c3ba1c450f7950c754624c51b5564848a
Reviewed-on: https://code.wireshark.org/review/12210
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-26 21:34:24 +00:00
Alexander Wetzel 9cd66b270c WPA (IEEE802.11) decryption function cleanups
- Updated AirPDcapPacketProcess function description
 - Try to return better error codes
 - Remove broken/useless return of keys from AirPDcapRsna4WHandshake

Change-Id: I1e4e0a76f6d1307e11c0466f17935dd7030561e1
Reviewed-on: https://code.wireshark.org/review/12033
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-25 21:00:59 +00:00
Guy Harris 95fd55e56b For now, call the finish routine in Lua file writers "close".
If we ever change the way file writers work, in a fashion incompatible
with the existing way they work, we'll also rename this member - and get
rid of checks for earlier versions of the Lua interface.

Change-Id: I64065944fa31371f5249cafd930c18f180ad7299
Reviewed-on: https://code.wireshark.org/review/11879
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-16 19:18:15 +00:00
Guy Harris 3425b5bc48 Update tests to reflect Lua file API change (write_close -> write_finish).
Change-Id: I7288cd3660dfd14be95dc42910faed47eca8226b
Reviewed-on: https://code.wireshark.org/review/11661
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-09 20:01:06 +00:00
Alexander Wetzel cb3dd958af WPA/WPA2 decoding fixes and improvements
- start decoding when we have eapol1+2 packets
  Do not insist on a complete captured handshake, decode what we can.

- more robust way to detect eapol #2 packets
  At least Win 10 is violating the spec on rekey by setting the secure
  bit in #2. Unpatched version shows and handles #2 as #4, breaking
  decoding after rekey.

- fixed eapol rekey key handling
  Inital patch (see https://code.wireshark.org/review/8268)
  is adding redundant keys, since it scans all the time
  and not only once.

- ignore tailing garbage after eapol sections in frame
  See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9065#c8

Included testcase to test decode for incomplete handshakes and eapol2
packets with secure bit set on rekey.

Ping-Bug: 9065
Change-Id: Id775088db9b5aaa80da9efdeed6902d024b5c0cd
Reviewed-on: https://code.wireshark.org/review/11484
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-11-09 11:28:14 +00:00
Vasil Velichckov 8201711e80 text2pcap: Add test suite
Use the pcap captures from test/captures/ and
- Get information for the input pcap file with capinfos
- Generate an ASCII hexdump with text2pcap
- Convert the ASCII hexdump back to pcap using text2pcap
- Get information for the output pcap file with capinfs
- Check that file type, encapsulation type, number of packets and data size
  in the output file are the same as in the input file

Change-Id: I659204fb0a46e9cd99d03eb666f55fac95ae053e
Reviewed-on: https://code.wireshark.org/review/11042
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-15 14:00:04 +00:00
Graham Bloice 009b40ba06 Fix tests to allow selection of suite 10
The tests only allowed a single character suite selection, which
prevented suite 10 from being run on its own.

Modified test.sh to now require a newline in addition to the input
so that a 2 digit number can be entered.

Also fixed test display to remove illusion that an individual step
could be run.  Only whole suites can be run.

Change-Id: I4dee0ec6a8e1f34fa443a6a0a3f2d52a73146e54
Reviewed-on: https://code.wireshark.org/review/10676
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-09-28 20:28:25 +00:00
Jeff Morriss 3ff5afd541 Add a test to verify we pre-allocated enough hf entries.
This way we'll know as soon as we drop below the pre-allocated limit. As
suggested by Graham on https://code.wireshark.org/review/10601

Change-Id: Ieeb14bdcf991d7a67c30787c97ca24ebb35d1763
Reviewed-on: https://code.wireshark.org/review/10627
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-09-23 20:09:39 +00:00
Hadriel Kaplan 6fb6edeaf1 Get the windows buildbot working for mergecap test suite
Change-Id: Ic9351b9bb8df85086eee3ab21908a2f9a04db767
Reviewed-on: https://code.wireshark.org/review/10141
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-08-20 01:39:53 +00:00
Hadriel Kaplan 0bdf518b1e Try to debug merge test suite failure on windows buildbot
This change will be undone once the problem is found.

Change-Id: Ica9cfe31b4e30fad2bb9de508af61baa1c455cc1
Reviewed-on: https://code.wireshark.org/review/10136
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-08-19 20:28:44 +00:00
Hadriel Kaplan dcaa64a050 Mergecap: add test suite for various merging scenarios
Add a test suite for mergecap (and indirectly capinfos I guess).
This is not exhaustive, but it's a start.

Change-Id: I9442b4c32e31a74b1673961ad6ab50821441de3e
Reviewed-on: https://code.wireshark.org/review/10082
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-19 04:27:42 +00:00
Hadriel Kaplan 963b0c919e Lua: add the 1.12.x Lua API to the globals verification test suite
Change-Id: I698fc75dc915ea007b2f7762f0041dbb6dd1d8d3
Reviewed-on: https://code.wireshark.org/review/9764
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-24 01:10:34 +00:00
Guy Harris 5b9d61f3b9 Remove the debugging output; it's now attached to the bug.
Change-Id: I6a9252d2841fc44c6fdb6bd27517d60570afbae0
Reviewed-on: https://code.wireshark.org/review/9695
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 21:40:24 +00:00
Guy Harris ecd3017b73 In the p < q test, first run tshark -V, to see the full dissection.
Change-Id: I7d82d34369d192e7da7d554f44f448e1613f850f
Reviewed-on: https://code.wireshark.org/review/9694
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 20:28:44 +00:00
Guy Harris 354f8e31cb Dump the output of tshark in the p < q decryption test.
See what it prints on Windows.

Change-Id: Id35d87595543eca3e5b5d80dbe9a7639e0a85994
Reviewed-on: https://code.wireshark.org/review/9693
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 18:41:10 +00:00
Guy Harris 5a51b8bff8 Don't discard the echo command's output.
Change-Id: I957a0c1beeae4bbd8c32ed05f30525becaf37e95
Reviewed-on: https://code.wireshark.org/review/9682
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 07:57:41 +00:00
Guy Harris 520315f890 OK, that didn't do it - print the command again.
Too bad DEC used / as an option character and Bell Labs chose it as a
pathname separator.

Change-Id: Ie58ba79476e0f24e408fae55f6c5eaff3ffb11fa
Reviewed-on: https://code.wireshark.org/review/9680
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 07:14:02 +00:00
Guy Harris 57520afe1e Generate key paths as UN*X paths and then run them through cygpath.
In the decryption_step_ssl_rsa_pq - and the
decryption_step_ssl_master_secret test - duplicate the code used to
generate TEST_KEYS_DIR, so that we construct a UN*X-style path and then,
if we're running on Windows, map the UN*X-style path, which is a Cygwin
path, to the equivalent Windows-style path, and pass that to TShark on
the command line.

Bug: 11372
Change-Id: I442a30c4c954540a05942ed70ec3687941428a96
Reviewed-on: https://code.wireshark.org/review/9675
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 04:42:25 +00:00
Guy Harris f82df51911 Temporarily log the command that's failing.
Trying to debug the problem.

Change-Id: I26f78e49556cb1d40f0c8ddbfd58f058dceb0e77
Reviewed-on: https://code.wireshark.org/review/9674
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-17 02:40:16 +00:00
Peter Wu 45812a51a3 test: fix RSA decryption test under Windows
TEST_KEYS_DIR already contains a trailing slash. Windows does not like
forward slashes, so drop the additional slash to fix tests under
Windows.

Fixes: v1.99.8rc0-417-g85f8a99
Bug: 11372
Change-Id: Ief794977281b70549369c344a193f4d48bcc1776
Reviewed-on: https://code.wireshark.org/review/9668
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-16 23:36:18 +00:00
Peter Wu 85f8a99f35 ssl-utils: fix failing decryption for some RSA keys
Reported at
https://ask.wireshark.org/questions/43788/struggling-to-decrypt-ssl

"u" requirement is documented at
https://www.gnupg.org/documentation/manuals/gcrypt/RSA-key-parameters.html#RSA-key-parameters

Add regression test (key is generated manually with p and q swapped and
qInv recalculated).

Change-Id: I5505ddcdb54bb47d7a58867b8c3e53fcc0f66dde
Reviewed-on: https://code.wireshark.org/review/9573
Tested-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-07-15 21:31:44 +00:00
Hadriel Kaplan 281055af9c Lua: add functions for more field information
Add Lua functions so a plugin can introspect field information, such
as the type of field, flags, tvb, etc. Also add a couple of Tvb and
ByteArray methods. And cleanup the TreeItem code a little.

Change-Id: I7b58ce589ace91cce14b8abccd01ceabb63e2653
Reviewed-on: https://code.wireshark.org/review/6500
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-09 01:49:11 +00:00
Guy Harris be67f53686 Exit with the exit status of the command we ran.
Also, expand a comment.

Change-Id: Icbb8ead02f55087f3ac09747fe518f211d488172
Reviewed-on: https://code.wireshark.org/review/9057
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-23 17:16:12 +00:00
Guy Harris 7cdd22f422 Try to catch TShark crashing and get a stack trace.
It's currently crashing in the Solaris buildbot when we do "tshark -v";
hopefully this will give us something more useful than

  test.sh: line 144: 21543 Abort                   (core dumped) $TSHARK -v

  "Version information" Failed!
  Failed to print version information
  Binary file ./core matches

as a diagnostic.

Change-Id: I278c8dd9f6acf5ddfa83bc0a7f3f7a3c48577ac2
Reviewed-on: https://code.wireshark.org/review/9052
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-23 07:21:49 +00:00
Guy Harris 5472e4d6e9 Debugging printf.
The buildbot printed "expr: syntax error", presumably from this, but
that oh-so-descriptive error message doesn't indicate what the problem
is, and just about any string should be valid as the left-hand operand
of the : operator.

Change-Id: I1140522357b8df07e4183bf0eb8c5fa9fbe275e4
Reviewed-on: https://code.wireshark.org/review/8827
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-08 01:10:28 +00:00
Pascal Quantin 8da4d22631 Fix decryption test suite on Windows
Change-Id: Ib8207d56a7e064855ce1444c927913c9c9258788
Reviewed-on: https://code.wireshark.org/review/8766
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-04 21:34:07 +00:00
Kevin Grigorenko 5f9a52dc95 SSL: Add support for private key password when decrypting
SSL traffic from tshark with -o ssl.keys_list.


For example, as used in a new test also added in this commit:

-o "ssl.keys_list: 127.0.0.1,9131,http,$TEST_KEYS_DIR/key.p12,WebAS"

Change-Id: Ia6960fa4ae88182277f6d22d84ec9170ea74d54e
Reviewed-on: https://code.wireshark.org/review/8746
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-06-04 15:49:45 +00:00
Guy Harris f1c375d006 Try to handle the executable being a libtool wrapper.
Change-Id: I8fd2b4445707029ea24ad3c02804c0bf8fcedd15
Reviewed-on: https://code.wireshark.org/review/8406
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-11 20:29:34 +00:00
Guy Harris f4c2d3b740 Remove trailing whitespace.
Change-Id: Ibdb899ddcaa88579aa2dc3c842d016a1ac164e2a
Reviewed-on: https://code.wireshark.org/review/8404
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-11 19:24:13 +00:00
Guy Harris 5a9d065f1b Skip past env and its environment-variable arguments.
Change-Id: Ic0bec27e5884a1e5db8e98e6d84b677ae8b2d377
Reviewed-on: https://code.wireshark.org/review/8403
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-11 19:23:05 +00:00
Guy Harris c9ec0be83f Try to get a stack trace from core dumps.
Change-Id: I66d853391f29acfb026d3c246adba9bdf6a4dc36
Reviewed-on: https://code.wireshark.org/review/8400
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-11 17:19:22 +00:00
Guy Harris 0617b1a0aa When piping tshark to something else, run it with run_and_catch_crashes.
That got the crash information in the WPA EAPOL Rekey test; use it for
all other tests where, otherwise, the crash information would be lost.

Change-Id: I230b7952b6d79ebf6dc003747dc05328616ef7c2
Reviewed-on: https://code.wireshark.org/review/8394
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-11 00:00:46 +00:00
Guy Harris c8394b8b6f Fix pathname used to run run_and_catch_crashes.
Change-Id: Ib8bbee1906c89decd16f3ea0ea5f78c9337e5f43
Reviewed-on: https://code.wireshark.org/review/8393
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 21:45:19 +00:00
Guy Harris 42611db19a Try wrapping some tshark invocations in a script to catch crashes.
Add a script that takes a command as an argument and runs it in a
subshell, so that said subshell will catch any signals from it and
report it.

This would be done for commands that aren't the last command in the
pipeline, as, given that the exit status of a pipeline is the exit
status of the last command in the pipeline, there's no guarantee that
the shell will bother to pick up the exit status of earlier commands in
the pipeline.

Use that for the tshark in the WPA EAPOL Rekey test, so it at least can
report the signal (on Solaris, SIGSEGV means, among other things,
"dereferenced a pointer pointing out of the address space" and SIGBUS
means, among other things, "dereferenced a misaligned pointer on
SPARC").  Maybe we can make the script also fire up a debugger if it
finds a core dump (and a debugger) and get a stack trace.

Change-Id: I4188190a1f1a4d3afc4719d886161ee56bd89d8b
Reviewed-on: https://code.wireshark.org/review/8392
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-05-10 21:18:53 +00:00
deagol 1439eb6778 IEEE 802.11: 802.1X (WPA-EAP) rekeying support
This patch extends the existing decryption support for WPA to also
handle rekeys by checking each decrypted packet for a 4-way-handshake.

Rekeys can be used for WPA-PSK, but are more common with WPA-Enterprise
(WPA-EAP).

For decrypting WPA-EAP secured packets the user must provide all used PMK's
of the connection (aka PSK's) as WPA-PSK 32 byte hex values to wireshark
via the existing interface.
(The capture must have all 4-way-handshakes included also, starting with
the first unencrypted one.)

Every decrypted unicast packet will habe the used PMK and TK shown in the
CCMP/TKIP section below the key index in the GUI. Group packets will display the
GTK instead.

Additionally this fixes a small issue with group rekey handling, so every packet
can be selected in the GUI in random order, removing the need to manually find
the correct group keying packets prior to that.

It was tested primary with WPA-CCMP, but TKIP is also working.

One section in the code touch bluetooth 802.1X support. It should do
exactly the same, but will now also examine all decypted packets for rekeys.

Ping-Bug: 11172
Change-Id: I19d055581fce6268df888da63485a48326046748
Reviewed-on: https://code.wireshark.org/review/8268
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-05-08 04:27:49 +00:00
Gerald Combs 9670f05384 Add ftsanity.py to the unit tests.
Change-Id: Ib480d8be5f66c70a4213af27acee94016fbf974b
Reviewed-on: https://code.wireshark.org/review/7855
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-30 21:02:21 +00:00
Gerald Combs f074647d2b Add a test-programs target everywhere.
Add a "test-programs" target to each toolchain which builds each unit
test executable. "test-programs" must now be built before running
the unit test suite.

Change-Id: I9317a1e305d987f244c4bd8b4a7f05d11fed7090
Reviewed-on: https://code.wireshark.org/review/7673
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-03-13 22:41:40 +00:00
Gerald Combs b255d8a1a1 CMake: Update wslua build and test.
Process wslua/CMakeLists.txt using add_subdirectory instead of
include. Generate files in the build directory instead of the source
directory.

Copy lua scripts to DATAFILE_DIR instead of DATAFILE_DIR/lua. That's
where init.lua looks for console.lua.

Always set WIRESHARK_RUN_FROM_BUILD_DIRECTORY when testing. We
presumably want to test our source files and not files which may or
may not be in the system path.

When we're running from the build directory look for lua scripts in both
the Autotools and CMake build locations.

Change-Id: Ic15ab8c58ff1b170d000c9b3e0a329af2ec44b7b
Reviewed-on: https://code.wireshark.org/review/7590
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-12 16:37:51 +00:00
Gerald Combs 95ce3928de Fix the Lua FPM dissector test.
In the FPM dissector test, only check the fields produced by the
frame and FPM dissectors.

Change-Id: I212afb8a8a4a7a9aa54391b0d5971b982b819395
Reviewed-on: https://code.wireshark.org/review/7643
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Graham Bloice <graham.bloice@trihedral.com>
2015-03-12 10:44:14 +00:00
Gerald Combs cac102eee3 Change a lot of http:// URLs to https://.
Most of our sites are now HTTPS-only. Update URLs accordingly. Update
other URLs while we're at it. Remove or comment out dead links.

Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33
Reviewed-on: https://code.wireshark.org/review/7621
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-03-10 19:30:50 +00:00
Guy Harris 56446270f9 "Break" the Acme reader so that the tests work.
We don't want to have to change the pcap-ng file against which we
compare, so we hardcode the year here to be the same as the year from
the pcap-ng capture.

Change-Id: Ibd83d06e035341f617b8285f6ba51c749c38a177
Reviewed-on: https://code.wireshark.org/review/7448
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-01 07:13:02 +00:00
Hadriel Kaplan ceb8d954d2 Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.

Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-27 15:14:12 +00:00
Gerald Combs b32e39e198 Test suite: Add verbosity to the HTTP2 test.
We should probably do the same for the other decryption tests but we're
having issues with HTTP2 right now.

Change-Id: I8e8f5da200a29a5ca1cddb39c082bb7ee12d1eaf
Reviewed-on: https://code.wireshark.org/review/6686
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-23 13:14:10 +00:00
Guy Harris 612e286b9e Fix test script to test Lua Pinfo, and fix problem it found.
The test script was running lua/nstime.lua rather than lua/pinfo.lua for
the Pinfo test, and the Pinfo test was testing the ipproto property for
a Pinfo, but that was removed.

Change-Id: Iccdccd265dd550e41640af3acd607362f1f2f02e
Reviewed-on: https://code.wireshark.org/review/6747
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-23 01:52:24 +00:00
Alexis La Goutte af3924a333 HTTP2: Add HPACK decode to test suite
Change-Id: Ic84942b78a795974d6e2023751245ad98b8f1142
Reviewed-on: https://code.wireshark.org/review/6415
Reviewed-by: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-01-20 07:31:23 +00:00
Graham Bloice d7bce33140 Fix Cygwin path
Fix the Cygwin path added for tests so that Cygwin comes after the
existing path and that the correct link command is found for exntest.

Same change to runa2x.sh to be consistent.

Change-Id: I177a5e7d17a0077b0e8ca7d264d7e725a5312e24
Reviewed-on: https://code.wireshark.org/review/6503
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-12 12:40:04 +00:00
Graham Bloice a49e1d54d9 Make running the tests a little easier on Windows
1.  Set the igncr option a little differently, this is the preferred
    way according to the latest Cygwin bash update announcement
    (See https://sourceware.org/ml/cygwin-announce/2014-10/msg00015.html, Sect 4a)
    The previous way didn't work for me.
2.  Ensure /usr/bin is on the path if running under Cygwin.
    I really don't want Cygwin on my normal paths, the build process
    adds if required, so this change makes the test scripts do the same.

Change-Id: I0f4da1fa87802bf0a4039bb5a91e577fae506d79
Reviewed-on: https://code.wireshark.org/review/6243
Tested-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-12 10:22:40 +00:00
Graham Bloice e7d0cdc061 Fix lua tests on Windows
Convert TEST_DIR path to a Windows path, this is used in all the lua tests.
Fix a typo

Change-Id: I38808822c998ed1df007732b3701b6b13d6c886b
Reviewed-on: https://code.wireshark.org/review/6235
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-02 16:49:40 +00:00
Evan Huus 887d198361 test: improve check for out-of-tree tests
Rather than running `cd` and letting it potentially fail, just use the `-d` flag
to test that `run` exists and is a directory. Avoids useless stderr output.

Change-Id: Iab8b63681db6256aa1a6fc389d2536acbd491aba
Reviewed-on: https://code.wireshark.org/review/6239
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-02 16:12:45 +00:00
Evan Huus 5cb96a0eb5 test: default WS_QT_BIN_PATH to WS_BIN_PATH
it used to be SOURCE_DIR, which is still the fallback for WS_BIN_PATH, but this
way if you specify a custom WS_BIN_PATH it gets picked up for both

Change-Id: If9198565fc7b7b3911550fd200adb0f918622540
Reviewed-on: https://code.wireshark.org/review/6238
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-01-02 16:08:20 +00:00
Joerg Mayer 27fa202b5e Make it easier to run tests out of tree.
Change-Id: I4ed10339d3c543d9d199e5262b6e7bb8247544ac
Reviewed-on: https://code.wireshark.org/review/5148
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-02 15:00:03 +00:00
Hadriel Kaplan 3cc6aee32a Lua: regex test suite fails with UTF-8 locale
Due to the change in change-id Ib43e16a9d98d08e5ddaff81fd3235f5b64d7b95b, the setlocale() call has been moved earlier in tshark's processing, such that Lua plugins load with the environment locale instead of C-locale. Since that matches Wireshark's behavior, it's good, but it causes the Lua regex test suite to fail. So the test suite needs to be fixed.

Bug: 10824
Change-Id: I3dcad15a9e247a1e42d2f708ccfb7272de2fe960
Reviewed-on: https://code.wireshark.org/review/6226
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2015-01-02 13:09:16 +00:00
Gerald Combs f485b28090 Test suite: Make sure we have a usable locale before we run iconv.
Change-Id: Ib1f3143dc48af4c556b9bcdfafbb477fd59b6359
Reviewed-on: https://code.wireshark.org/review/6181
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-31 17:13:06 +00:00
Hadriel Kaplan f7b6dcc58c Lua: allow a Dissector object to be passed in for register_heuristic
Bug: 10695
Change-Id: I81181b2d00fcb5f0c25ab89bbe4968897f47a3a6
Reviewed-on: https://code.wireshark.org/review/6131
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-31 16:01:51 +00:00
Gerald Combs dcbebe0eac Test suite: Start testing our output for valid UTF-8.
Feed the output of `tshark -G <glossary>` to `iconv -f UTF-8`. Adjust a
couple of the Bluetooth dissectors and X11 keysyms accordingly.

Change-Id: I5b04dc3fa4734c8f0a795daf44bd398fe5ebc1bd
Reviewed-on: https://code.wireshark.org/review/6146
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-30 21:20:28 +00:00
Hadriel Kaplan 2391a436e6 Bug 10233 - Wireshark crashes if Lua heuristic dissector returns true
Because call_heur_dissector_direct() didn't set the pinfo->heur_list_name
before calling the heuristic dissector, heur_dissect_lua() would invoke
report_failure().  Unfortunately, calling report_failure() within a dissector
can cause problems because GTK continues invoking timed callbacks while
it displays the modal dialog created by report_failure()... without yet
returning from report_failure().  In such a case, it's possible for
epan_dissect_run() to be called while still within the execution of a
previous call to epan_dissect_run(), which casues an assert since
epan_dissect_run() is not reentrant.

So this commit both fixes the call_heur_dissector_direct() bug as well
as avoids using report_failure() within heur_dissect_lua().  It also
upadtes the dissector.lua script used in the testsuite to match the one
pubshied on the wiki, since that script's heuristic dissector triggered
the bug.

Bug: 10233
Change-Id: If022604347745fadac01c02d370ca1a5d3f88b5b
Reviewed-on: https://code.wireshark.org/review/6040
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2014-12-25 15:13:56 +00:00
Alexis La Goutte 04a1f332b1 test suite: (Minor) fix some double space
Change-Id: I7fe7cd7ed471b8fcd2afd5fb4bbc180b580295b3
Reviewed-on: https://code.wireshark.org/review/6031
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-24 17:39:49 +00:00
Alexis La Goutte cd558218f7 test suite: fix indent (use tabs) and add modelines
Change-Id: I648d02d41f92c7fd176ce194eee20a2d19643fe0
Reviewed-on: https://code.wireshark.org/review/5985
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-23 07:27:48 +00:00
Michael Mann 6d207fe5f4 Remove private_data member from packet_info structure.
Dissectors should pass data directly to their subdissectors through the data parameter (of new-style dissectors). This avoids unintentional "trampling" from other dissectors trying to "share" private_data member.

Change-Id: I2efef5c8dfeef64588ba3ac6e695b469238c6468
Reviewed-on: https://code.wireshark.org/review/5487
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-01 14:05:44 +00:00
Gerald Combs c55d69780b Try to speed up ping-dependent capture tests.
Ping four times a second for ~60 seconds. Save the subprocess PID so that
we can kill it when we're done with each test instead of waiting for it
to finish.

Change-Id: I64f889c700e8a6fa1bc1c3916ef045341ef59cc6
Reviewed-on: https://code.wireshark.org/review/4557
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-08 18:54:13 +00:00
Gerald Combs bdfff4d3c7 Re-enable the Wireshark test suite.
Change-Id: Icfd9edb8c6ef7620878bc9d60c8dcc569ad2abad
Reviewed-on: https://code.wireshark.org/review/4434
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-03 00:02:56 +00:00
Gerald Combs ff7b51f920 Partially re-enable Wireshark tests.
Qt requires Xrender and XKEYBOARD. Unfortunately the Ubuntu and Solaris
buildbots run the test script under Xtightvnc, which provides neither of
those. Only enable the tests on Windows and OS X for now.

Change-Id: I84bc28f810782b862b4dca8fc8df088a4919066d
Reviewed-on: https://code.wireshark.org/review/4430
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-02 22:49:46 +00:00
Gerald Combs 67f1fa5e56 Temporarily disable the Qt tests added in g58cde5c.
Apparently what works for me doesn't work for the Buildbot users.

Change-Id: I7d3e4f2b89ae8ae3dadc8d92438c0e1923b97ace
Reviewed-on: https://code.wireshark.org/review/4416
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-02 02:20:07 +00:00
Gerald Combs 58cde5c74a Add tests for the Qt UI.
Make sure the Qt UI quits if WIRESHARK_QUIT_AFTER_CAPTURE is set. Make
sure Bourne shell scripts (*.sh) have UNIX/POSIX line endings. Reduce
some time values so that the tests run faster.

Change-Id: I81df7c6f72d7d807d1856863cbea1bb6326ca711
Reviewed-on: https://code.wireshark.org/review/4407
Tested-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-01 22:30:33 +00:00
Evan Huus 45fb37718e Fix lua bindings to handle timestamp precision changes
The recent wiretap changes broke the generation of init.lua among other things,
though it did coincidentally fix one of the "yuck" comments in the generator
regex.

(Note that this is entirely untested, because out-of-tree init.lua is and always
has been broken, but it should work)

Change-Id: Id0c27b31c596613997de4ba2f6088eb9d6c8fc53
Reviewed-on: https://code.wireshark.org/review/4361
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-29 02:35:29 +00:00
Alex Badea a1604bd5d6 test: add decryption test for isakmp with certificates
This was suggested in review 2297. Capture and key are from bug 7951.

Bug: 7951
Change-Id: I820c5e839b20ec464cc1be438633d5311f657fb2
Signed-off-by: Alex Badea <abadea@ixiacom.com>
Reviewed-on: https://code.wireshark.org/review/4143
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-24 22:06:31 +00:00
Gerald Combs b7fb1167e3 Qt → wireshark. GTK+ → wireshark-gtk.
Make sure the Qt UI is named "Wireshark" and its executable is named
"wireshark" or "wireshark.exe". Make sure the GTK+ UI is named
"Wireshark 1" or "Wireshark (GTK+)" depending on how much the target
audience is likely to care about UI toolkits. Make sure the GTK+
executable is named "wireshark-gtk" or "wireshark-gtk.exe".

It looks like moving to Qt 5.3 (g978faf3) broke the PortableApps
package. It's likely even more broken now.

Autotools out-of-tree builds also broke on Ubuntu 12.02 (automake
1.11.3) at some point. The first attempt to compile in ui/qt returns
"error: source_file.cpp: No such file or directory". The second attempt
works. Out-of-tree builds work fine on Ubuntu 14.04 (automake 1.14.1).

Tested:

- Nmake builds

- NSIS packaging

- CMake builds (Windows, OS X)

- Autotools build and distcheck

- RPM packaging

To do:

- Test Debian packaging

- Fix PortableApps

Change-Id: I66429870e05fd2d6fc901942477959ed6164fce2
Reviewed-on: https://code.wireshark.org/review/3919
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-02 15:39:17 +00:00
Evan Huus 5fda232659 make unit-test suite work out-of-tree
Change-Id: I638015a9b55712bb6843d6756c9c55915e142372
Reviewed-on: https://code.wireshark.org/review/2893
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-12 12:08:13 +00:00
Evan Huus a87e292272 Tighten the dump-glossary test.
1. The only indication we get of an out-of-order value string is a message on
 STDERR, so check that and fail the test if STDERR wasn't empty.

 2. This exposes an out-of-order value string in packet-stun.c; fix it.

 3. This triggered the pre-commit hook on packet-stun.c, which noticed an API
 error (ENC_ASCII -> ENC_ASCII|ENC_NA); fix that too.

Change-Id: I36f87a2a87b40537119562f22a7e3012716ff239
Lesson: automated testing/tooling is both wonderful and scary.
Reviewed-on: https://code.wireshark.org/review/2682
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-27 03:47:32 +00:00
Gerald Combs 81963e7f1a Decrease TRAFFIC_CAPTURE_DURATION from 60s to 15s.
Change-Id: Ie6d6ac0489f0fcb506360a3900d33c44cb3477e9
Reviewed-on: https://code.wireshark.org/review/2664
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-06-25 23:02:55 +00:00
Evan Huus fca7b3f4f8 Check for lua by grepping the output of tshark -v
Grepping config.h doesn't work for out-of-tree builds.

Change-Id: If3f551dffb04dd646f5adece57fac90dc48ff1c9
Reviewed-on: https://code.wireshark.org/review/2389
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-18 18:32:18 +00:00
Guy Harris 6db77b000f Allow wtap_read() and wtap_seek_read() to return records other than packets.
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be
REC_TYPE_PACKET, for a record containing a packet, or
REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific
data.

Modify code that reads packets to be able to handle non-packet records,
even if that just means ignoring them.

Rename some routines to indicate that they handle more than just
packets.

We don't yet have any libwiretap code that supplies records other than
REC_TYPE_PACKET or that supporting writing records other than
REC_TYPE_PACKET, or any code to support plugins for handling
REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug
8590.

Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813
Reviewed-on: https://code.wireshark.org/review/1773
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-24 18:31:25 +00:00
Evan Huus a1e6b10239 Fix lua directory tests.
The underlying directory iterator is not guaranteed to return directories in the
same order according to the glib documentation, so don't rely on the directory
order being the same when testing it.
https://developer.gnome.org/glib/2.37/glib-File-Utilities.html#g-dir-read-name

Bug:10009
Change-Id: I4b1078e1f3981921b1e83c4f77b4bc30a5d21b46
Reviewed-on: https://code.wireshark.org/review/1671
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-21 03:17:15 +00:00
Evan Huus 4272cb8786 Revert part of g757db64e484b009c3
It was intended to change the DTLS decryption test, but changed the SSL test
file instead, which led to the SSL test mysteriously failing. The SSL capture
really is http, so that's the right protocol, and the port is the standard 443,
not 4433 (which was perhaps a typo?).

Change-Id: I84448c2326d2a4301a4bba9607f8ba90a495531d
Reviewed-on: https://code.wireshark.org/review/1401
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-27 21:55:03 +00:00
Evan Huus c6d41f961b Have DTLS just dissect the test capture as data
Follow-up to g757db64e484b009c33b67b5fa38e109d7b8f5e78 which changed the filter
being tested but didn't change the target protocol, so the test was still
failing because it was still trying to use HTTP.

Change-Id: I6675cfad3bba63f7a536eb7ae82e4b25132d108e
Reviewed-on: https://code.wireshark.org/review/1375
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-26 21:45:48 +00:00
Michael Mann 757db64e48 Don't use HTTP filter for DTLS decryption test as it's not really HTTP traffic (and a more discerning HTTP dissector will cause this to fail)
Change-Id: I74ea78f541f87000d84c85794d04e9de46d477f2
Reviewed-on: https://code.wireshark.org/review/1333
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-25 04:20:27 +00:00
Hadriel Kaplan f52626cc83 Add tvb_get and proto_tree_add for string-encoded byte arrays
This commit adds tvb_get_string_bytes and proto_tree_add_bytes_item routines for
getting GByteArrays fields from the tvb when they are encoded in ASCII hex string form.

The proto_tree_add_bytes_item routine is also usable for normal
binary encoded byte arrays, and has the advantage of retrieving
the array values even if there's no proto tree.

It also exposes the routines to Lua, both so that a Lua script can take
advantage of this, but also so I can write a testsuite to test the functions.

Change-Id: I112a038653df6482a5d0ebe7c95708f207319e20
Reviewed-on: https://code.wireshark.org/review/1158
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-17 14:04:19 +00:00
Hadriel Kaplan dd002649c3 Add tvb_get and proto_tree_add for string-encoded timestamps
This commit adds tvb_get_string_time and proto_tree_add_time_item routines for
getting nstime fields from the tvb when they are encoded in ASCII string form.

The proto_tree_add_time_item routine is also usable for normal
big/little-endian encoded time_t, and has the advantage of retrieving
the value even if there's no proto tree.

It also exposes the routines to Lua, both so that a Lua script can take
advantage of this, but also so I can write a testsuite to test the functions.

Change-Id: I955da10f68f2680e3da3a5be5ad8fdce7ed6808c
Reviewed-on: https://code.wireshark.org/review/1084
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-14 11:47:39 +00:00
Pascal Quantin cc3c05ed5f Switch to Lua 5.2.3 built with MSVC2010 instead of the one built with MingW gcc 4.3
Fixes bug 9957

Change-Id: Ibe38ec25be5cfdad98c53c8257b0a858529897f6
Reviewed-on: https://code.wireshark.org/review/991
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-04-07 05:54:19 +00:00
Hadriel Kaplan 85aa07157a Get it compiling again: WindowsXP build failing
The WindowsXP build is failing due to a wslua testsuite failure, in the
file reader/writer tests. I've looked at it a bit and I don't know
why it's failing yet - I know why it says it's failing, but it doesn't
fail for me. And it was passing on WindowsXP until the change to Lua 5.2.3,
but I run 5.2.3 all the time and it passes for me, and there's nothing
special about the portion that's failing.

The only way to debug it is to run it on WindowsXP myself, but I need
a build to do that with, so I've commented out the failing test and
hopefull it will build now and I can grab the automated build to debug
the issue.

Change-Id: Ib75e8f75829e8f506823e648605ba16e21c7973a
Reviewed-on: https://code.wireshark.org/review/982
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-04-06 17:51:34 +00:00
Alexis La Goutte 757aa33220 Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\# \$Id\$/,+1 d') (start with dash)

Change-Id: Ia4b5a6c2302f6a531f6a86c1ec3a2f8205c8c2dd
Reviewed-on: https://code.wireshark.org/review/881
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-31 18:48:06 +00:00
Alexis La Goutte 94a791a76e Continue to remove $Id$ from top of file
(Using sed : sed -i '/^\$Id\$/,+1 d') (No space or star before $Id$)

Change-Id: I0801bd7cf234d32487008a8b6dcee64875b07688
Reviewed-on: https://code.wireshark.org/review/876
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-31 16:00:04 +00:00
Hadriel Kaplan 8c2bb80574 Add various functions for Lua directory handling and path info
This adds new functions to get plugins path info, find out if a directory
exists, make a new one, remove one, etc. It also creates a file environment
for user-supplied Lua scripts, to prevent global variable contamination as
well as supply the script-specific file name.  Some other minor cleanup was
done as I found them.

A new testsuite was added to test the existing and new directory functions.

Change-Id: I19bd587b5e8a73d89b8521af73670e023314fb33
Reviewed-on: https://code.wireshark.org/review/832
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26 07:37:34 +00:00
Hadriel Kaplan da1af6e549 Add filterable expert info for Lua
This adds the ability for a Lua script to register expert info fields,
similar to C-code dissectors. This change also removes the need for
the expert_add_info_format_internal() function. Existing Lua scripts
do not have to change, because the existing expert info function
uses the internal "_ws.lua" protocol instead of nothing; but using
the new functionality provides more benefits since it correctly
registers the expert info fields to the dissector's protocol.

The test suite was amended to generate both old and new forms.

Change-Id: Ib5ae74e927cfa81312baf7b04ff4104b0b4f936e
Reviewed-on: https://code.wireshark.org/review/830
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-26 05:20:17 +00:00
Hadriel Kaplan 21a61a8cb1 Add Lua Struct.values() function, and prevent coercion in all Struct functions
This adds a Struct.values() function to get the number of values
needed/returned with Struct.pack/unpack. It also changes the existing
Struct functions such that they don't coerce a non-string argument
into a string. (not preventing it confused a user on ask.wireshark.org)

Change-Id: I93d5846105e55b67680e1c276a7286535c77b039
Reviewed-on: https://code.wireshark.org/review/790
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-23 07:05:30 +00:00
Hadriel Kaplan 69af33f0f3 Fix spelling mistakes in Lua test scripts
Change-Id: I8671eb3d3b46ec5c723a6545451ecbb33a10c807
Reviewed-on: https://code.wireshark.org/review/788
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-22 17:42:16 +00:00
Hadriel Kaplan 66719c9b6a Add way for Lua file reader to save state per file read/write ops
Lua can create a file reader/writer, to open new capture file
formats or write to new ones. To save local state, it can save
things in Lua itself; but since there can be multiple open files
at the same time (for example during a reload), the Lua script
won't know for which file and state its read/write functions are
being invoked for. To remedy this, and also provide a convenient
way to store such state, this commit adds the ability for a Lua
script to store a Lua table in the wtap/wtap_dumper's priv
data member, just like C-code-based reader/writers do.

Change-Id: Ifc9e0d5f0379accee56f2a04b6080238670fec52
Reviewed-on: https://code.wireshark.org/review/766
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-22 08:06:47 +00:00
Hadriel Kaplan c8a98f37ec Fix lua file testsuite not working and weak heuristic readers not being registered
The testsuite for Lua file reader/writer uses the acme_file.lua script to
generate a pcapng file from an Acme sipmsg.log file. It then compares the
tshark verbose output of this new pcapng file to a sip.pcapng file in
the test/captures directory that was previously made. Unfortunately, the
acme_file.lua script generates a timestamp based on local system timezone,
rather than UTC, so the testsuite fails if not run in the EST timezone where
the sip.pcapng file was originally made. This has now been fixed.

Also, trying to register new weak heuristic readers fails because the GArray
is terminated with a NULL-based row without Glib knowing about that. So this
commit changes it to let Glib handle the NULL-terminated row, so that appending
takes it into account automatically.

Change-Id: I037ce1cfbda03585b3a1e159df78ff8ebb41fc32
Reviewed-on: https://code.wireshark.org/review/741
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-03-19 17:02:40 +00:00
Michael Mann 04d9501306 Add capture file reader/writer support for Lua so scripts can implement new capture file formats.
This enables a Lua script to implement a brand new capture file format reader/writer, so that for example one could write a script to read from vendor-specific "logs" of packets, and show them as normal packets in wireshark.

Change-Id: Id394edfffa94529f39789844c382b7ab6cc2d814
Reviewed-on: https://code.wireshark.org/review/431
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-19 05:04:54 +00:00
Hadriel Kaplan 04c39bb097 Add Lua heuristic dissector support
This adds the ability for Lua scripts to register heuristic dissectors
for any protocol that has registered a heuristic dissector list, such
as UDP, TCP, and ~50 others. The Lua function can also establish a
conversation tied to its Proto dissector, to avoid having to check the
heuristics for the same flow. The example dissector in the testsuite
has also been enhanced to include a heuristic dissector, to verify
the functionality and provide an example implementation.

Change-Id: Ie232602779f43d3418fe8db09c61d5fc0b59597a
Reviewed-on: https://code.wireshark.org/review/576
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-14 07:29:15 +00:00
Martin Kaiser ba32257cb6 add a test for SSL/TLS decryption using the master secret
rename the existing SSL test to clarify that it uses the server's
private key for decryption

Change-Id: I13598fc4cf724b144a8f27bfa7a3316acfc78728
Reviewed-on: https://code.wireshark.org/review/640
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-03-13 21:42:50 +00:00
Hadriel Kaplan 9961ee369c Fix Bug 9870 'Lua: trying to call/get an invalid name results in a get-loop error'
Due to the change I made previously for how methods are accessed, if you try
to access one that doesn't exist (for example mistype it or whatever), you get
an internal Lua error about a loop in table get, as opposed to the right error
message about the field not existing.

That's because I had set the class' metatable __index metamethod to point to
the class table, which of course has the metatable with the __index
metamethod, causing a lookup loop.  Blech.

Change-Id: I20d3717feadd45f652c2640e1671846184e7082d
Reviewed-on: https://code.wireshark.org/review/593
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-11 05:30:58 +00:00
Hadriel Kaplan ea46cdc474 Add GLib's regex library into Lua
While Lua's built-in pattern support is ok for simple things, many people end
up wanting a real regex engine. Since Wireshark already includes the GLib
Regex library (a wrapper for PCRE), it makes sense to expose that library to
Lua scripts. This has been done using Lrexlib, one of the most popular regex
bindings for Lua. Lrexlib didn't support binding GLib's Regex in particular -
it does for PCRE but GLib is a different API - so I've done that. A fairly
thorough testsuite came along with that, which has been incorporated into the
wireshark wslua testuites as well in this commit.

Change-Id: I05811d1edf7af8d7c9f4f081de6850f31c0717c7
Reviewed-on: https://code.wireshark.org/review/332
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-10 07:11:12 +00:00
Evan Huus be0b4b9dc8 Add test to dump glossaries.
All it checks is that they don't crash, but this is enough to catch malformed
extended value strings and other oddities.

Change-Id: If853e8e2b19517a784daa4bbb8e41eddc7c7ddd9
Reviewed-on: https://code.wireshark.org/review/520
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-05 19:55:10 +00:00
Hadriel Kaplan bd36fe1bcb Fix bug 6357: Lua all_field_infos() broken within tap/listener
The current API for Lua provides a global function
"all_field_infos()" which returns all the populated field_info nodes
in the current proto_tree.

By default all_field_infos() "works", in the literal sense: it returns
exactly the fields the previous dissectors of the packet have
populated at that instant of time.  But of course dissectors don't
populate all the applicable fields most of the time, because of the
TRY_TO_FAKE_THIS_ITEM optimization where they don't fill in things
that aren't needed at the time by a display, color, or tap's dfilter.

So this commit offers a way to force the dissectors to populate
all the applicable field_infos in the tree, by setting the proto_tree
to be visible.  Obviously that is going to impact performance, since
it basically bypasses the TRY_TO_FAKE_THIS_ITEM optimization; so the
patch only does this if the Lua script author told it to explicitly,
by adding an argument to Listener.new() and register_postdissector().

Change-Id: I11d3559fbe8c14fbadf1b51415a3701dc1200b7b
Reviewed-on: https://code.wireshark.org/review/286
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25 21:06:50 +00:00
Hadriel Kaplan 860747e1e7 Adds some Lua helper functions: some commonly used functions, and to help troubleshooting Lua scripts
There are some common things people need to do, such as convert to/from hex or get
the raw binary string in a ByteArray/Tvb/TvbRange. These have been added, as well
as some tests for them in the testsuites. Also, functions have been added to allow
a script to get all the available tap types and filter fields, since they are
not exactly what one can see in the Wireshark gui.

Change-Id: I92e5e4eae713bb90d79b0c024eaa4e55b99cc96b
Reviewed-on: https://code.wireshark.org/review/249
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25 21:06:21 +00:00
Pascal Quantin 58db464aff Remove executable bit from a few files
Change-Id: Ib9be221e3d325379c8b665ab73d976254bb23bb6
Reviewed-on: https://code.wireshark.org/review/342
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-02-24 22:34:26 +00:00
Hadriel Kaplan 7f074364b6 Fix bug 9790: Lua: wslua allows duplicate field registration
As discussed in bug 3513 and 9709, one can register more than one new ProtoFields for
the same field name. Of course C-code can do that too, and does a LOT apparently, but
if they're not similar ftypes then things can get scrweed up in display filters.

So this change prevents duplicate field registration of dissimilar ftypes. The
similarity is based on the discussion on the mailing list, and the listing in
README.developer has been updated to refelect that as well.

Also, this change adds a testscript for Proto/ProtoFields.

Change-Id: I43bd323f785245941a21289647332a19adec2a9d
Reviewed-on: https://code.wireshark.org/review/285
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21 20:57:43 +00:00
Hadriel Kaplan 696353c129 Add test suite for verifying Lua global variables/tables of previous releases have not disappeared.
Several bugs have been introduced due to changing of perl scripts or #define names, such
that things exported into Lua have dissapeared or changed unintentionally. This commit
adds a test suite which compares the Lua global table with the ones from previous
releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but
old ones cannot go away. The added script to verify these things, called 'verify_globals.lua',
also has the ability to display what's new - i.e., what was not in the olrder releases.

Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST
due to a change in the make-init-lua.pl perl script in this 1.11 release.

Change-Id: Iba143d1a436e706970635a5f8cc2b317955392bf
Reviewed-on: https://code.wireshark.org/review/284
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-21 16:28:07 +00:00
Evan Huus 3f2be6dbe8 Revert "Add test suite for verifying Lua global variables/tables of previous releases have not disappeared."
This reverts commit 5b7f00178f.

Change-Id: Idf09d25270847970713b67d02bcd7cbc411a4e9c
Reviewed-on: https://code.wireshark.org/review/280
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21 02:16:51 +00:00
Hadriel Kaplan 5b7f00178f Add test suite for verifying Lua global variables/tables of previous releases have not disappeared.
Several bugs have been introduced due to changing of perl scripts or #define names, such
that things exported into Lua have dissapeared or changed unintentionally. This commit
adds a test suite which compares the Lua global table with the ones from previous
releases (1.8 and 1.10), to verify nothing has gone missing. New items can be added, but
old ones cannot go away. The added script to verify these things, called 'verify_globals.lua',
also has the ability to display what's new - i.e., what was not in the olrder releases.

Lastly, this commit also fixes a bug: MENU_STAT_ENDPOINT became MENU_STAT_ENDPOINT_LIST
due to a change in the make-init-lua.pl perl script in this 1.11 release.

Change-Id: Ic46172904256dc535b0fe4543237c07dddb3b9b5
Reviewed-on: https://code.wireshark.org/review/242
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-21 02:06:18 +00:00
Evan Huus b7985c57a4 Fix mode for lua test suite
Change-Id: If516472ca9c4a0ae84da22a0ecfc9449f0495cbb
Reviewed-on: https://code.wireshark.org/review/273
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-20 22:16:47 +00:00
Hadriel Kaplan fe769e7350 Add 4 more test scripts for Lua, and its own testsuite menu
This adds test scripts for verifying Pinfo, Address, Field, FieldInfo, NSTime
and Listener classes/functions.  It also moves Lua test scripts out of
unittests and into its own new testsuite.

Change-Id: I65c238fd459efb96db3f8f9145842cd038dea7c7
Reviewed-on: https://code.wireshark.org/review/270
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-20 18:42:13 +00:00
Hadriel Kaplan c4f1777a97 Adds support for Lua struct library so one can pack/unpack binary structures
This is based on Roberto Ierusalimschy's struct library, along with additional
options based on Flemming Madsen's patch to the lua-users mailing list, and
some changes I made to support 64-bit integer packing/unpacking.  Details
are in the top comments for wslua_struct.c.  This also includes a test script.

Change-Id: Ifcd0116ba013d5c760927721c8d6e9f28965534b
Reviewed-on: https://code.wireshark.org/review/98
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-14 10:11:50 +00:00
Hadriel Kaplan 58fe488822 Lua: add ability for scripts loaded from command-line to be passed arguments
This change adds the ability to pass on to lua scripts loaded from the
command-line (tshark or wireshark) additional arguments supplied by the
command-line.  This will help us in our testsuites, but also might be
useful for user-created scripts.  The additional arguments are passed in
using the '-X' eXtension switch.

Change-Id: Ib94cdf1ffd194ca84692fee7816665e4ff95efbd
Reviewed-on: https://code.wireshark.org/review/156
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-13 22:32:58 +00:00
Hadriel Kaplan f5a1786ea1 Add test suite for Lua dissector-related functions
This isn't super-fancy, but it runs a simple protocol dissector and verifies the tshark output
matches what it expects.  Things like Proto, ProtoField, Field, Tvb, TvbRange, etc., are used
in an example dissector script - it dissects DNS... partially.  Enough to make sure things
aren't fundamentally broken.  This provides something to add on top of later as well.

Change-Id: Icf3c8e9534944bcf4c4f6150f02a9a43f999cd75
Reviewed-on: https://code.wireshark.org/review/126
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-09 19:55:43 +00:00
Hadriel Kaplan 4e8832bb0a Fix bug 9736 'Lua: new Int64/UInt64 functions don't prevent division by zero'
OK, in all fairness this does a bit more than just fix that bug. It also
adds a 'Int64()' and 'UInt64()' __call metamethods. I generally dislike
using __call metamethods, because they're often unintuitive (for example
the wireshark Field and FielInfo use this in a bizarre fashion).  But this
happens to be a perfect use for it, and very natural, imho.  Another change
is to make the metatables of classes visible to scripts. There was never
really a good reason not to make them visible, and they have to be visible
to do things like use __call on a plain table... not to mention I need them
to be visible to run test scripts verifying evrything is kosher.

I also updated the test suite to test for the div/mod by zero.

Change-Id: Ia4c594c8f59d4e799090716bd032ba2815df032f
Reviewed-on: https://code.wireshark.org/review/149
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-09 16:04:36 +00:00
Evan Huus 1cd7828527 Various fixes to the Lua int64 code
- add casts to pacify certain buildbots
- skip test if lua isn't available

Change-Id: I614c05dca40cb848c87b361e4b3d3c4e94aafb9e
Reviewed-on: https://code.wireshark.org/review/97
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-02-04 00:59:07 +00:00
Hadriel Kaplan 2e7f771a18 Adds support for Lua Int64 and UInt64 operators, functions, and general
usefulness, working around bug #9162 until Lua 5.3 is released.

The existing Int64 and UInt64 classes provide virtually no
usefullness, other than for creating a string of their value.  While
one could then write Lua code to convert the string to Lua numbers and
such, ultimately Lua has no native 64-bit integer support, making such
a task difficult to handle in Lua.  This change adds a host of
functions and operators to the existing Int64 (gint64) and UInt64
(guint64) classes, to enable true 64-bit integer support on par with
native Lua numbers.

A test script is also provided, which tests the functions/operators.

Change-Id: I4c5f8f5219b9a88198902283bd32ddf24c346bbe
Reviewed-on: https://code.wireshark.org/review/83
Tested-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-04 00:37:46 +00:00
Jakub Zawadzki 2abbb53d67 Remove svn:executable attribute.
svn path=/trunk/; revision=54637
2014-01-07 22:55:03 +00:00
Jakub Zawadzki 1482ce4997 Revert part of r53874
svn path=/trunk/; revision=53944
2013-12-11 20:52:05 +00:00
Jakub Zawadzki 2b0797a361 It's DTLS failing not DVB_CI.
svn path=/trunk/; revision=53874
2013-12-08 22:16:22 +00:00
Jakub Zawadzki 23c9eb270f Try to check why test.sh fails.
svn path=/trunk/; revision=53871
2013-12-08 21:29:30 +00:00
Martin Kaiser f38af18c2c add a decryption test for DVB-CI to the testsuite
svn path=/trunk/; revision=53830
2013-12-07 17:56:39 +00:00
Michael Mann 0e669d534d README update. Bug 9174 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174)
From Peter Wu

svn path=/trunk/; revision=53671
2013-11-30 01:50:12 +00:00
Michael Mann 3635bea0a4 Add OID unit tests. Bug 9294 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9294)
From Ed Beroset

svn path=/trunk/; revision=52692
2013-10-19 18:52:13 +00:00
Evan Huus 4860e101c8 Slight simplification, inline a function only ever called once.
svn path=/trunk/; revision=52470
2013-10-09 17:24:16 +00:00
Evan Huus 7058b87833 From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9238
Add test for ANSI C12.22 decryption.

svn path=/trunk/; revision=52469
2013-10-09 17:21:30 +00:00
Evan Huus 2553de177d From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9245
Fix test suite so that it doesn't attempt to use color if ncurses is not
installed.  This came up when I attempted to use the test suite under Windows
with cygwin installed but not ncurses.  The result is not entirely broken but
the error messages saying that "tput is not a valid command" make the menus and
results difficult to read.

svn path=/trunk/; revision=52449
2013-10-08 15:09:59 +00:00
Evan Huus 0777f96c63 Another path and ordering tweak.
svn path=/trunk/; revision=52430
2013-10-06 23:39:16 +00:00
Evan Huus 087c885c66 More tweaking of test suite path variables, trying to make everything play
nicely on Windows and Linux both.

svn path=/trunk/; revision=52428
2013-10-06 23:29:59 +00:00
Evan Huus 13ae682c75 Fix nameres test suite cleanup after recent changes.
svn path=/trunk/; revision=52417
2013-10-06 20:30:12 +00:00
Evan Huus 62c230c7b1 From Peter Wu via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174
Reorg more of the test variables, still separating source and test directories.
More minor fixes from me.

svn path=/trunk/; revision=52412
2013-10-06 18:57:01 +00:00
Evan Huus 81a0f156cd Try to fix unittest path magic on windows.
svn path=/trunk/; revision=52400
2013-10-06 14:15:38 +00:00
Evan Huus e0cc11c92b From Peter Wu via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9174
Support running most tests out-of-tree. Use case is to have a source tree and
use a semi-unprivileged user to perform tests (to rule out interference).

From me:
- fix unit-test suite, it has to build the binaries it runs so it must
  more-or-less ignore the out-of-tree stuff
- fix name-res suite, just missing a path qualifier


svn path=/trunk/; revision=52397
2013-10-06 12:44:10 +00:00
Guy Harris 800b45f0a9 From Peter Wu: on systems other than Windows, skip the GUI tests if the
DISPLAY environment variable isn't set.

From me: note that this won't be the right thing to do on OS X if we
switch to a toolkit that doesn't use X11, and that this may or may not
be the right thing to do with toolkits using Wayland or Mir directly.

svn path=/trunk/; revision=52182
2013-09-22 21:51:05 +00:00
Evan Huus c660aab935 Update the test suite for r51556. Use -Y in one place instead of -R where only
filtering is important. Use -2 and -R together in one place where the counting
functionality is important.

svn path=/trunk/; revision=51558
2013-08-28 02:30:50 +00:00
Gerald Combs fe0b28463f Assume we always have GNU diff and that we can use --strip-trailing-cr.
svn path=/trunk/; revision=51496
2013-08-23 21:17:56 +00:00
Gerald Combs a8c728533d Add a test for rawshark.
svn path=/trunk/; revision=51494
2013-08-23 18:54:22 +00:00
Gerald Combs d5e30ea820 Fix the name resolution tests so that they run on Windows. Enable them
by default. Remove some unused code.

svn path=/trunk/; revision=49661
2013-05-31 22:32:14 +00:00
Gerald Combs bfe9967fc8 nameres.hosts_file_handling shouldn't affect loading the profile "hosts"
file. That should be loaded no matter what if we have name resolution
enabled.

Add a name resolution test suite. Currently disabled until I can test it
on Windows.

svn path=/trunk/; revision=49657
2013-05-31 21:40:26 +00:00
Evan Huus 0a396007fe Use -Y instead of -R to filter tshark in decryption tests. We're not doing
2-pass analysis so -Y makes more sense and doesn't print deprecation warnings.

svn path=/trunk/; revision=48808
2013-04-10 14:27:24 +00:00
Evan Huus 51a1e7e91e Run the wmem unit tests with --verbose (provided by glib) so that if
one of the random bits fails we get the seed to reproduce with.

svn path=/trunk/; revision=48576
2013-03-27 02:35:32 +00:00
Evan Huus 4ba4e1df70 Add wmem unit test binary (still empty) to nmake build and to
the unit test part of the test suite. Once I know it's building and
running properly on the buildbots then I'll actually start writing tests.

svn path=/trunk/; revision=48517
2013-03-23 23:51:07 +00:00
Gerald Combs 6de14cd99b Disable software updates in a blind attempt to fix the recent test
failures.

svn path=/trunk/; revision=48391
2013-03-18 15:39:12 +00:00
Gerald Combs 87faeaead3 Minor updates.
svn path=/trunk/; revision=48268
2013-03-12 20:23:23 +00:00
Chris Maynard ce6f1d2f9c Whitespace changes: Convert spaces to tabs. Add modelines.
svn path=/trunk/; revision=47975
2013-03-01 16:13:44 +00:00
Chris Maynard 53893a8a75 Convert spaces to tabs in capture_step_snapshot().
(Maybe this will make the XP buildbot happy so test.sh succeeds again?)

svn path=/trunk/; revision=47969
2013-03-01 06:20:41 +00:00
Jeff Morriss f0b9d97f18 tshark now accepts -Q.
svn path=/trunk/; revision=46633
2012-12-20 14:36:06 +00:00
Jeff Morriss 349e61ce9e tshark now accepts -g.
svn path=/trunk/; revision=46519
2012-12-12 14:11:53 +00:00
Guy Harris f3792fdf6b Make the error message for "we didn't get the error message we expected"
clearer - it's not as if we didn't expect to get an error message, we
just didn't expect to get *that particular* error message.

svn path=/trunk/; revision=46118
2012-11-21 19:04:21 +00:00