diff options
author | Luca <deri@ntop.org> | 2019-06-18 17:44:05 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2019-06-18 17:44:05 +0200 |
commit | 4830aa9a141ec7506d27feccd8c8dd1891fcd0a1 (patch) | |
tree | c8c7aee003fa8706df89e661782e619813d67804 | |
parent | 5f26149938e1465d75159b71ddbbdb8673ffa508 (diff) |
DHCP fingerprint is now in human readeable format
-rw-r--r-- | src/lib/protocols/dhcp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/protocols/dhcp.c b/src/lib/protocols/dhcp.c index 52415946b..14959bae8 100644 --- a/src/lib/protocols/dhcp.c +++ b/src/lib/protocols/dhcp.c @@ -104,10 +104,15 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru u_int idx, offset = 0; for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) { - snprintf((char*)&flow->protos.dhcp.fingerprint[offset], - sizeof(flow->protos.dhcp.fingerprint) - offset, - "%02X", dhcp->options[i+2+idx] & 0xFF); - offset += 2; +#if 1 + offset += snprintf((char*)&flow->protos.dhcp.fingerprint[offset], + sizeof(flow->protos.dhcp.fingerprint) - offset, + "%s%u", (idx > 0) ? "," : "", dhcp->options[i+2+idx] & 0xFF); +#else + offset += snprintf((char*)&flow->protos.dhcp.fingerprint[offset], + sizeof(flow->protos.dhcp.fingerprint) - offset, + "%02X", dhcp->options[i+2+idx] & 0xFF); +#endif } flow->protos.dhcp.fingerprint[sizeof(flow->protos.dhcp.fingerprint) - 1] = '\0'; |