aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca <deri@ntop.org>2019-06-18 17:36:39 +0200
committerLuca <deri@ntop.org>2019-06-18 17:36:39 +0200
commit5f26149938e1465d75159b71ddbbdb8673ffa508 (patch)
treee9ffb9f80e48d3d7af16db45b9298b74c0940319
parent41b75485eba80485eb3b5b8ae6f7f90d5f44e47e (diff)
Added DHCP fingerpring handling
-rw-r--r--example/ndpiReader.c1
-rw-r--r--example/ndpi_util.c5
-rw-r--r--example/ndpi_util.h1
3 files changed, 5 insertions, 2 deletions
diff --git a/example/ndpiReader.c b/example/ndpiReader.c
index 87d86eaa0..25886af31 100644
--- a/example/ndpiReader.c
+++ b/example/ndpiReader.c
@@ -848,6 +848,7 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
if(flow->ssh_ssl.server_cipher != '\0') fprintf(out, "[%s]", ndpi_cipher2str(flow->ssh_ssl.server_cipher));;
if(flow->bittorent_hash[0] != '\0') fprintf(out, "[BT Hash: %s]", flow->bittorent_hash);
+ if(flow->dhcp_fingerprint[0] != '\0') fprintf(out, "[DHCP Fingerprint: %s]", flow->dhcp_fingerprint);
fprintf(out, "\n");
} else {
diff --git a/example/ndpi_util.c b/example/ndpi_util.c
index 896332e08..c8e0130ff 100644
--- a/example/ndpi_util.c
+++ b/example/ndpi_util.c
@@ -530,8 +530,9 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
snprintf(flow->host_server_name, sizeof(flow->host_server_name), "%s",
flow->ndpi_flow->host_server_name);
- /* BITTORRENT */
- if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_BITTORRENT) {
+ if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_DHCP) {
+ snprintf(flow->dhcp_fingerprint, sizeof(flow->dhcp_fingerprint), "%s", flow->ndpi_flow->protos.dhcp.fingerprint);
+ } else if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_BITTORRENT) {
u_int i, j, n = 0;
for(i=0, j = 0; j < sizeof(flow->bittorent_hash)-1; i++) {
diff --git a/example/ndpi_util.h b/example/ndpi_util.h
index 301647b1c..dfcc98a72 100644
--- a/example/ndpi_util.h
+++ b/example/ndpi_util.h
@@ -95,6 +95,7 @@ typedef struct ndpi_flow_info {
char info[96];
char host_server_name[256];
char bittorent_hash[41];
+ char dhcp_fingerprint[48];
struct {
u_int16_t ssl_version;