diff options
author | Luca Deri <deri@ntop.org> | 2015-08-13 12:44:47 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2015-08-13 12:44:47 +0200 |
commit | a0bef995b68d1825c6e9a19fcbf604ef76580c51 (patch) | |
tree | 24e84130b10915d9c42c34a6e9ff3e792efb9977 /src/lib/ndpi_main.c | |
parent | d6b5d8e2c2da5481ccfbd084bcc21a5ccb8da3f6 (diff) |
Initial work for supporting HotspotShield VPN detection
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index f88651443..9514a5943 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -1164,6 +1164,11 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp no_master, "WorldOfWarcraft", ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); + ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_SERVICE_HOTSPOT_SHIELD, + no_master, + no_master, "HotspotShield", + ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */, + ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */); ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_UNSAFE, NDPI_PROTOCOL_TELNET, no_master, no_master, "Telnet", @@ -3411,6 +3416,22 @@ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct } else ret.protocol = flow->detected_protocol_stack[0]; + + if((ret.master_protocol == NDPI_PROTOCOL_UNKNOWN) && flow->packet.iph) { + struct ndpi_packet_struct *packet = &flow->packet; + + if((ret.master_protocol = ndpi_network_ptree_match(ndpi_struct, (struct in_addr *)&packet->iph->saddr)) == NDPI_PROTOCOL_UNKNOWN) + ret.master_protocol = ndpi_network_ptree_match(ndpi_struct, (struct in_addr *)&packet->iph->daddr); + + /* Swap proocols in case of success */ + if(ret.master_protocol != NDPI_PROTOCOL_UNKNOWN) { + u_int8_t t = ret.master_protocol; + + ret.master_protocol = ret.protocol; + ret.protocol = t; + } + } + return(ret); } |