aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2019-04-03ieee80211: Fix WPA1 decryptionMikael Kanstrup2-0/+11
PTK key derivation algorithm for WPA1 uses SHA1 not MD5. MD5 is used for MIC only. To avoid regression also add a decrypt test for WPA1 with GTK rekeying. Change-Id: Iabcf40c2f74d5dbc1d72cba0718c77020d97f61f Fixes: v3.1.0rc0-342-g9cf77ec5e1 ("ieee80211: Support decrypting WPA3-Personal / SAE captures") Reviewed-on: https://code.wireshark.org/review/32691 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2019-03-26ieee80211: Support decrypting OWE capturesMikael Kanstrup3-0/+12
Add support for decryping OWE (Opportunistic Wireless Encryption) captures. Ping-Bug: 15621 Change-Id: I223fd0cd96260408bce2b5d7661f216c351da8a8 Reviewed-on: https://code.wireshark.org/review/32524 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-23Clean up IPMB/I2C link-layer header types.Guy Harris1-2/+2
209 is LINKTYPE_IPMB_LINUX; add _LINUX/_linux to the WTAP_ENCAP_ name and function/structure names, to clarify that it's not I2C in general, it's I2C with a particular pseudo-header. 199 is now LINKTYPE_IPMB_KONTRON, not LINKTYPE_IPMB, as it doesn't have raw I2C packets, it has I2C packets with a pseudo-header. Change the WTAP_ENCAP_ name, and add a dissector for it. Change-Id: Ie097f4317b03d2b2adfd9b81a4b11caf6268399e Reviewed-on: https://code.wireshark.org/review/32539 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-21ieee80211: Support decrypting WPA3-Personal / SAE capturesMikael Kanstrup3-0/+11
Add support for decrypting IEEE 802.11 WPA3-Personal / SAE traffic. SAE uses AES encryption but a different key derivation function (KDF) making Wireshark fail to decrypt such captures. Also both KDF and decryption method is determined based only on EAPOL key description version. This is not enough to figure out that SAE is being used. Implement the alternative KDF needed to derive valid PTK. Also implement a function to parse pairwise + group cipher suites and auth key management type from RSNE tag. Using this new function together with a number of new cipher and AKM lookup functions correct KDF for SAE can be selected. Bug: 15621 Change-Id: I8f6c917af1c9642c276a244943dd35f850ee3757 Reviewed-on: https://code.wireshark.org/review/32485 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-02-05Accept protocol aliases in Decode As (-d tcp.port==4433,ssl)Peter Wu1-0/+2
Change-Id: Idb2e4f9964cf0b5c1237a0d4b5e0954adfd5e6b6 Reviewed-on: https://code.wireshark.org/review/31895 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-02-05editcap: warn when --inject-secrets is given a RSA private keyPeter Wu1-0/+20
While the documentation of "editcap --inject-secrets" mentions support for key log files only, people might misinterpret that and assume support for RSA private keys. This is explicitly not supported due to the sensitivity of these files. In order to be helpful, print a warning. Change-Id: Ia7b464c17f1dfb550729dd35775290ed28e14510 Reviewed-on: https://code.wireshark.org/review/31893 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-28tests: Skip Lua related tests when Lua is not presentVasil Velichkov2-2/+4
Change-Id: I46ea83c0295d53f3b0b1d7f372c4fef2fb292e6c Reviewed-on: https://code.wireshark.org/review/31785 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-28dfilter: fix memory leaks on dfilter compile errors involving a setPeter Wu1-0/+10
If a display filter contains a set for the set membership operator and an error occurs, then gen_relation_in() (called via dfw_gencode() will not take ownership of the set and a memory leak occurs. Fix this by implementing a free callback for STTYPE_SET nodes which frees unclaimed data. Add tests to verify the effectiveness, ASAN no longer complains after this fix. Bug: 15442 Change-Id: If37cf047660464b2d0304748034d0bc22111e5d6 Reviewed-on: https://code.wireshark.org/review/31758 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-27TCP: pass data after a ZeroWindowProbe to subdissectorsPeter Wu2-0/+25
If the single byte within a ZeroWindowProbe triggers reassembly within a subdissector, a new MSP will be created with just a single byte. Be sure not to mark subsequent segments that contain the full segment data as retransmission as this prevents the subdissector from seeing the data. Bug: 15427 Change-Id: I36ae2622689c6606c99cdff70b6beba4b9d25ca7 Reviewed-on: https://code.wireshark.org/review/31732 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Jasper Bongertz <jasper@packet-foo.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-25test/suite_decryption.py: add smb2 decryption testsAurelien Aptel3-0/+52
add 3 tests and 2 sample captures to check smb2 decryption with: - bad key (should fail gracefuly) - smb3.0 AES-128-CCM - smb3.1.1 AES-128-CCM Change-Id: I099f5f00f83fd39ac6de9ce9ce374624297aef61 Reviewed-on: https://code.wireshark.org/review/31728 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-25tcp: fix reporting of "Reassembled in" for OoO initial segmentPeter Wu2-0/+34
When the initial segment is OoO, it was recognized as retransmitted. Fix this by remembering which frame actually contains the initial segment. Bug: 15420 Change-Id: If63e2ff581775ff9d396a612839f1bfab30f111f Reviewed-on: https://code.wireshark.org/review/31720 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-24tshark: fix crash with -Tjson and -e fieldPeter Wu1-14/+46
Fix the assertion to check for the actual requirements. Add tests for -T combined with -e. Bug: 15444 Change-Id: I83e7663572db0c60194f6d6128b9e1ae7396b3f6 Fixes: v2.9.1rc0-226-g30c90fa745 ("epan: use json_dumper for json outputs.") Reviewed-on: https://code.wireshark.org/review/31724 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-24test/dfilter: be explicit with the expected error messagePeter Wu5-20/+43
Instead of just reporting a mismatching error code, include the program output. This should help tracking down unexpected errors. While at it, check the expected error message too. Change-Id: Ib8fe51cc06b795bb54bfe1e6eaa828c6ba1128ef Reviewed-on: https://code.wireshark.org/review/31714 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-24ftype-time: parse the month independent of the localePeter Wu1-0/+18
Do not rely on strptime("%b") to parse the month, it does not correctly recognize English month abbreviations on non-English systems. While at it, do not try to parse milliseconds if seconds are missing. Change-Id: Ia049bf362195eef1eba2f04ff7217049fa6a7d9d Reviewed-on: https://code.wireshark.org/review/31707 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde <j@v6e.pt> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-24test,travis: dump a screenshot for hanging GUI testsPeter Wu3-8/+78
For some reason the wireshark GUI tests hang on the Travis OS X builds, but I could not reproduce it locally. It turns out than an error dialog was present, but I could not know that without the screenshot. Change-Id: Idf897d33b4fddf3c19c69ebcea60b629f1ca9368 Reviewed-on: https://code.wireshark.org/review/31682 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-24Test: enable capture tests by default using the Loopback interfacePeter Wu5-75/+62
Avoid pinging www.wireshark.org, this removes an external dependency. Instead send small UDP datagrams to UDP port 9 (discard) every 50ms. Enable this for all platforms (including macOS and Linux) by default. On Windows the tests requires Npcap and will be skipped with WinPcap. Remove the --capture-interface option since it is no longer needed. Copy WSDG Wireshark Tests Quick Start to README.test and add a link. Change-Id: Id4105a6b1e95407ebf69b871c785c68f9ae26368 Reviewed-on: https://code.wireshark.org/review/31677 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-22test: enable GUI tests on Linux, headlessPeter Wu1-3/+15
This will enable four tests in case_wireshark_capture on Linux, two of them require --capture-interface to be specified. To enable headless mode, QT_QPA_PLATFORM=minimal is set. Unfortunately this option causes a null pointer dereference crash on macOS and it also fails on Windows (cause not investigated). So limit it to Linux for now. Change-Id: Id05364571b2c9da38434e611d92642a1177700df Reviewed-on: https://code.wireshark.org/review/31664 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-21test: fail tests when programs are missingPeter Wu3-5/+17
Building only a subset of programs is not a very common situation, it is more likely that some feature was accidentally disabled. For that reason, fail tests by default unless a program is explicitly permitted to be missing. The '-v' test is now dropped from the Travis tests, the sole reason of adding it was to see which tests got (accidentally) skipped. Change-Id: I725f4508541d8ed980e17d69fb7aee1ad2875d73 Reviewed-on: https://code.wireshark.org/review/31660 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-20json_dumper: increase JSON_DUMPER_MAX_DEPTH to 1100.Dario Lombardo1-0/+10
The new value has been chosen to make room for sharkd packet output as: proto.c:MAX_TREE_LEVELS * 2 + 10% of additional sharkd overhead. A new regression test for sharkd has been added that requires more than 15 levels. Change-Id: Ie54955c79c50c60b95c99b1a3c472888fc4842ac Reviewed-on: https://code.wireshark.org/review/31624 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-17DTLS: add DSB support, use the key log file from the TLS dissectorPeter Wu2-0/+10
The DTLS and TLS dissectors already share code for parsing the key log file contents but the actual key material was stored separately. As implementations (like GnuTLS) write the TLS and DTLS secrets to the same file (specified by the SSLKEYLOGFILE environment variable), it seems reasonable to combine them. This also enables use of the pcapng Decryption Secrets Block for decryption of DTLS traces. The dtls.keylog_file preference has become obsolete and can no longer be used (this was not tested anyway). A new test was added based on dtls12-aes128ccm8.pcap, the master secret was extracted using the tls.debug_file preference. Bug: 15252 Change-Id: Idfd52c251da966fe111dea37bc3fb143d968f744 Reviewed-on: https://code.wireshark.org/review/31577 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-14dfilter: add string() function.Dario Lombardo1-0/+39
This function can convert non-string fields into strings. This allows the user to apply string functions (like contains and matches) to non-string fields. Examples: string(frame.number) matches "[13579]$" => for odd frames string(eth.dst) matches "aa\.bb\.cc\.dd\.ee\..." => to match a group of stations string(snmp.name) matches "^1.2.3.4" => for all OIDs under a specific node Change-Id: I18173f50ba5314ecdcd1e4b66c7e8ba5b44257ee Reviewed-on: https://code.wireshark.org/review/31427 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-11Unit tests for ASTERIX I048Atli Guðmundsson1-0/+1707
Change-Id: I0138681650dcabb01e08f3d25817b5fdd30f45e8 Reviewed-on: https://code.wireshark.org/review/31380 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-01-07sharkd: use json_dumper for output.Dario Lombardo1-4/+1
Change-Id: I457613ea154a86098f536b57844ad6606c595a46 Reviewed-on: https://code.wireshark.org/review/31035 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com>
2019-01-06Unit tests for ASTERIX I034Atli Guðmundsson1-0/+684
Change-Id: I7a063fdbc08a79c0358857d1e38ded41ae122b23 Reviewed-on: https://code.wireshark.org/review/31399 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-05test: allow running pytest without specifying the tests directoryPeter Wu2-5/+7
This allows `pytest` to be executed from the top-level source or build directory (or any other directory below). Change-Id: Ib7af2ea2aaf01319d6839d2dc67228fbb5a7bc34 Reviewed-on: https://code.wireshark.org/review/31370 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-04test: assume binaries in $PWD\run\RelWithDebInfo by defaultPeter Wu1-1/+4
Avoid the need to set `pytest --program-path` in the common case. Change-Id: I3b237e47eee741decb62a74b733110040aa26673 Reviewed-on: https://code.wireshark.org/review/31348 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-04test/dissectorstest: assert that text2pcap and tshark runsPeter Wu1-2/+2
Fail early if these commands fail. Change-Id: I6ba6cfa4b0b68c7282b79204b4f2bfedfefa4326 Reviewed-on: https://code.wireshark.org/review/31352 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-04test: split SubprocessTestCase.run into setUp/tearDownPeter Wu1-38/+31
The run method is not invoked when running in debug mode (for example, with `pytest --pdb`) and would result in spurious errors due to "log_fd" being None. Split the method to resolve this incompatibility. Note that with `pytest --pdb`, the tearDown method is not called when exceptions occur, see https://docs.pytest.org/en/latest/unittest.html Change-Id: I4b66c03d5b050b53311ec64021fe17dc91bb48dd Reviewed-on: https://code.wireshark.org/review/31339 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-01-03test: print command output for dfiltertest failuresPeter Wu1-1/+2
The buildbot detects random errors on Windows. Log some more details in order to understand the problem better. Change-Id: I903457894985273a63b8907b6784a2897cd93d93 Reviewed-on: https://code.wireshark.org/review/31340 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-29Add support for RSA decryption using PKCS #11 tokensPeter Wu3-0/+142
Add support for loading RSA private key files from PKCS #11 tokens, identified by PKCS #11 URIs. Add a new 'pkcs11_libs' UAT which can dynamically load PKCS #11 provider libraries that are not found by p11-kit. The configuration GUI will need additional code to discover available PKCS #11 tokens and will be added later. This feature requires GnuTLS 3.4 with PKCS #11 support, so Windows, macOS via Homebrew, Ubuntu 16.04, Debian Stretch. Not supported: RHEL7. Currently macOS via official packages disables PKCS #11 support, so that will also not work. Change-Id: I20646bfd69c6bd13c8c2d27cb65c164a4b0b7a66 Reviewed-on: https://code.wireshark.org/review/30855 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-29test: add tests for Unicode paths in Lua and tshark -G foldersPeter Wu4-1/+119
Check for potential Unicode-related problems on Windows. Change-Id: I147c07749c5073a9ae00f07914dd80347d17c40f Ping-Bug: 15118 Reviewed-on: https://code.wireshark.org/review/31154 Tested-by: Petri Dish Buildbot Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-27test: fix import in suite_dissectors/group_asterix.Dario Lombardo1-1/+1
Change-Id: I88a97168f318c4d900dadf8443e4068c60ba342f Reviewed-on: https://code.wireshark.org/review/31212 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-27test: add comment to fixture.Dario Lombardo1-0/+1
Change-Id: I4950968add0498003b041dc16fff05913e53d686 Reviewed-on: https://code.wireshark.org/review/31211 Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-12-26test: add suite_outputformats for json output regression testing.Dario Lombardo4-0/+3881
This suite uses different output formats to check against fixed samples. Change-Id: I8adccfefea35a6d3cfacf3da61e8a72d830ed3a0 Reviewed-on: https://code.wireshark.org/review/31056 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-12-26Added a generic dissector validator and some ASTERIX unit tests that use it.Atli Guðmundsson3-0/+1618
This patch extends the test suite with: * a way for tests to check if a given byte sequence dissects into an expected dissection result. Unit tests included: * ASTERIX I019 * ASTERIX I063 * ASTERIX I065 Change-Id: Ib168382ec15b0b610ff5913806120ba1bf1d1503 Reviewed-on: https://code.wireshark.org/review/31083 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-19test: enable extra test summary by defaultPeter Wu1-0/+1
This reports the reason why tests are skipped (for example, if a certain binary was not built). Change-Id: I19095f43f69228116d71b52380814a61894754af Reviewed-on: https://code.wireshark.org/review/31131 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-13text2pcap: allow to set interface nameJaap Keuter1-0/+17
When generating a capture file from a text file it can be helpfull to be able to set the capture interface name in the generated IDB. This can be especially true if later on the generated captures are merged and the individual IDB's have to be compared. Without a name every IDB of the same datalink type will be equal and subject to merge. Also it keeps the individual streams identifiable for the end user. Change-Id: I70224379d88f516a0a356bf0b46aebafb69665f0 Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl> Reviewed-on: https://code.wireshark.org/review/31015 Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-12-13Add new "rsa_keys" UAT for storage of RSA private keysPeter Wu1-0/+14
This should eventually replace the "ssl_keys" UAT which additionally contains a useless address, port and protocol field. This prepares for HSM support through PKCS #11. Change-Id: I59409c98aeedf260d19266d18e14ef7d9b40b582 Reviewed-on: https://code.wireshark.org/review/30977 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-30test: fix "DeprecationWarning: invalid escape sequence \("Peter Wu1-6/+6
Use the 'r' prefix to prevent backslashes from being interpreted. Change-Id: I736d70c72a862086501a59b3c1acac0d77e2d6d3 Reviewed-on: https://code.wireshark.org/review/30840 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-30test: skip tests when GnuTLS is unavailablePeter Wu2-7/+20
GnuTLS is an optional dependency, allow tests to run without it. Change-Id: Ib1bd7beaf1d885a157a0e1a630ccc4fbc8786af1 Reviewed-on: https://code.wireshark.org/review/30839 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-30test: use assertRun instead of runProcess where possiblePeter Wu9-139/+104
The case_decrypt_tls.test_tls_rsa_pq test is unexpectedly passing when GnuTLS is disabled. It checks for '/' in the output, but that also matches an error message. Use assertRun here and pretty much everywhere else to catch such issues. Remove a few redundant returncode checks. Change-Id: I0f9d1dadc0ca73eef9cffb3e2f452aa7c8395c95 Reviewed-on: https://code.wireshark.org/review/30838 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-27Test: Look up our encoding name before checking it.Gerald Combs1-3/+3
Resolve our output encoding name to something that's hopefully the same on all platforms so that we don't print Warning: Output encoding is utf-8 and not UTF-8. on Windows. Change-Id: I9c7703eac6e12f5a95f701e8a9bea7d17a513fef Reviewed-on: https://code.wireshark.org/review/30795 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-11-27test: lua: add a test for invalid ethernet addressMartin Kaiser1-1/+5
Wslua converts an invalid ethernet address to all 0's. Add a test for this case. Change-Id: I59bd1f9e0b94805c563fe891b22cadd32ae054d8 Reviewed-on: https://code.wireshark.org/review/30791 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-25test: lua: (trivial) fix indentationMartin Kaiser1-1/+1
Replace a TAB with spaces. Change-Id: I3d5c79af4116614ef78dd8a71eb42e93875c0637 Reviewed-on: https://code.wireshark.org/review/30790 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2018-11-21test: extend sharkd tests to cover all requestsPeter Wu2-42/+492
All request types have a corresponding test_sharkd_req_* test names which tests the current (documented) behavior. The frame and download tests are not very comprehensive though, but it's better than nothing. (The original test_sharkd_hello_dhcp_pcap test is replaced by test_sharkd_req_status and test_sharkd_req_frames, although the latter does not literally check for the "DHCP" column anymore.) Change-Id: Ic39b954fc50065345ac46e96a7057b7aba2a09e3 Reviewed-on: https://code.wireshark.org/review/30743 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20Test: Fix some dumpcap section checks and skip one.Gerald Combs1-5/+17
In check_dumpcap_pcapng_sections, append a copy of our check_val dict so that we properly check our first file. Skip IDB checks when we have multiple interfaces. Dumpcap creates a separate thread for each interface when the interface count is > 1, which means that we can't guarantee that we will always read and write everything in the same order. Change-Id: Ie458f31e0e901db2b538e9826a136dbe89167bcf Reviewed-on: https://code.wireshark.org/review/30718 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-11-20Add new Secrets API and allow TLS to use pcapng decryption secretsPeter Wu1-0/+10
Add a new secrets API to the core, one that can outlive the lifetime of a single capture file. Expose decryption secrets from wiretap through a callback and let the secrets API route it to a dissector. Bug: 15252 Change-Id: Ie2f1867bdfd265bad11fc58f1e8d8e7295c0d1e7 Reviewed-on: https://code.wireshark.org/review/30705 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20editcap: add --inject-secrets optionPeter Wu2-0/+63
Add a new option to insert decryption secrets into a pcapng file. Change-Id: I0e024585cac9a8a328e88d32f9eb03d37d350e2a Ping-Bug: 15252 Reviewed-on: https://code.wireshark.org/review/30693 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20wiretap: add read/write support for Decryption Secrets Block (DSB)Peter Wu4-0/+50
Support reading and writing pcapng files with DSBs. A DSB may occur multiple times but should appear before packets that need those decryption secrets (so it cannot be moved to the end like NRB). The TLS dissector will be updated in the future to make use of these secrets. pcapng spec update: https://github.com/pcapng/pcapng/pull/54 As DSBs may be interleaved with packets, do not even try to read it in pcapng_open (as is done for IDBs). Instead process them during the sequential read, appending them to the 'wtap::dsbs' array. Writing is more complicated, secrets may initially not be available when 'wtap_dumper' is created. As they may become available in 'wtap::dsbs' as more packets are read, allow 'wtap_dumper::dsbs_growing' to reference this array. This saves every user from checking/dumping DSBs. If the wtap user needs to insert extra DSBs (while preserving existing DSBs), they can set the 'wtap_dumper::dsbs_initial' field. The test file was creating using a patched editcap (future patch) and combined using mergecap (which required a change to preserve the DSBs). Change-Id: I74e4ee3171bd852a89ea0f6fbae9e0f65ed6eda9 Ping-Bug: 15252 Reviewed-on: https://code.wireshark.org/review/30692 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-11-20Replace JSON-GLib by custom JSON dumper libraryPeter Wu2-0/+62
The (optional) JSON-GLib library adds dependencies on GObject, GIO. For statically linked oss-fuzz builds it also adds libffi and more. To avoid these dependencies, replace JSON-GLib by some custom code. This allows `tshark -G elastic-mapping` to be enabled by default without extra deps. API design goals of the new JSON dumper library: - Small interface without a lot of abstraction. - Avoid memory allocations if possible (currently none, but maybe json_puts_string will be replaced to improve UTF-8 support). - Do not implement parsing, this is currently handled by jsmn. Methods to open/close array/objects and to set members are inspired by the JsonGlib interface. The interfaces to write values is inspired by the sharkd code (json_puts_string is also borrowed from that). The only observed differences in the tshark output: - JSON-GLib ignores duplicates, json_dumper does not and may produce duplicates and currently print two "ip.opt.sec_prot_auth_unassigned". - JSON-GLib adds a space before a colon (unimportant formatting detail). - (Not observed, but UTF-8 strings will be wrong like bug 14948.) A test was added to catch changes in the tshark output. I also fuzzed json_dumper with libFuzzer + UBSAN/ASAN and fixed an off-by-one error. Change-Id: I0c85b18777b04d1e0f613a3d59935ec59be87ff4 Link: https://www.wireshark.org/lists/wireshark-dev/201811/msg00052.html Reviewed-on: https://code.wireshark.org/review/30732 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>