aboutsummaryrefslogtreecommitdiffstats
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2015-01-12Fix Cygwin pathGraham Bloice1-1/+1
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-12Make running the tests a little easier on WindowsGraham Bloice1-3/+8
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-02Fix lua tests on WindowsGraham Bloice2-1/+2
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-02test: improve check for out-of-tree testsEvan Huus1-4/+5
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-02test: default WS_QT_BIN_PATH to WS_BIN_PATHEvan Huus1-1/+1
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-02Make it easier to run tests out of tree.Joerg Mayer1-3/+8
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-02Lua: regex test suite fails with UTF-8 localeHadriel Kaplan1-1/+7
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>
2014-12-31Test suite: Make sure we have a usable locale before we run iconv.Gerald Combs1-0/+5
Change-Id: Ib1f3143dc48af4c556b9bcdfafbb477fd59b6359 Reviewed-on: https://code.wireshark.org/review/6181 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-31Lua: allow a Dissector object to be passed in for register_heuristicHadriel Kaplan3-2/+63
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-30Test suite: Start testing our output for valid UTF-8.Gerald Combs2-0/+22
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-25Bug 10233 - Wireshark crashes if Lua heuristic dissector returns trueHadriel Kaplan1-28/+155
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-24test suite: (Minor) fix some double spaceAlexis La Goutte2-4/+4
Change-Id: I7fe7cd7ed471b8fcd2afd5fb4bbc180b580295b3 Reviewed-on: https://code.wireshark.org/review/6031 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-23test suite: fix indent (use tabs) and add modelinesAlexis La Goutte3-50/+61
Change-Id: I648d02d41f92c7fd176ce194eee20a2d19643fe0 Reviewed-on: https://code.wireshark.org/review/5985 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-01Remove private_data member from packet_info structure.Michael Mann1-2/+0
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-10-08Try to speed up ping-dependent capture tests.Gerald Combs1-9/+14
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-03Re-enable the Wireshark test suite.Gerald Combs1-1/+1
Change-Id: Icfd9edb8c6ef7620878bc9d60c8dcc569ad2abad Reviewed-on: https://code.wireshark.org/review/4434 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-10-02Partially re-enable Wireshark tests.Gerald Combs2-3/+6
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-02Temporarily disable the Qt tests added in g58cde5c.Gerald Combs2-2/+2
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-01Add tests for the Qt UI.Gerald Combs4-4/+43
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-09-29Fix lua bindings to handle timestamp precision changesEvan Huus1-1/+1
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-24test: add decryption test for isakmp with certificatesAlex Badea3-0/+19
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-02Qt → wireshark. GTK+ → wireshark-gtk.Gerald Combs4-8/+8
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-07-12make unit-test suite work out-of-treeEvan Huus1-5/+15
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-06-27Tighten the dump-glossary test.Evan Huus1-1/+4
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-25Decrease TRAFFIC_CAPTURE_DURATION from 60s to 15s.Gerald Combs1-1/+1
Change-Id: Ie6d6ac0489f0fcb506360a3900d33c44cb3477e9 Reviewed-on: https://code.wireshark.org/review/2664 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-06-18Check for lua by grepping the output of tshark -vEvan Huus1-2/+2
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-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris2-2/+5
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-21Fix lua directory tests.Evan Huus1-14/+16
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-04-27Revert part of g757db64e484b009c3Evan Huus1-1/+1
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-26Have DTLS just dissect the test capture as dataEvan Huus1-1/+1
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-25Don't use HTTP filter for DTLS decryption test as it's not really HTTP ↵Michael Mann2-2/+2
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-17Add tvb_get and proto_tree_add for string-encoded byte arraysHadriel Kaplan2-25/+246
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-14Add tvb_get and proto_tree_add for string-encoded timestampsHadriel Kaplan2-0/+599
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-07Switch to Lua 5.2.3 built with MSVC2010 instead of the one built with MingW ↵Pascal Quantin1-7/+7
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-06Get it compiling again: WindowsXP build failingHadriel Kaplan1-7/+7
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-03-31Continue to remove $Id$ from top of fileAlexis La Goutte14-25/+0
(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-31Continue to remove $Id$ from top of fileAlexis La Goutte1-2/+0
(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-26Add various functions for Lua directory handling and path infoHadriel Kaplan2-0/+219
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-26Add filterable expert info for LuaHadriel Kaplan4-9/+137
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-23Add Lua Struct.values() function, and prevent coercion in all Struct functionsHadriel Kaplan1-0/+19
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-22Fix spelling mistakes in Lua test scriptsHadriel Kaplan4-28/+28
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-22Add way for Lua file reader to save state per file read/write opsHadriel Kaplan3-261/+528
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-19Fix lua file testsuite not working and weak heuristic readers not being ↵Hadriel Kaplan4-11/+31
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-19Add capture file reader/writer support for Lua so scripts can implement new ↵Michael Mann5-0/+2147
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-14Add Lua heuristic dissector supportHadriel Kaplan5-17/+215
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-13add a test for SSL/TLS decryption using the master secretMartin Kaiser3-3/+22
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-11Fix Bug 9870 'Lua: trying to call/get an invalid name results in a get-loop ↵Hadriel Kaplan2-4/+16
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-10Add GLib's regex library into LuaHadriel Kaplan8-2/+1465
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-05Add test to dump glossaries.Evan Huus1-1/+20
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-02-25Fix bug 6357: Lua all_field_infos() broken within tap/listenerHadriel Kaplan1-3/+70
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>