-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Automatic Tank Gauge protocol (ntop#2527)
See also ntop#2523 --------- Co-authored-by: Nardi Ivan <[email protected]>
- Loading branch information
Showing
116 changed files
with
224 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* atg.c | ||
* | ||
* Copyright (C) 2024 - ntop.org | ||
* | ||
* nDPI is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* nDPI is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include "ndpi_protocol_ids.h" | ||
|
||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ATG | ||
|
||
#include "ndpi_api.h" | ||
#include "ndpi_private.h" | ||
|
||
static void ndpi_int_atg_add_connection(struct ndpi_detection_module_struct | ||
*ndpi_struct, struct ndpi_flow_struct *flow) { | ||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ATG, | ||
NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI); | ||
} | ||
|
||
|
||
static void ndpi_search_atg(struct ndpi_detection_module_struct *ndpi_struct, | ||
struct ndpi_flow_struct *flow) { | ||
struct ndpi_packet_struct *packet = &ndpi_struct->packet; | ||
|
||
NDPI_LOG_DBG(ndpi_struct, "search for ATG\n"); | ||
|
||
if(packet->payload_packet_len >= 8) { | ||
u_int16_t atg_port = ntohs(10001); | ||
|
||
if((packet->tcp->source == atg_port) || (packet->tcp->dest == atg_port)) { | ||
if(packet->payload[0] == 0x01 && | ||
(packet->payload[1] == 0x49 || packet->payload[1] == 0x69 || packet->payload[1] == 0x53 || packet->payload[1] == 0x73 ) && | ||
memcmp(&packet->payload[packet->payload_packet_len - 2], "\r\n", 2) == 0) { | ||
NDPI_LOG_INFO(ndpi_struct, "found atg\n"); | ||
ndpi_int_atg_add_connection(ndpi_struct, flow); | ||
return; | ||
} | ||
} | ||
} | ||
|
||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow); | ||
} | ||
|
||
void init_atg_dissector(struct ndpi_detection_module_struct *ndpi_struct, | ||
u_int32_t *id) { | ||
ndpi_set_bitmask_protocol_detection("ATG", ndpi_struct, *id, | ||
NDPI_PROTOCOL_ATG, | ||
ndpi_search_atg, | ||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION, | ||
SAVE_DETECTION_BITMASK_AS_UNKNOWN, | ||
ADD_TO_DETECTION_BITMASK); | ||
*id += 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
DPI Packets (TCP): 5 (2.50 pkts/flow) | ||
Confidence DPI : 2 (flows) | ||
Num dissector calls: 308 (154.00 diss/flow) | ||
LRU cache ookla: 0/0/0 (insert/search/found) | ||
LRU cache bittorrent: 0/0/0 (insert/search/found) | ||
LRU cache stun: 0/0/0 (insert/search/found) | ||
LRU cache tls_cert: 0/0/0 (insert/search/found) | ||
LRU cache mining: 0/0/0 (insert/search/found) | ||
LRU cache msteams: 0/0/0 (insert/search/found) | ||
LRU cache fpc_dns: 0/1/0 (insert/search/found) | ||
Automa host: 0/0 (search/found) | ||
Automa domain: 0/0 (search/found) | ||
Automa tls cert: 0/0 (search/found) | ||
Automa risk mask: 0/0 (search/found) | ||
Automa common alpns: 0/0 (search/found) | ||
Patricia risk mask: 2/0 (search/found) | ||
Patricia risk mask IPv6: 0/0 (search/found) | ||
Patricia risk: 0/0 (search/found) | ||
Patricia risk IPv6: 0/0 (search/found) | ||
Patricia protocols: 2/2 (search/found) | ||
Patricia protocols IPv6: 0/0 (search/found) | ||
|
||
ATG 31 2976 2 | ||
|
||
Acceptable 31 2976 2 | ||
|
||
1 TCP 192.168.0.105:3148 <-> 20.108.25.119:10001 [proto: 423/ATG][IP: 276/Azure][ClearText][Confidence: DPI][FPC: 276/Azure, Confidence: IP address][DPI packets: 4][cat: IoT-Scada/31][14 pkts/986 bytes <-> 8 pkts/1304 bytes][Goodput ratio: 5/59][157.76 sec][bytes ratio: -0.139 (Mixed)][IAT c2s/s2c min/avg/max/stddev: 256/2 12561/20187 58945/59439 18236/20472][Pkt Len c2s/s2c min/avg/max/stddev: 66/66 70/163 75/509 4/160][PLAIN TEXT (08/19/2024 02)][Plen Bins: 83,0,0,0,0,0,0,0,0,8,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] | ||
2 TCP 192.168.0.105:3134 -> 20.108.25.119:10001 [proto: 423/ATG][IP: 276/Azure][ClearText][Confidence: DPI][FPC: 423/ATG, Confidence: DPI][DPI packets: 1][cat: IoT-Scada/31][9 pkts/686 bytes -> 0 pkts/0 bytes][Goodput ratio: 13/0][74.58 sec][bytes ratio: 1.000 (Upload)][IAT c2s/s2c min/avg/max/stddev: 979/0 9322/0 37119/0 11869/0][Pkt Len c2s/s2c min/avg/max/stddev: 71/0 76/0 80/0 3/0][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.