diff options
author | Yağmur Oymak <yagmur.oymak@gmail.com> | 2019-07-24 19:16:44 +0300 |
---|---|---|
committer | Yağmur Oymak <yagmur.oymak@gmail.com> | 2019-07-24 19:16:44 +0300 |
commit | 786ea3c0f9d862546c56bed15fce574eec3991ee (patch) | |
tree | 9eb7a590d309bf433ac41caf18c9f2b0103bad22 /example | |
parent | 9a899c54c927bb6012ed39e42c9be9cd9c4c7151 (diff) | |
parent | 21485683475ab6b3bb4468f142843d5f15f412f8 (diff) |
Merge branch 'dev' into wireguard
Conflicts:
src/include/ndpi_protocols.h
src/lib/ndpi_main.c
Get upstream developments.
Diffstat (limited to 'example')
-rw-r--r-- | example/Makefile.in | 3 | ||||
-rw-r--r-- | example/ndpiReader.c | 14 | ||||
-rw-r--r-- | example/protos.txt | 10 | ||||
-rw-r--r-- | example/reader_util.c | 5 |
4 files changed, 23 insertions, 9 deletions
diff --git a/example/Makefile.in b/example/Makefile.in index 258c2d7b3..84abab219 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -16,7 +16,10 @@ ndpiReader: $(OBJS) $(LIBNDPI) install: mkdir -p $(DESTDIR)$(PREFIX)/bin/ + mkdir -p $(DESTDIR)$(PREFIX)/sbin/ndpi cp ndpiReader $(DESTDIR)$(PREFIX)/bin/ + cp protos.txt $(DESTDIR)$(PREFIX)/sbin/ndpi/ndpiProtos.txt + cp mining_hosts.txt $(DESTDIR)$(PREFIX)/sbin/ndpi/ndpiCustomCategory.txt [ -f build/app/ndpiReader.dpdk ] && cp build/app/ndpiReader.dpdk $(DESTDIR)$(PREFIX)/bin/ || true [ -f ndpiReader.dpdk ] && cp ndpiReader.dpdk $(DESTDIR)$(PREFIX)/bin/ || true diff --git a/example/ndpiReader.c b/example/ndpiReader.c index e5c031865..32321aa94 100644 --- a/example/ndpiReader.c +++ b/example/ndpiReader.c @@ -89,6 +89,7 @@ static u_int8_t stats_flag = 0, bpf_filter_flag = 0; #ifdef HAVE_JSON_C static u_int8_t file_first_time = 1; #endif +u_int8_t human_readeable_string_len = 5; static u_int32_t pcap_analysis_duration = (u_int32_t)-1; static u_int16_t decode_tunnels = 0; static u_int16_t num_loops = 1; @@ -235,7 +236,7 @@ static void help(u_int long_help) { "-i <file|device> " #endif "[-f <filter>][-s <duration>][-m <duration>]\n" - " [-p <protos>][-l <loops> [-q][-d][-h][-t][-v <level>]\n" + " [-p <protos>][-l <loops> [-q][-d][-h][-e <len>][-t][-v <level>]\n" " [-n <threads>][-w <file>][-c <file>][-j <file>][-x <file>]\n\n" "Usage:\n" " -i <file.pcap|device> | Specify a pcap file/playlist to read packets from or a\n" @@ -252,6 +253,7 @@ static void help(u_int long_help) { " -g <id:id...> | Thread affinity mask (one core id per thread)\n" #endif " -d | Disable protocol guess and use only DPI\n" + " -e <len> | Min human readeable string match len. Default %u\n" " -q | Quiet mode\n" " -t | Dissect GTP/TZSP tunnels\n" " -r | Print nDPI version and git revision\n" @@ -268,8 +270,8 @@ static void help(u_int long_help) { " | >3 - full debug + dbg_proto = all\n" " -b <file.json> | Specify a file to write port based diagnose statistics\n" " -x <file.json> | Produce bpf filters for specified diagnose file. Use\n" - " | this option only for .json files generated with -b flag.\n"); - + " | this option only for .json files generated with -b flag.\n", + human_readeable_string_len); #ifndef WIN32 printf("\nExcap (wireshark) options:\n" @@ -475,7 +477,7 @@ static void parseOptions(int argc, char **argv) { } #endif - while((opt = getopt_long(argc, argv, "c:df:g:i:hp:l:s:tv:V:n:j:rp:w:q0123:456:7:89:m:b:x:", longopts, &option_idx)) != EOF) { + while((opt = getopt_long(argc, argv, "e:c:df:g:i:hp:l:s:tv:V:n:j:rp:w:q0123:456:7:89:m:b:x:", longopts, &option_idx)) != EOF) { #ifdef DEBUG_TRACE if(trace) fprintf(trace, " #### -%c [%s] #### \n", opt, optarg ? optarg : ""); #endif @@ -485,6 +487,10 @@ static void parseOptions(int argc, char **argv) { enable_protocol_guess = 0; break; + case 'e': + human_readeable_string_len = atoi(optarg); + break; + case 'i': case '3': _pcap_file[0] = optarg; diff --git a/example/protos.txt b/example/protos.txt index b3f24ddb5..a840c8545 100644 --- a/example/protos.txt +++ b/example/protos.txt @@ -14,11 +14,15 @@ host:"googlesyndication.com"@Google host:"venere.com"@Venere host:"kataweb.it",host:"repubblica.it"@Repubblica host:"ntop"@ntop +host:"atv-ext.amazon.com",host:"*.api.amazon.com",host:"*.api.amazonvideo.com"@AmazonVideo +host:"*.amazonaws.com"@AmazonVideo +host:"*.netflix.com"@Netflix +host:"*.lvlt.dash.us.aiv-cdn.net.c.footprint.net"@AmazonVideo +host:"api-global.netflix.com"@Netflix # IP based Subprotocols # Format: # ip:<value>,ip:<value>,.....@<subproto> ip:213.75.170.11@CustomProtocol - - - +ip:8.248.73.247@AmazonPrime +ip:54.80.47.130@AmazonPrime diff --git a/example/reader_util.c b/example/reader_util.c index 9b03d1278..d0ec31930 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -75,7 +75,7 @@ #include "reader_util.h" extern u_int8_t enable_protocol_guess; -extern u_int8_t verbose; +extern u_int8_t verbose, human_readeable_string_len; /* ***************************************************** */ @@ -668,7 +668,8 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow, if(!skip) { char outbuf[64] = { '\0' }; - if(ndpi_has_human_readeable_string(workflow->ndpi_struct, (char*)packet, header->caplen, 8, + if(ndpi_has_human_readeable_string(workflow->ndpi_struct, (char*)packet, header->caplen, + human_readeable_string_len, flow->human_readeable_string_buffer, sizeof(flow->human_readeable_string_buffer)) == 1) flow->has_human_readeable_strings = 1; |