summaryrefslogtreecommitdiff
path: root/tshark.c
diff options
context:
space:
mode:
authorMartin Kacer <kacer.martin@gmail.com>2016-06-20 11:03:40 +0200
committerGuy Harris <guy@alum.mit.edu>2016-06-21 16:57:59 +0000
commitc3f3bd7fa89af1ccd15440cf401697fc32814ed6 (patch)
tree2b8ada654c02b0a59ae9eb7fde8eba7f16564eab /tshark.c
parentdf231d9c52d8e94d2ef48f83beeef1455a0e7ce9 (diff)
downloadwireshark-c3f3bd7fa89af1ccd15440cf401697fc32814ed6.tar.gz
tshark JSON and Elasticsearch output fix
Fixed json and ek escape function Fixed -j protocol filter to do exact match Fixed -T json to correctly close json Added -j protocol filter also to pdml output Bug: 11754 Change-Id: I02f274e4a5a02346922b37bbe946c10340c242ea Reviewed-on: https://code.wireshark.org/review/16034 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tshark.c b/tshark.c
index 87a317c411..5636988496 100644
--- a/tshark.c
+++ b/tshark.c
@@ -168,7 +168,7 @@ static print_format_e print_format = PR_FMT_TEXT;
static print_stream_t *print_stream;
static output_fields_t* output_fields = NULL;
-static gchar *jsonfilter = NULL;
+static gchar **protocolfilter = NULL;
/* The line separator used between packets, changeable via the -S option */
static const char *separator = "";
@@ -368,7 +368,7 @@ print_usage(FILE *output)
fprintf(output, " -x add output of hex and ASCII dump (Packet Bytes)\n");
fprintf(output, " -T pdml|ps|psml|json|ek|text|fields\n");
fprintf(output, " format of text output (def: text)\n");
- fprintf(output, " -j <jsonfilter> only protocols layers to include if -Tjson, -Tek selected,\n");
+ fprintf(output, " -j <protocolfilter> protocols layers filter if -T ek|pdml|json selected,\n");
fprintf(output, " (e.g. \"http tcp ip\",\n");
fprintf(output, " -e <field> field to print if -Tfields selected (e.g. tcp.port,\n");
fprintf(output, " _ws.col.Info)\n");
@@ -1070,7 +1070,7 @@ main(int argc, char *argv[])
}
break;
case 'j':
- jsonfilter = optarg;
+ protocolfilter = wmem_strsplit(wmem_epan_scope(), optarg, " ", -1);
break;
case 'W': /* Select extra information to save in our capture file */
/* This is patterned after the -N flag which may not be the best idea. */
@@ -3834,7 +3834,7 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
break;
case WRITE_XML:
- write_pdml_proto_tree(edt, stdout);
+ write_pdml_proto_tree(protocolfilter, edt, stdout);
printf("\n");
return !ferror(stdout);
case WRITE_FIELDS:
@@ -3843,12 +3843,12 @@ print_packet(capture_file *cf, epan_dissect_t *edt)
return !ferror(stdout);
case WRITE_JSON:
print_args.print_hex = print_hex;
- write_json_proto_tree(&print_args, jsonfilter, edt, stdout);
+ write_json_proto_tree(&print_args, protocolfilter, edt, stdout);
printf("\n");
return !ferror(stdout);
case WRITE_EK:
print_args.print_hex = print_hex;
- write_ek_proto_tree(&print_args, jsonfilter, edt, stdout);
+ write_ek_proto_tree(&print_args, protocolfilter, edt, stdout);
printf("\n");
return !ferror(stdout);
}