diff options
author | Jim Young <jyoung@gsu.edu> | 2015-07-14 00:28:49 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-07-17 11:27:52 +0000 |
commit | ad82dfd5547e460359eb3597ddb6760a29c40439 (patch) | |
tree | 7e13c660c502985fef6eb075e5efe09c5e020d9a /tshark.c | |
parent | 9d24a26c9b8c78260fca9c4f6ecf480e12010229 (diff) |
Add new long options to GUIs to allow arbitrary protocols and heuristics to be disabled via command-line
Future: Allow multiple protocols to be disabled in one option statement
(perhaps using a comma or colon delmited set of names in <proto_name>)
instead of having to specify --disable-protocol <proto_name> multiple times.
Change-Id: I9b8f960acf75298ebb098d9b667fca49dca52306
Reviewed-on: https://code.wireshark.org/review/9631
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -351,6 +351,12 @@ print_usage(FILE *output) fprintf(output, " Example: tcp.port==8888,http\n"); fprintf(output, " -H <hosts file> read a list of entries from a hosts file, which will\n"); fprintf(output, " then be written to a capture file. (Implies -W n)\n"); + fprintf(output, " --disable-protocol <proto_name>\n"); + fprintf(output, " disable dissection of proto_name\n"); + fprintf(output, " --enable-heuristic <short_name>\n"); + fprintf(output, " enable dissection of heuristic protocol\n"); + fprintf(output, " --disable-heuristic <short_name>\n"); + fprintf(output, " disable dissection of heuristic protocol\n"); /*fprintf(output, "\n");*/ fprintf(output, "Output:\n"); @@ -1003,6 +1009,9 @@ DIAG_ON(cast-qual) char badopt; int log_flags; gchar *output_only = NULL; + GSList *disable_protocol_slist = NULL; + GSList *enable_heur_slist = NULL; + GSList *disable_heur_slist = NULL; /* * The leading + ensures that getopt_long() does not permute the argv[] @@ -1702,6 +1711,16 @@ DIAG_ON(cast-qual) return 1; } break; + case LONGOPT_DISABLE_PROTOCOL: /* disable dissection of protocol */ + disable_protocol_slist = g_slist_append(disable_protocol_slist, optarg); + break; + case LONGOPT_ENABLE_HEURISTIC: /* enable heuristic dissection of protocol */ + enable_heur_slist = g_slist_append(enable_heur_slist, optarg); + break; + case LONGOPT_DISABLE_HEURISTIC: /* disable heuristic dissection of protocol */ + disable_heur_slist = g_slist_append(disable_heur_slist, optarg); + break; + default: case '?': /* Bad flag - print usage message */ switch(optopt) { @@ -2032,6 +2051,30 @@ DIAG_ON(cast-qual) set_disabled_heur_dissector_list(); } + if(disable_protocol_slist) { + GSList *proto_disable; + for (proto_disable = disable_protocol_slist; proto_disable != NULL; proto_disable = g_slist_next(proto_disable)) + { + proto_disable_proto_by_name((char*)proto_disable->data); + } + } + + if(enable_heur_slist) { + GSList *heur_enable; + for (heur_enable = enable_heur_slist; heur_enable != NULL; heur_enable = g_slist_next(heur_enable)) + { + proto_enable_heuristic_by_name((char*)heur_enable->data, TRUE); + } + } + + if(disable_heur_slist) { + GSList *heur_disable; + for (heur_disable = disable_heur_slist; heur_disable != NULL; heur_disable = g_slist_next(heur_disable)) + { + proto_enable_heuristic_by_name((char*)heur_disable->data, FALSE); + } + } + /* Build the column format array */ build_column_format_array(&cfile.cinfo, prefs_p->num_cols, TRUE); |