From bb7aff6526e47ad42c61cc25a6108014cb1a84ce Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Mon, 4 Oct 2021 22:34:49 +0200 Subject: Added -a to ndpiReader for generating OPNsense configuration See https://github.com/ntop/opnsense --- example/ndpiReader.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'example/ndpiReader.c') diff --git a/example/ndpiReader.c b/example/ndpiReader.c index d53576112..c69014843 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -459,7 +459,8 @@ static void help(u_int long_help) { "[-f ][-s ][-m ][-b ]\n" " [-p ][-l [-q][-d][-J][-h][-D][-e ][-t][-v ]\n" " [-n ][-w ][-c ][-C ][-j ][-x ]\n" - " [-r ][-j ][-S ][-T ][-U ] [-x ][-z]\n\n" + " [-r ][-j ][-S ][-T ][-U ] [-x ][-z]\n" + " [-a ]\n\n" "Usage:\n" " -i | Specify a pcap file/playlist to read packets from or a\n" " | device for live capture (comma-separated list)\n" @@ -474,6 +475,10 @@ static void help(u_int long_help) { #ifdef linux " -g | Thread affinity mask (one core id per thread)\n" #endif + " -a | Generates option values for GUIs\n" + " | 0 - List known protocols\n" + " | 1 - List known categories\n" + " | 2 - List known risks\n" " -d | Disable protocol guess and use only DPI\n" " -e | Min human readeable string match len. Default %u\n" " -q | Quiet mode\n" @@ -806,13 +811,17 @@ static void parseOptions(int argc, char **argv) { } #endif - while((opt = getopt_long(argc, argv, "b:e:c:C:dDf:g:i:Ij:S:hp:pP:l:r:s:tu:v:V:n:Jrp:x:w:zq0123:456:7:89:m:T:U:", + while((opt = getopt_long(argc, argv, "a:b:e:c:C:dDf:g:i:Ij:S:hp:pP:l:r:s:tu:v:V:n:Jrp:x:w:zq0123:456:7:89:m:T:U:", longopts, &option_idx)) != EOF) { #ifdef DEBUG_TRACE if(trace) fprintf(trace, " #### Handling option -%c [%s] #### \n", opt, optarg ? optarg : ""); #endif switch (opt) { + case 'a': + ndpi_generate_options(atoi(optarg)); + break; + case 'b': if((num_bin_clusters = atoi(optarg)) > 32) num_bin_clusters = 32; -- cgit v1.2.3