Commit Graph

158 Commits

Author SHA1 Message Date
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
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Evan Huus d5c437e8e5 Fix function prototypes.
Functions with no parameters must be written func(void). Fixes (some) of the
buildbots.

Change-Id: I1a6e5c0553e032e99419fe67eb4b573bbdfe7fe6
Reviewed-on: https://code.wireshark.org/review/388
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-02-25 21:46:55 +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
Evan Huus 21e0a63b29 Add remove_last_data_source and fix bug 9169
The OP asked 9169 to be reopened because the capture was spewing ~40GB of output
when dissected with tshark. Investigation showed this was because the HTTP
dissector was requesting ONE_MORE_PACKET reassembly a lot, and TCP was adding
each step as a data-source which was being printed by tshark's hex dump. This
was leading to O(n^2) of output.

To fix, introduce function remove_last_data_source which removes the most recent
data source from the list. If the subdissector in TCP reassembly asks for
ONE_MORE_PACKET, assume it hasn't added any tree items (since it shouldn't have)
and remove the data source since it is unnecessary.

This may break dissectors which add tree items and *then* return
ONE_MORE_PACKET, since they will have their data source removed out from under
them. I believe those cases should be fixed to not add tree items until they're
sure they have enough data.

Change-Id: Iff07f959b8b8bd1acda9bff03f7c8684901ba8aa
Reviewed-on: https://code.wireshark.org/review/38
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Evan Huus <eapache@gmail.com>
2014-01-30 22:11:41 +00:00
Michael Mann bf284da2ee TFShark (Terminal Fileshark) v.001. Bug 9607 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9607)
This is a VERY PRELIMINARY version of tfshark.  It's an attempt to jumpstart FileShark and its architecture.  Right now it's mostly just a very stripped down version of tshark with all of the necessary build modifications (including now building filetap library since tfshark depends on it)

This code has helped me identify what I believe to be all of the necessary layers for a complete fileshark architecture.  And those layers will slowly be added in time (patches always welcome!).

svn path=/trunk/; revision=54646
2014-01-08 04:35:28 +00:00
Jakub Zawadzki 0f8572cb51 Avoid including definition of column_info structure in dissectors.
Move COL_* enum to <epan/column-utils.h>

XXX Later we can rename epan/column-info.h to column-int.h (or smth like this)

svn path=/trunk/; revision=54352
2013-12-22 10:41:27 +00:00
Jakub Zawadzki 90858e3058 Avoid including <epan/range.h> in dissectors.
svn path=/trunk/; revision=54315
2013-12-20 23:25:36 +00:00
Gerald Combs 17a67c3b5c Get the "Decode As" dialog working, albeit with a few warts. It differs
from the GTK flavor in two major ways:

- The "Decode As" and "User Specified Decodes" dialog have been unified.
- You can modify the decode as behavior at any time, not just when you
  have a packet selected.

Revert part of 53498 so that we can move items marked

/*** THE FOLLOWING SHOULD NOT BE USED BY ANY DISSECTORS!!! ***/

from epan/decode_as.h to ui/decode_as_utils.h. 

Move "save" code from decode_as_dlg.c to decode_as_utils.c as well.

In packet-dcerpc.c don't register a table named "ethertype". We might
want to add checks for duplicate table names.

To do:
- Add support for ranges?
- Either add support for DCERPC or make DCERPC use a regular dissector
  table.
- Fix string selectors (i.e. BER).


svn path=/trunk/; revision=53910
2013-12-10 19:23:26 +00:00
Jakub Zawadzki b75354ebe8 Avoid including <epan/epan.h> in dissectors.
svn path=/trunk/; revision=53774
2013-12-03 23:49:51 +00:00
Alexis La Goutte b2445d481c Fix
warning: argument 'data' of command @param is not found in the argument list of dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data)

warning: The following parameters of dissector_all_tables_foreach_changed(DATFunc func, gpointer user_data) are not documented: parameter 'user_data'

svn path=/trunk/; revision=53749
2013-12-03 13:37:58 +00:00
Jakub Zawadzki 82e2675f45 Avoid including <wiretap/wtap.h> in dissectors.
svn path=/trunk/; revision=53655
2013-11-29 20:53:00 +00:00
Gerald Combs 70709e1b35 Move common "decode as" preference code to epan.
We presumably want "decode as" behavior to be consistent across UIs so
call load_decode_as_entries() from read_prefs().

svn path=/trunk/; revision=53498
2013-11-22 00:20:23 +00:00
Michael Mann f34e11fabe Convert ethertype() function into a pure dissector. Bug 9454 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9454)
The main driving force for this was my new Decode As functionality (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9450) that wants a dissector/subdissector table relationship for all dissectors wanting to use Decode As functionality.  The ethertype() function provides the value to the "ethertype" subdissector table, so I think it should be matched to a dissector.  Only odd side effect is the display filter of "ethertype" returns no packets because there is no "item" associated with the dissector.


svn path=/trunk/; revision=53443
2013-11-20 02:28:14 +00:00
Jakub Zawadzki c9b2ee3768 include <wsutil/pint.h> only when needed.
svn path=/trunk/; revision=53196
2013-11-09 15:44:29 +00:00
Jakub Zawadzki 1899903f69 Include <epan/to_str.h> only when needed.
svn path=/trunk/; revision=53189
2013-11-09 13:41:10 +00:00
Michael Mann 02a8391535 Require dissector_try_string to pass a data parameter to its subdissectors. There weren't that many calls, so might as well modify the function than create a need for dissector_try_string_new.
svn path=/trunk/; revision=53049
2013-11-02 15:52:25 +00:00
Michael Mann 694bc6b763 Allow string-based dissector tables to pass data between dissectors.
svn path=/trunk/; revision=52980
2013-10-30 04:06:54 +00:00
Jörg Mayer 662c7704f8 After looking for something in the column-*.h files and
not finding it, I finally found it in column_info.h
Renamed column_info.h to column-info.h to have consistency
with the column*h files.

svn path=/trunk/; revision=52667
2013-10-18 13:06:05 +00:00
Pascal Quantin 012018110a Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9164 :
Add dissector_try_uint_new() to the list of exported symbols

svn path=/trunk/; revision=52159
2013-09-20 19:11:23 +00:00
Stig Bjørlykke 2b698e5c5f Added dissector_delete_all() to remove all entries from a dissector table.
svn path=/trunk/; revision=51859
2013-09-09 05:36:45 +00:00
Anders Broman d8e8f48636 Simplify adding and deletetion of port ranges by adding new methods.
If no one has any objection I'll edit the deocumentation later.

svn path=/trunk/; revision=51517
2013-08-25 18:48:26 +00:00
Guy Harris 8fc0c287f5 Another tv_buff reference.
svn path=/trunk/; revision=51406
2013-08-17 18:27:23 +00:00
Guy Harris ae50596f8a Just call it a tvbuff, with no underscore.
svn path=/trunk/; revision=51405
2013-08-17 18:22:50 +00:00
Evan Huus a2b2885daf Create the dissector hash table in only one place, and specify that its values
should be freed when it is destroyed. This requires splitting packet_init in
two: the hash table which must be created before protocol registration, and the
caching of common protocol handles, which must happen after registration.

svn path=/trunk/; revision=51329
2013-08-13 03:11:28 +00:00
Jakub Zawadzki b53052c6de Dissector handle after [new_]register_dissector can be get by find_dissector() so to avoid some extra calls just return it.
svn path=/trunk/; revision=51154
2013-08-05 17:23:47 +00:00
Jeff Morriss 2df54da6e2 Move a bunch of the crypt modules and pint.h into wsutil.
This means wsutil now links against libcrypt.

Protect a bunch of the crypt header files from multiple inclusion.

svn path=/trunk/; revision=51100
2013-08-01 23:34:47 +00:00
Jakub Zawadzki 28e9dcc4a9 Some work on multi file dissection
- make init_dissection/cleanup_dissection private for libwireshark
- implement epan_new(), epan_free()
- pass epan_t to epan_dissect*

svn path=/trunk/; revision=50761
2013-07-21 18:38:03 +00:00
Jakub Zawadzki ce81449ed9 packet dissection now takes pointer to tvb instead of guint8 data
implement frame_tvbuff, right now almost a copy of 'real' tvb.

svn path=/trunk/; revision=50497
2013-07-11 05:47:02 +00:00
Pascal Quantin 458dcb7ea2 Add ability to export decrypted SSL/DTLS PDUs
svn path=/trunk/; revision=50001
2013-06-18 01:13:07 +00:00
Gerald Combs d14fa4914d Add Doxygen boilerplate for some of our core modules and data structures.
svn path=/trunk/; revision=49640
2013-05-30 22:20:21 +00:00
Evan Huus 63ef04ec84 Fix a whole bunch of doxygen warnings, mostly typos or renamed parameters.
svn path=/trunk/; revision=49053
2013-04-26 18:28:21 +00:00
Balint Reczey 1ebdb2e521 Export libwireshark symbols using WS_DLL_PUBLIC define
Also remove old WS_VAR_IMPORT define and related Makefile magic
everywhere in the project.

svn path=/trunk/; revision=47992
2013-03-01 23:53:11 +00:00
Gerald Combs 0a28fb8f6a Update the Qt byte view widget to reflect the recent changes in the GTK+
byte view.

Move the packet_char_enc enum from packet.h to frame_data.h. Make the
encoding flag a packet_char_enc and make it one bit.

Get rid of the "cfile" global in a few places. C++-ize some of the font
code. Clean up some variable names.

svn path=/trunk/; revision=45838
2012-10-30 19:21:24 +00:00
Jakub Zawadzki b53dbea042 Make data_source opqaue, add getter for tvb.
svn path=/trunk/; revision=45672
2012-10-20 19:54:56 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +00:00
Jörg Mayer 30b7b74dde Remove #defines that provided backward source compatibility
for deprecated dissector add/remmove/... functions.

svn path=/trunk/; revision=45000
2012-09-19 07:20:49 +00:00
Jakub Zawadzki a406bb1a50 Add data parameter to dissector_try_uint_new
svn path=/trunk/; revision=44874
2012-09-11 09:06:48 +00:00
Jakub Zawadzki 27fb6880c4 Add new function: call_dissector_with_data
svn path=/trunk/; revision=44873
2012-09-11 09:06:13 +00:00
Jakub Zawadzki 9f92dc93c5 Add data parameter to call_dissector_only.
svn path=/trunk/; revision=44872
2012-09-11 08:28:07 +00:00
Jakub Zawadzki dee4443809 Add data parameter to dissector_try_heuristic
svn path=/trunk/; revision=44871
2012-09-11 08:26:48 +00:00
Jakub Zawadzki 5a8783f5b1 Initial commit to support yet another method of passing data between dissectors.
Add new parameter 'data' to heur_dissector_t and new_dissector_t, for now it's always NULL

svn path=/trunk/; revision=44860
2012-09-10 21:40:21 +00:00
Michael Mann e5e09f7016 Fix Bug 7348 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7348)
svn path=/trunk/; revision=44696
2012-08-29 21:23:07 +00:00
Chris Maynard f90809827c Trivial typo: if -> it
svn path=/trunk/; revision=42552
2012-05-10 16:09:10 +00:00
Jeff Morriss 89cfdc3559 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3315 -
make Save-As/Displayed/All-Packets save not only the displayed packets but
also any other packets needed (e.g., for reassembly) to fully dissect the
displayed packets.

This works only for the "All packets" case; choosing only the Selected packet,
the Marked packets, or a range of packets would require actually storing which
packets depend on which (too much memory) or going through the packet list many
times (too slow).  Also, this behavior is always the case: you can't save the
displayed packets without their dependencies (I don't see why this would be
desirable).

So far this is done for SCTP and things using the reassembly routines (TCP has
been tested).

The Win32 dialog was modified but hasn't been tested yet.

One confusing aspect of the UI is that the Displayed count in the Save-As
dialog does not match the number of displayed packets.  (I tried renaming the
button "Displayed + Dependencies" but it looked too big.)  The tooltip tries
to explain this and the fact that this works only in the All-Packets case;
suggestions for improvement are welcome.


Implementation details:

Dissectors (or the reassembly code) can list frames which were needed to
build the current frame's tree.  If the current frame passes the display
filter then each listed frame is marked as "depended upon" (this takes up the
last free frame_data flag).

When performing a Save-As/Displayed/All-Packets then choose packets which
passed the dfilter _or_ are depended upon.

svn path=/trunk/; revision=41216
2012-02-28 03:19:49 +00:00
Bill Meier b83e1b218f Add 'heur_dissector_set_enabled()' to allow a dissector to enable/disable heuristic dissection;
Rename some vars;
Do some minor re-indentation and whitespace changes.

svn path=/trunk/; revision=40601
2012-01-20 02:43:37 +00:00
Bill Meier ebe33ba92a Add tshark option '-G heuristic-decodes' to dump heuristic dissector tables.
svn path=/trunk/; revision=40309
2011-12-28 15:05:59 +00:00
Anders Broman 8259fbb105 Preparation to make it possible to dissable heuristic protocols
trough the proto dialouge.

svn path=/trunk/; revision=40215
2011-12-15 20:39:01 +00:00
Anders Broman 377bfd19a0 List heuristic tables in Internals->Disscetor tables menu.
svn path=/trunk/; revision=38881
2011-09-05 13:04:23 +00:00
Stig Bjørlykke a6476ba91b Added dissector_handle_get_long_name().
svn path=/trunk/; revision=36412
2011-03-31 12:14:59 +00:00