Commit Graph

110 Commits

Author SHA1 Message Date
jmartin-usna e10e3ae9ea print.c: Handles special chars when using -T fields
Tshark poorly handles printing when using -T options where a field
contains newline, carriage return, or other special characters such as tab.

Bug: 14907
Change-Id: I94a797bb98b94aac254bcd2e6911b37192e9c91f
Reviewed-on: https://code.wireshark.org/review/28442
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-06-26 21:11:17 +00:00
Anders bb81bef535 glib: Get rid of GLIB_CHECK_VERSION as we now require 2.32.0
Change-Id: Ie95cf37f9cd283545693e290340a7489cc989c95
Reviewed-on: https://code.wireshark.org/review/26970
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-16 16:07:46 +00:00
Gerald Combs 9b83aaeccc Skip hidden columns when we export packets.
Skip hidden columns when we export to CSV, EK, and PSML.

Change-Id: Id1dc0f4d3cf34e74ce52893d0f0a30f4b4d61aed
Reviewed-on: https://code.wireshark.org/review/26588
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-23 00:06:07 +00:00
Guy Harris 9a5217bdd4 Fix another leak, which happens with -E occurrence=l.
For each occurrence, if there was already an occurrence in the array, we
were just removing it. not freeing what it pointed to.

While we're at it, expand comments. and always check the array size with
"!= 0", not "> 0" - the value is unsigned, so they're equivalent, but
this makes the code more self-consistent.

Change-Id: I538f46b296a7721a39ba4366c2f6269e7e097b0d
Reviewed-on: https://code.wireshark.org/review/26328
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-07 08:51:32 +00:00
Dario Lombardo 6db59affd9 print: free memory if not used (found by clang).
Change-Id: Ib6dc913ab1eeff7b29e18930b66b728080629773
Reviewed-on: https://code.wireshark.org/review/26183
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: ronnie sahlberg <ronniesahlberg@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 08:03:11 +00:00
Dario Lombardo 55c68ee69c epan: use SPDX indentifiers.
Skipping dissectors dir for now.

Change-Id: I717b66bfbc7cc81b83f8c2cbc011fcad643796aa
Reviewed-on: https://code.wireshark.org/review/25694
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:45 +00:00
Jaap Keuter ea6c209758 Reset file permissions
Some oddities with regard to file permissions have crept into
the repository. Reset execute rights on various files which do
not need them.

Change-Id: Ib05658072925d59fc682173673c5638d157a269a
Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-on: https://code.wireshark.org/review/25490
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-27 18:48:40 +00:00
Merlin Chlosta af6dee3571 Add columns (_ws.col) to output formats json, ek, pdml
Bug: 13020
Change-Id: Ia83797a4e390be7cc59a9718735edc1c7f9a5712
Reviewed-on: https://code.wireshark.org/review/24928
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-02 05:27:51 +00:00
Pavel Strnad d3a3b0ba27 tshark: fix pdml export for LUA cases
- bug fix for wrong level introduced in SHA-1:b8ead953
- fix indent for Close off fake wrapper protocol

Change-Id: Iccb10af8f3ac1604fc5582d730f2fd39ffaeb1c0
Reviewed-on: https://code.wireshark.org/review/24681
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-12-04 08:47:35 +00:00
Martin Kacer 3593f0953f Fix Elasticsearch hex dump
Removing duplicated double quote.

Bug: 12958
Change-Id: I17f443efd8572e1d17ced5b8ec8f743253be859b
Reviewed-on: https://code.wireshark.org/review/24273
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-11-07 13:22:05 +00:00
Dario Lombardo 9705f653da print: add fi check.
Change-Id: Ica20efe7122476af55b70c72d8af40244c25f902
Reviewed-on: https://code.wireshark.org/review/24259
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-06 16:09:20 +00:00
Christoph Wurm be625b9be7 Fix Elasticsearch hex dump
Change-Id: I5b2006a74e95759afce518aaadfe47c54978476a
Reviewed-on: https://code.wireshark.org/review/24215
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-11-02 20:49:45 +00:00
Christoph Wurm ec43b0faa6 Deduplicate Elasticsearch output
Collects multiple values of the same field into an array.
Empty protocols are now written as empty objects to not conflict
with the same protocols in other packets.
Remove _score since it has no effect.

Bug: 12958
Change-Id: Ibe8ea9bc1e3e63dea1fe4eaf522fa38cad88a17f
Reviewed-on: https://code.wireshark.org/review/24171
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-31 04:57:51 +00:00
Christoph Wurm 6d8661ceef Fix segfault in Elasticsearch output
When using the Elasticsearch output but only printing the packet
summary with -P a segfault will occur because the empty packet
tree is not properly handled in this case.

Change-Id: I0c91314ae013785ae6dceabd6af33db4b836d1b2
Reviewed-on: https://code.wireshark.org/review/24153
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-31 03:28:10 +00:00
Christoph Wurm af09db8bd3 Tshark: Optional packet summary for Elasticsearch
Currently, the Elasticsearch output exports the packet details and,
if -x is specified, the raw hex data.

This change adds the option of exporting the packet summary as well.

The default stays the same (packet details only), but now the existing
-P switch turns on printing of the packet summary. It also turns off
printing packet details, which can be turned back on with -V to print
both, and combined with -x to print all three: summary, details and
raw hex.

The packet summary is especially useful when exploring and visualizing
the data in Kibana, e.g. by displaying the summary "Info" field/column
in a table, as in the Wireshark GUI.

Change-Id: I2030490cfdd905572397bc3d5457ba49d805a5c4
Reviewed-on: https://code.wireshark.org/review/22716
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-15 00:58:42 +00:00
Christoph Wurm 1f8e7c45e1 Tshark: Prepare Elasticsearch output deduplication
Refactors the ES output to use hash tables and lists in preparation
of deduplicating fields. ES 5.x allows those, but will only store
the last instance and discard any other without warning.

ES 6.x altogether refuses to accept documents containing
duplicate fields.

This change should not change the output of Tshark in any way.
A subsequent change will introduce the actual deduplication.

Bug: 12958
Change-Id: I329ef0878e33b42d65a53bcac977429d87cde3ca
Reviewed-on: https://code.wireshark.org/review/23042
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>
2017-10-02 04:17:31 +00:00
João Valverde a269ae1b6a Rename "ws_version_info.h", also .c
It's not installed so like most other files it doesn't need or benefit
from the prefix.

Change-Id: I01517e06f12b3101fee21b68cba3bc6842bbef5c
Reviewed-on: https://code.wireshark.org/review/23751
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-26 17:32:08 +00:00
Guy Harris 257f738a0d Use the Wayback Machine for the PDML spec.
It's not available at the old URL any more.

Change-Id: Id8baba5e02cf0e3227365f53a11caa054ef2c40f
Reviewed-on: https://code.wireshark.org/review/23165
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-22 17:38:38 +00:00
Anthony Coddington fa390fa8f3 Fix bit depth of color psml and pdml xml attributes
color_t is 16-bit per channel, the print string assumes the usual 8-bit.
Use 8-bit per channel as per older patches proposed for bug 6682 via
color_t_to_rgb().

Change-Id: I7d71bc04e52376c0ecb598aedafa066f982de840
Ping-Bug: 6682
Reviewed-on: https://code.wireshark.org/review/23154
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-08-21 10:42:06 +00:00
Dario Lombardo 7a4c9d267b print: use assert before dereference (CID 1412973).
Change-Id: I82602ceb735a055602a18c2c52e0669c4efd7773
Reviewed-on: https://code.wireshark.org/review/22748
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-07-24 07:02:55 +00:00
AndersBroman d9845ca27e [print.c] g_slist_free_full requires #include <wsutil/glib-compat.h>
Change-Id: Iba3a95d67413d7f1a84436fc51dfdf13251bcece
Reviewed-on: https://code.wireshark.org/review/22620
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-07-14 09:10:53 +00:00
Daan De Meyer 07f576ffeb Add --no-duplicate-keys tshark option.
Adds the --no-duplicate-keys option to tshark. If -T json is specified,
this option can be specified in order to transform the duplicate keys
produced by -T json into single keys with as value a json array of all
separate values.

Specifying --no-duplicate-keys changes the function which groups node
children that is passed to write_json_proto_tree. Instead of a function
that puts each node in a separate group (proto_node_group_children_by_unique)
a function is passed that groups children that have the same json key
together (proto_node_group_children_by_json_key). This will lead to
some groups having multiple values. Groups with multiple values are
written to the output as a json array. This includes normal json keys
but also keys with the "_raw" and "_tree" suffix.

If --no-duplicate-keys is specified with an option other than "-T json"
or "-T jsonraw" or without -T an error is shown and tshark will exit.

"Export Packet Dissections -> As JSON" in the GUI is hardcoded to use
the duplicated keys format.

Fixes one regression in the output where a filtered json key (-j) with
both a value and children would not have the "_tree" suffix added to the
json key containing the children.

Includes a little code cleanup (removes one instance of code
duplication and simplifies a while loop).

Fixes a memory leak (I thought this fix was already included in the
previous refactor patch but something must have gone wrong when updating
the patch so I'm including it again in this patch).

Bug: 12958
Change-Id: I401f8fc877b5c590686567c3c44cdb832e9e7dfe
Reviewed-on: https://code.wireshark.org/review/22166
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-22 19:31:01 +00:00
Daan De Meyer 7c28d26d71 Refactor JSON output functions
Refactors the print.c json output functions to be more intuitive and
to allow easy switching to single json keys with a json array of values
instead of duplicate json keys. With this commit the json output does
not change at all.

These changes have been tested on multiple decrypted http2 traces with
the following testing method:
- Save the pcap file as json with a build of the current master branch.
- Save the pcap file as json with a build of the master branch + this
commit.
- Compare the files for changes with the "cmp" utility.

No differences were found between files for multiple different decrypted
http2 traces. Printing with the "-x" or "-j" options also does not
produce any changes either.

Bug: 12958
Change-Id: Ibd3d39119c3a08906389aa8bbf4e2a2b21dd824e
Reviewed-on: https://code.wireshark.org/review/22064
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>
2017-06-16 07:41:27 +00:00
Michael Mann 585d17ae7f Add support for color xml attributes in psml and pdml formats.
Bug: 6682
Change-Id: I19330d06aa3d5692503c61369c3c650d595971f5
Reviewed-on: https://code.wireshark.org/review/22077
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stephen Donnelly <stephen.donnelly@endace.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-12 03:23:38 +00:00
Michael Mann e0a9603b24 print.c: Remove unused hf_ variables
Some hf_ variables were "cached" in print.c to break dependency on (frame)
dissectors.  They are no longer used (and check*.pl scripts found them)

Change-Id: Ib46e5f5e58da54b6d7a3f85586581507f653c55a
Reviewed-on: https://code.wireshark.org/review/22078
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-11 18:13:54 +00:00
Stig Bjørlykke 907d05da84 print: Avoid shadowing a global variable
Change-Id: I9c04bc1d6fc5511d404987dd94eee342e0d75442
Reviewed-on: https://code.wireshark.org/review/21332
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-04-25 11:26:44 +00:00
Guy Harris e52c95c6c8 Move UI-only stuff out of libwireshark.
Packet ranges are used only in the UI; move the packet range stuff into
libui.

Don't pass a print_args_t structure to libwireshark packet-printing
routines, just pass the few parameters they need.  Move the declaration
of print_args_t into file.h.

Change-Id: Icff5991eea7d7d56f33b4716105895263d275bcf
Reviewed-on: https://code.wireshark.org/review/21308
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-24 03:38:21 +00:00
Martin Kacer cd7d159c2e json2pcap support added
Modified tshark -T json -x output
Added tshark -T jsonraw output
json2pcap.py (can be used for basic packet editing by modifying json)

The modification in tshark -T json -x and new tshark -T jsonraw output
add into  hex-data output in JSON also information on which position
each field is dissected in the original frame, what is the field length,
bitmask (for not byte aligned fields) and type. This information can be
used for latter processing. One use-case is json2pcap script which
assembles the protocol layers back together from upper to lowers layers,
which allows the basic packet modification/editing/rewriting.

Change-Id: Ibf948eb8fc7e3b0b51c12df6c3855f705a9c7925
Reviewed-on: https://code.wireshark.org/review/19990
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-25 19:11:01 +00:00
Martin Kacer b8ead95375 tshark print_indent function
Modified epan/print.c to use function print_indent

Change-Id: Iefcb1e3c7813919c6af70d57a4f8a6f921595360
Reviewed-on: https://code.wireshark.org/review/20060
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-02-11 20:09:17 +00:00
Martin Kacer c9d8c1c8c5 PDML: protocol filter incorrectly filters desired subfields
Bug: 12847
Change-Id: I8a560dc44dceb06123d8bcecd512d132ee4ebb0d
Reviewed-on: https://code.wireshark.org/review/19671
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-02-05 14:03:34 +00:00
Michael Mann 1a57d81042 Rename packet-range.[ch] to packet_range.[ch]
The check*.pl scripts presume that files with the prefix "packet-"
are dissector files and therefore have different rules than other
files.  Rather than trying to clarify that more with additional
directory information, just make any non-dissector file with
"packet-" filename prefix conform if it fails a "dissector specific"
check from the scripts.

Change-Id: I7cb52e1fad4ea62320492bb690904260f958aeb4
Reviewed-on: https://code.wireshark.org/review/19304
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-16 17:28:50 +00:00
Michael Mann 26def3ef72 Honor protocols.display_hidden_proto_items preferences when outputting fields in TShark
Bug: 13192
Change-Id: Ibb2b3913716d31a3d5f600e1b6400fdf14a69ca4
Reviewed-on: https://code.wireshark.org/review/19075
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-12-05 06:28:32 +00:00
Pascal Quantin c12280f804 print.c: fix ek output
follow-up of g1b91475

Bug: 13086
Change-Id: I7171c50a0b113e3036860941b586e96a068fea9e
Reviewed-on: https://code.wireshark.org/review/18705
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-11-08 08:47:05 +00:00
Pascal Quantin 1b91475e0d JSON: print field value for an item containing a subtree
For fields that contain both a value and a subtree, print the value and
then create a new item with a _tree suffix for the subtree content

Bug: 13086
Change-Id: I5a3c96bf9895d87faff3925d439bb54b73769a3e
Reviewed-on: https://code.wireshark.org/review/18663
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kacer <kacer.martin@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-11-07 19:59:21 +00:00
Pascal Quantin b0eac84840 Small fixes for JSON output
- reinitialize the variable used to insert comma between packets when
performing a new export
- ensure that escaped ASCII characters are code on 4 digits characters

Change-Id: Ib557da4843f6b98f793b60e417260ebb27a38b99
Ping-Bug: 13073
Reviewed-on: https://code.wireshark.org/review/18598
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-11-02 01:13:57 +00:00
Guy Harris d16295bc9b Suppress "discarding const" warning.
Change-Id: I5f97b70d7f423cb5b7792863fb2bd07516aa1951
Reviewed-on: https://code.wireshark.org/review/18375
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22 03:47:20 +00:00
Guy Harris 10ca4c7527 More checks for localtime() and gmtime() returning NULL.
And some comments in the case where we're converting the result of
time() - if your machine's idea of time predates January 1, 1970,
00:00:00 UTC, it'll crash on Windows, but that's not a case where a
*file* can cause the problem due either to a bad file time stamp or bad
time stamps in the file.

Change-Id: I837a438e4b875dd8c4f3ec2137df7a16ee4e9498
Reviewed-on: https://code.wireshark.org/review/18369
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22 02:27:32 +00:00
Dirk Jagdmann 14be63a807 set PDML and PSML encoding to UTF-8. replace fputs() with fprintf() in writing PSML and PDML preambles for more consistent code formatting.
Change-Id: I57dbb27cbf935dd31342639b315d1fc98bd27d77
Reviewed-on: https://code.wireshark.org/review/17895
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-29 01:20:05 +00:00
AndersBroman 1a384ef416 [proto.c] Add proto_find_first_finfo() to find first occurance of a field.
Change-Id: I11f50d7b00851880f77067260e2496175d227e76
Reviewed-on: https://code.wireshark.org/review/17937
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>
2016-09-27 03:39:28 +00:00
AndersBroman b9d493f8de [print.c] Use pinfo and frame_info to print geninfo.
Change-Id: Ie77292bfb2d962b326cb4dd9273d7258586f18b5
Reviewed-on: https://code.wireshark.org/review/17841
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-22 04:08:52 +00:00
AndersBroman fe1d006016 [print.c] Get timestamp directly from pinfo rather than going via field
info.

Change-Id: I266775b0880931bbce5ec0ed9bc9d8b0dbce7246
Reviewed-on: https://code.wireshark.org/review/17840
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>
2016-09-22 04:07:23 +00:00
Jeff Morriss 3ecbe50af2 Restore setting data.edt in write_specified_fields().
This prevents tshark from crashing when run with "-T fields -e data".

I5778b08c52119b5be1ec482be9417b3c4ba8ed62 mistakenly removed this line (this
'data' is a write_field_data_t rather than the print_data structure that
change was cleaning up).

Bug: 12616
Change-Id: I773e47f12f852e19a20ec29a43eb3a0953923173
Reviewed-on: https://code.wireshark.org/review/16415
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-07-13 15:02:08 +00:00
Hessam Jalali f3bd70b246 fix missing fields for json, ek and pdml when used with -e fields
Description:

when -T json,ed or pdml used in conjunction with -e fields they would
always miss  the last field.

in case of json and ek, if some fields in the middle are empty,
the generated json would be invalid.

sample for ek:

 {  "_index": "packets-2016-06-30",  "_type": "pcap_file",
 "_score": null,  "_source":
 {  "layers": {  "e212.mcc": ["255","262"]  "frame.time_epoch":
 ["1426550400.004751510"],  "e212.mnc": ["1","1"]  }  }  }

command:

tshark -T ek -r C:\a.pcap -e e212.mcc -e frame.comment
-e frame.time_epoch -e e212.mnc > C:\test.json

note:

the comma is missing between e212.mcc and frame.time_epoch

Change-Id: I2efae0c48036cf6313e2a064453c8dbc49f38b09
Reviewed-on: https://code.wireshark.org/review/16226
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Martin Kacer <kacer.martin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-07-01 15:48:41 +00:00
Guy Harris 641904b5ca Pass the format as an argument to write_specified_fields().
That makes failing to specify a format a compile-time error.

Change-Id: Iff0bda8be35b1e3acc97e4314657ceaff2b3d0be
Reviewed-on: https://code.wireshark.org/review/16218
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-30 01:52:09 +00:00
Guy Harris bef07e75a0 Remove unused edt field from print_data structure.
Change-Id: I5778b08c52119b5be1ec482be9417b3c4ba8ed62
Reviewed-on: https://code.wireshark.org/review/16215
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-30 00:08:11 +00:00
Guy Harris 6190f49a4a Get rid of unused edt member in write_pdml_data structure.
Change-Id: I2a41d378187c1685afb701372cf3a8ec9c0aeb70
Reviewed-on: https://code.wireshark.org/review/16214
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-29 23:53:33 +00:00
Guy Harris 6d06e690f2 Remove unused edt member from write_json_data structure.
Change-Id: Id8b45715c753dc6006f7833e5f49bd8aabc15271
Reviewed-on: https://code.wireshark.org/review/16213
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-29 23:49:32 +00:00
Guy Harris 2257478e92 Fix -T fields, broken by ceae9e4d1f.
Rename write_fields_proto_tree() to write_specified_fields(), and make
it static.  Make write_fields_proto_tree() a wrapper around
write_specified_fields() that sets the format to FORMAT_CSV.  Have
write_specified_fields() fail with an assertion if fields->format isn't
one of the known formats, to catch problems such as this in the future.

Don't fill in the "data" structure if we're not going to use it.

Change-Id: I11dbf448d72ca389f0e5fb8558a41b7eecf7c9a4
Reviewed-on: https://code.wireshark.org/review/16210
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-29 23:15:05 +00:00
Martin Kacer ceae9e4d1f tshark fields filter added for other outputs
-e fields filter addded to ek|json|pdml output.

Bug: 12529
Change-Id: I1f0f8772eefceb5b71927925ce0c34af483571b9
Reviewed-on: https://code.wireshark.org/review/16193
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-29 08:29:16 +00:00
Dario Lombardo 670b1199e3 print.c NULL pointer check in print_escaped
Added NULL pointer check in print_escaped functions.
Requested by comment in change 16034.

Change-Id: Id172d772d9b5cb4bcd31fe8b42286f885ec5b968
Reviewed-on: https://code.wireshark.org/review/16188
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-06-28 14:27:09 +00:00