/src/ndpi/src/lib/protocols/kakaotalk_voice.c
Line | Count | Source |
1 | | /* |
2 | | * kakaotalk_voice.c |
3 | | * |
4 | | * Copyright (C) 2015-22 - ntop.org |
5 | | * |
6 | | * This module is free software: you can redistribute it and/or modify |
7 | | * it under the terms of the GNU Lesser General Public License as published by |
8 | | * the Free Software Foundation, either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * This module is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU Lesser General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU Lesser General Public License. |
17 | | * If not, see <http://www.gnu.org/licenses/>. |
18 | | * |
19 | | */ |
20 | | |
21 | | |
22 | | /* |
23 | | KakaoTalk (call only) |
24 | | |
25 | | http://www.kakao.com/services/talk/voices |
26 | | */ |
27 | | #include "ndpi_protocol_ids.h" |
28 | | |
29 | | #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KAKAOTALK_VOICE |
30 | | |
31 | | #include "ndpi_api.h" |
32 | | #include "ndpi_private.h" |
33 | | |
34 | | |
35 | 553k | static void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { |
36 | 553k | struct ndpi_packet_struct *packet = &ndpi_struct->packet; |
37 | | |
38 | 553k | NDPI_LOG_DBG(ndpi_struct, "search kakaotalk_voice\n"); |
39 | | |
40 | 553k | if(packet->iph |
41 | 553k | && packet->udp |
42 | 553k | && (packet->payload_packet_len >= 4) |
43 | 553k | ) { |
44 | 512k | if((packet->payload[0] == 0x81) |
45 | 512k | || (packet->payload[1] == 0xC8) |
46 | 512k | || (packet->payload[2] == 0x00) |
47 | 512k | || (packet->payload[3] == 0x0C)) { |
48 | | /* Looks good so far */ |
49 | | |
50 | | /* |
51 | | inetnum: 1.201.0.0 - 1.201.255.255 |
52 | | netname: KINXINC-KR |
53 | | */ |
54 | | |
55 | 198k | if(((ntohl(packet->iph->saddr) & 0xFFFF0000 /* 255.255.0.0 */) == 0x01C90000 /* 1.201.0.0/16 */) |
56 | 198k | || ((ntohl(packet->iph->daddr) & 0xFFFF0000 /* 255.255.0.0 */) == 0x01C90000 /* 1.201.0.0/16 */)) { |
57 | 373 | NDPI_LOG_INFO(ndpi_struct, "found kakaotalk_voice\n"); |
58 | 373 | ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_KAKAOTALK_VOICE, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); |
59 | 373 | return; |
60 | 373 | } |
61 | 198k | } |
62 | 512k | } |
63 | | |
64 | 553k | NDPI_EXCLUDE_DISSECTOR(ndpi_struct, flow); |
65 | 553k | } |
66 | | |
67 | | |
68 | | void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_struct) |
69 | 15.4k | { |
70 | 15.4k | register_dissector("KakaoTalk_Voice", ndpi_struct, |
71 | 15.4k | ndpi_search_kakaotalk_voice, |
72 | 15.4k | NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD, |
73 | 15.4k | 1, NDPI_PROTOCOL_KAKAOTALK_VOICE); |
74 | 15.4k | } |
75 | | |