From ad82dfd5547e460359eb3597ddb6760a29c40439 Mon Sep 17 00:00:00 2001 From: Jim Young Date: Tue, 14 Jul 2015 00:28:49 -0400 Subject: 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 ) instead of having to specify --disable-protocol multiple times. Change-Id: I9b8f960acf75298ebb098d9b667fca49dca52306 Reviewed-on: https://code.wireshark.org/review/9631 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- wireshark-qt.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'wireshark-qt.cpp') diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index cac303197d..28ce67fd2a 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -216,6 +216,12 @@ print_usage(gboolean for_help_option) { fprintf(output, " -R packet filter in Wireshark display filter syntax\n"); fprintf(output, " -n disable all name resolutions (def: all enabled)\n"); fprintf(output, " -N enable specific name resolution(s): \"mntC\"\n"); + fprintf(output, " --disable-protocol \n"); + fprintf(output, " disable dissection of proto_name\n"); + fprintf(output, " --enable-heuristic \n"); + fprintf(output, " enable dissection of heuristic protocol\n"); + fprintf(output, " --disable-heuristic \n"); + fprintf(output, " disable dissection of heuristic protocol\n"); fprintf(output, "\n"); fprintf(output, "User interface:\n"); @@ -467,6 +473,9 @@ int main(int argc, char *argv[]) guint go_to_packet = 0; QString dfilter, read_filter; + GSList *disable_protocol_slist = NULL; + GSList *enable_heur_slist = NULL; + GSList *disable_heur_slist = NULL; cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont); @@ -1093,6 +1102,16 @@ DIAG_ON(cast-qual) exit(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 */ print_usage(FALSE); @@ -1293,6 +1312,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_column_format_array(&CaptureFile::globalCapFile()->cinfo, prefs_p->num_cols, TRUE); wsApp->emitAppSignal(WiresharkApplication::ColumnsChanged); // We read "recent" widths above. wsApp->emitAppSignal(WiresharkApplication::RecentFilesRead); // Must be emitted after PreferencesChanged. -- cgit v1.2.3