nDPi now finally honours dissection of HTTP responses
This commit is contained in:
+125
-132
@@ -375,229 +375,229 @@ struct ndpi_id_struct {
|
|||||||
to compare this, use:
|
to compare this, use:
|
||||||
**/
|
**/
|
||||||
NDPI_PROTOCOL_BITMASK detected_protocol_bitmask;
|
NDPI_PROTOCOL_BITMASK detected_protocol_bitmask;
|
||||||
/* NDPI_PROTOCOL_RTSP */
|
/* NDPI_PROTOCOL_RTSP */
|
||||||
ndpi_ip_addr_t rtsp_ip_address;
|
ndpi_ip_addr_t rtsp_ip_address;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t yahoo_video_lan_timer;
|
u_int32_t yahoo_video_lan_timer;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */
|
/* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */
|
||||||
/* NDPI_PROTOCOL_IRC */
|
/* NDPI_PROTOCOL_IRC */
|
||||||
#define NDPI_PROTOCOL_IRC_MAXPORT 8
|
#define NDPI_PROTOCOL_IRC_MAXPORT 8
|
||||||
u_int16_t irc_port[NDPI_PROTOCOL_IRC_MAXPORT];
|
u_int16_t irc_port[NDPI_PROTOCOL_IRC_MAXPORT];
|
||||||
u_int32_t last_time_port_used[NDPI_PROTOCOL_IRC_MAXPORT];
|
u_int32_t last_time_port_used[NDPI_PROTOCOL_IRC_MAXPORT];
|
||||||
u_int32_t irc_ts;
|
u_int32_t irc_ts;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_GNUTELLA */
|
/* NDPI_PROTOCOL_GNUTELLA */
|
||||||
u_int32_t gnutella_ts;
|
u_int32_t gnutella_ts;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_BATTLEFIELD */
|
/* NDPI_PROTOCOL_BATTLEFIELD */
|
||||||
u_int32_t battlefield_ts;
|
u_int32_t battlefield_ts;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_THUNDER */
|
/* NDPI_PROTOCOL_THUNDER */
|
||||||
u_int32_t thunder_ts;
|
u_int32_t thunder_ts;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTSP */
|
/* NDPI_PROTOCOL_RTSP */
|
||||||
u_int32_t rtsp_timer;
|
u_int32_t rtsp_timer;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_OSCAR */
|
/* NDPI_PROTOCOL_OSCAR */
|
||||||
u_int32_t oscar_last_safe_access_time;
|
u_int32_t oscar_last_safe_access_time;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_ZATTOO */
|
/* NDPI_PROTOCOL_ZATTOO */
|
||||||
u_int32_t zattoo_ts;
|
u_int32_t zattoo_ts;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
|
/* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
|
||||||
u_int32_t jabber_stun_or_ft_ts;
|
u_int32_t jabber_stun_or_ft_ts;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
||||||
u_int32_t directconnect_last_safe_access_time;
|
u_int32_t directconnect_last_safe_access_time;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SOULSEEK */
|
/* NDPI_PROTOCOL_SOULSEEK */
|
||||||
u_int32_t soulseek_last_safe_access_time;
|
u_int32_t soulseek_last_safe_access_time;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
||||||
u_int16_t detected_directconnect_port;
|
u_int16_t detected_directconnect_port;
|
||||||
u_int16_t detected_directconnect_udp_port;
|
u_int16_t detected_directconnect_udp_port;
|
||||||
u_int16_t detected_directconnect_ssl_port;
|
u_int16_t detected_directconnect_ssl_port;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_BITTORRENT */
|
/* NDPI_PROTOCOL_BITTORRENT */
|
||||||
#define NDPI_BT_PORTS 8
|
#define NDPI_BT_PORTS 8
|
||||||
u_int16_t bt_port_t[NDPI_BT_PORTS];
|
u_int16_t bt_port_t[NDPI_BT_PORTS];
|
||||||
u_int16_t bt_port_u[NDPI_BT_PORTS];
|
u_int16_t bt_port_u[NDPI_BT_PORTS];
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
|
/* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
|
||||||
#define JABBER_MAX_STUN_PORTS 6
|
#define JABBER_MAX_STUN_PORTS 6
|
||||||
u_int16_t jabber_voice_stun_port[JABBER_MAX_STUN_PORTS];
|
u_int16_t jabber_voice_stun_port[JABBER_MAX_STUN_PORTS];
|
||||||
u_int16_t jabber_file_transfer_port[2];
|
u_int16_t jabber_file_transfer_port[2];
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_GNUTELLA */
|
/* NDPI_PROTOCOL_GNUTELLA */
|
||||||
u_int16_t detected_gnutella_port;
|
u_int16_t detected_gnutella_port;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_GNUTELLA */
|
/* NDPI_PROTOCOL_GNUTELLA */
|
||||||
u_int16_t detected_gnutella_udp_port1;
|
u_int16_t detected_gnutella_udp_port1;
|
||||||
u_int16_t detected_gnutella_udp_port2;
|
u_int16_t detected_gnutella_udp_port2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SOULSEEK */
|
/* NDPI_PROTOCOL_SOULSEEK */
|
||||||
u_int16_t soulseek_listen_port;
|
u_int16_t soulseek_listen_port;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_IRC */
|
/* NDPI_PROTOCOL_IRC */
|
||||||
u_int8_t irc_number_of_port;
|
u_int8_t irc_number_of_port;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_OSCAR */
|
/* NDPI_PROTOCOL_OSCAR */
|
||||||
u_int8_t oscar_ssl_session_id[33];
|
u_int8_t oscar_ssl_session_id[33];
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
|
/* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
|
||||||
u_int8_t jabber_voice_stun_used_ports;
|
u_int8_t jabber_voice_stun_used_ports;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SIP */
|
/* NDPI_PROTOCOL_SIP */
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t yahoo_video_lan_dir:1;
|
u_int32_t yahoo_video_lan_dir:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t yahoo_conf_logged_in:1;
|
u_int32_t yahoo_conf_logged_in:1;
|
||||||
u_int32_t yahoo_voice_conf_logged_in:1;
|
u_int32_t yahoo_voice_conf_logged_in:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTSP */
|
/* NDPI_PROTOCOL_RTSP */
|
||||||
u_int32_t rtsp_ts_set:1;
|
u_int32_t rtsp_ts_set:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ************************************************** */
|
/* ************************************************** */
|
||||||
|
|
||||||
struct ndpi_flow_tcp_struct {
|
struct ndpi_flow_tcp_struct {
|
||||||
/* NDPI_PROTOCOL_MAIL_SMTP */
|
/* NDPI_PROTOCOL_MAIL_SMTP */
|
||||||
u_int16_t smtp_command_bitmask;
|
u_int16_t smtp_command_bitmask;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_MAIL_POP */
|
/* NDPI_PROTOCOL_MAIL_POP */
|
||||||
u_int16_t pop_command_bitmask;
|
u_int16_t pop_command_bitmask;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_QQ */
|
/* NDPI_PROTOCOL_QQ */
|
||||||
u_int16_t qq_nxt_len;
|
u_int16_t qq_nxt_len;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_WHATSAPP */
|
/* NDPI_PROTOCOL_WHATSAPP */
|
||||||
u_int8_t wa_matched_so_far;
|
u_int8_t wa_matched_so_far;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TDS */
|
/* NDPI_PROTOCOL_TDS */
|
||||||
u_int8_t tds_login_version;
|
u_int8_t tds_login_version;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_IRC */
|
/* NDPI_PROTOCOL_IRC */
|
||||||
u_int8_t irc_stage;
|
u_int8_t irc_stage;
|
||||||
u_int8_t irc_port;
|
u_int8_t irc_port;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_H323 */
|
/* NDPI_PROTOCOL_H323 */
|
||||||
u_int8_t h323_valid_packets;
|
u_int8_t h323_valid_packets;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_GNUTELLA */
|
/* NDPI_PROTOCOL_GNUTELLA */
|
||||||
u_int8_t gnutella_msg_id[3];
|
u_int8_t gnutella_msg_id[3];
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_IRC */
|
/* NDPI_PROTOCOL_IRC */
|
||||||
u_int32_t irc_3a_counter:3;
|
u_int32_t irc_3a_counter:3;
|
||||||
u_int32_t irc_stage2:5;
|
u_int32_t irc_stage2:5;
|
||||||
u_int32_t irc_direction:2;
|
u_int32_t irc_direction:2;
|
||||||
u_int32_t irc_0x1000_full:1;
|
u_int32_t irc_0x1000_full:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SOULSEEK */
|
/* NDPI_PROTOCOL_SOULSEEK */
|
||||||
u_int32_t soulseek_stage:2;
|
u_int32_t soulseek_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TDS */
|
/* NDPI_PROTOCOL_TDS */
|
||||||
u_int32_t tds_stage:3;
|
u_int32_t tds_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_USENET */
|
/* NDPI_PROTOCOL_USENET */
|
||||||
u_int32_t usenet_stage:2;
|
u_int32_t usenet_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_IMESH */
|
/* NDPI_PROTOCOL_IMESH */
|
||||||
u_int32_t imesh_stage:4;
|
u_int32_t imesh_stage:4;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_HTTP */
|
/* NDPI_PROTOCOL_HTTP */
|
||||||
u_int32_t http_setup_dir:2;
|
u_int32_t http_setup_dir:2;
|
||||||
u_int32_t http_stage:2;
|
u_int32_t http_stage:2;
|
||||||
u_int32_t http_empty_line_seen:1;
|
u_int32_t http_empty_line_seen:1;
|
||||||
u_int32_t http_wait_for_retransmission:1;
|
u_int32_t http_wait_for_retransmission:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_GNUTELLA */
|
/* NDPI_PROTOCOL_GNUTELLA */
|
||||||
u_int32_t gnutella_stage:2; // 0 - 2
|
u_int32_t gnutella_stage:2; // 0 - 2
|
||||||
|
|
||||||
/* NDPI_CONTENT_MMS */
|
/* NDPI_CONTENT_MMS */
|
||||||
u_int32_t mms_stage:2;
|
u_int32_t mms_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t yahoo_sip_comm:1;
|
u_int32_t yahoo_sip_comm:1;
|
||||||
u_int32_t yahoo_http_proxy_stage:2;
|
u_int32_t yahoo_http_proxy_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_MSN */
|
/* NDPI_PROTOCOL_MSN */
|
||||||
u_int32_t msn_stage:3;
|
u_int32_t msn_stage:3;
|
||||||
u_int32_t msn_ssl_ft:2;
|
u_int32_t msn_ssl_ft:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SSH */
|
/* NDPI_PROTOCOL_SSH */
|
||||||
u_int32_t ssh_stage:3;
|
u_int32_t ssh_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_VNC */
|
/* NDPI_PROTOCOL_VNC */
|
||||||
u_int32_t vnc_stage:2; // 0 - 3
|
u_int32_t vnc_stage:2; // 0 - 3
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TELNET */
|
/* NDPI_PROTOCOL_TELNET */
|
||||||
u_int32_t telnet_stage:2; // 0 - 2
|
u_int32_t telnet_stage:2; // 0 - 2
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SSL */
|
/* NDPI_PROTOCOL_SSL */
|
||||||
u_int8_t ssl_seen_client_cert:1, ssl_seen_server_cert:1, ssl_stage:2; // 0 - 5
|
u_int8_t ssl_seen_client_cert:1, ssl_seen_server_cert:1, ssl_stage:2; // 0 - 5
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_POSTGRES */
|
/* NDPI_PROTOCOL_POSTGRES */
|
||||||
u_int32_t postgres_stage:3;
|
u_int32_t postgres_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK */
|
/* NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK */
|
||||||
u_int32_t ddlink_server_direction:1;
|
u_int32_t ddlink_server_direction:1;
|
||||||
u_int32_t seen_syn:1;
|
u_int32_t seen_syn:1;
|
||||||
u_int32_t seen_syn_ack:1;
|
u_int32_t seen_syn_ack:1;
|
||||||
u_int32_t seen_ack:1;
|
u_int32_t seen_ack:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_ICECAST */
|
/* NDPI_PROTOCOL_ICECAST */
|
||||||
u_int32_t icecast_stage:1;
|
u_int32_t icecast_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_DOFUS */
|
/* NDPI_PROTOCOL_DOFUS */
|
||||||
u_int32_t dofus_stage:1;
|
u_int32_t dofus_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_FIESTA */
|
/* NDPI_PROTOCOL_FIESTA */
|
||||||
u_int32_t fiesta_stage:2;
|
u_int32_t fiesta_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_WORLDOFWARCRAFT */
|
/* NDPI_PROTOCOL_WORLDOFWARCRAFT */
|
||||||
u_int32_t wow_stage:2;
|
u_int32_t wow_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV */
|
/* NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV */
|
||||||
u_int32_t veoh_tv_stage:2;
|
u_int32_t veoh_tv_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SHOUTCAST */
|
/* NDPI_PROTOCOL_SHOUTCAST */
|
||||||
u_int32_t shoutcast_stage:2;
|
u_int32_t shoutcast_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTP */
|
/* NDPI_PROTOCOL_RTP */
|
||||||
u_int32_t rtp_special_packets_seen:1;
|
u_int32_t rtp_special_packets_seen:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_MAIL_POP */
|
/* NDPI_PROTOCOL_MAIL_POP */
|
||||||
u_int32_t mail_pop_stage:2;
|
u_int32_t mail_pop_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_MAIL_IMAP */
|
/* NDPI_PROTOCOL_MAIL_IMAP */
|
||||||
u_int32_t mail_imap_stage:3, mail_imap_starttls:2;
|
u_int32_t mail_imap_stage:3, mail_imap_starttls:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SKYPE */
|
/* NDPI_PROTOCOL_SKYPE */
|
||||||
u_int8_t skype_packet_id;
|
u_int8_t skype_packet_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_CITRIX */
|
/* NDPI_PROTOCOL_CITRIX */
|
||||||
u_int8_t citrix_packet_id;
|
u_int8_t citrix_packet_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_LOTUS_NOTES */
|
/* NDPI_PROTOCOL_LOTUS_NOTES */
|
||||||
u_int8_t lotus_notes_packet_id;
|
u_int8_t lotus_notes_packet_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TEAMVIEWER */
|
/* NDPI_PROTOCOL_TEAMVIEWER */
|
||||||
u_int8_t teamviewer_stage;
|
u_int8_t teamviewer_stage;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_ZMQ */
|
/* NDPI_PROTOCOL_ZMQ */
|
||||||
u_int8_t prev_zmq_pkt_len;
|
u_int8_t prev_zmq_pkt_len;
|
||||||
u_char prev_zmq_pkt[10];
|
u_char prev_zmq_pkt[10];
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_PPSTREAM */
|
/* NDPI_PROTOCOL_PPSTREAM */
|
||||||
u_int32_t ppstream_stage:3;
|
u_int32_t ppstream_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_MEMCACHED */
|
/* NDPI_PROTOCOL_MEMCACHED */
|
||||||
u_int8_t memcached_matches;
|
u_int8_t memcached_matches;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_NEST_LOG_SINK */
|
/* NDPI_PROTOCOL_NEST_LOG_SINK */
|
||||||
u_int8_t nest_log_sink_matches;
|
u_int8_t nest_log_sink_matches;
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@@ -608,51 +608,51 @@ struct ndpi_flow_tcp_struct {
|
|||||||
/* ************************************************** */
|
/* ************************************************** */
|
||||||
|
|
||||||
struct ndpi_flow_udp_struct {
|
struct ndpi_flow_udp_struct {
|
||||||
/* NDPI_PROTOCOL_BATTLEFIELD */
|
/* NDPI_PROTOCOL_BATTLEFIELD */
|
||||||
u_int32_t battlefield_msg_id;
|
u_int32_t battlefield_msg_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SNMP */
|
/* NDPI_PROTOCOL_SNMP */
|
||||||
u_int32_t snmp_msg_id;
|
u_int32_t snmp_msg_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_BATTLEFIELD */
|
/* NDPI_PROTOCOL_BATTLEFIELD */
|
||||||
u_int32_t battlefield_stage:3;
|
u_int32_t battlefield_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SNMP */
|
/* NDPI_PROTOCOL_SNMP */
|
||||||
u_int32_t snmp_stage:2;
|
u_int32_t snmp_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_PPSTREAM */
|
/* NDPI_PROTOCOL_PPSTREAM */
|
||||||
u_int32_t ppstream_stage:3; // 0 - 7
|
u_int32_t ppstream_stage:3; // 0 - 7
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_HALFLIFE2 */
|
/* NDPI_PROTOCOL_HALFLIFE2 */
|
||||||
u_int32_t halflife2_stage:2; // 0 - 2
|
u_int32_t halflife2_stage:2; // 0 - 2
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TFTP */
|
/* NDPI_PROTOCOL_TFTP */
|
||||||
u_int32_t tftp_stage:1;
|
u_int32_t tftp_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_AIMINI */
|
/* NDPI_PROTOCOL_AIMINI */
|
||||||
u_int32_t aimini_stage:5;
|
u_int32_t aimini_stage:5;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_XBOX */
|
/* NDPI_PROTOCOL_XBOX */
|
||||||
u_int32_t xbox_stage:1;
|
u_int32_t xbox_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_WINDOWS_UPDATE */
|
/* NDPI_PROTOCOL_WINDOWS_UPDATE */
|
||||||
u_int32_t wsus_stage:1;
|
u_int32_t wsus_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SKYPE */
|
/* NDPI_PROTOCOL_SKYPE */
|
||||||
u_int8_t skype_packet_id;
|
u_int8_t skype_packet_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TEAMVIEWER */
|
/* NDPI_PROTOCOL_TEAMVIEWER */
|
||||||
u_int8_t teamviewer_stage;
|
u_int8_t teamviewer_stage;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_EAQ */
|
/* NDPI_PROTOCOL_EAQ */
|
||||||
u_int8_t eaq_pkt_id;
|
u_int8_t eaq_pkt_id;
|
||||||
u_int32_t eaq_sequence;
|
u_int32_t eaq_sequence;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RX */
|
/* NDPI_PROTOCOL_RX */
|
||||||
u_int32_t rx_conn_epoch;
|
u_int32_t rx_conn_epoch;
|
||||||
u_int32_t rx_conn_id;
|
u_int32_t rx_conn_id;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_MEMCACHED */
|
/* NDPI_PROTOCOL_MEMCACHED */
|
||||||
u_int8_t memcached_matches;
|
u_int8_t memcached_matches;
|
||||||
}
|
}
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
@@ -986,13 +986,13 @@ struct ndpi_detection_module_struct {
|
|||||||
char ip_string[NDPI_IP_STRING_SIZE];
|
char ip_string[NDPI_IP_STRING_SIZE];
|
||||||
#endif
|
#endif
|
||||||
u_int8_t ip_version_limit;
|
u_int8_t ip_version_limit;
|
||||||
/* NDPI_PROTOCOL_BITTORRENT */
|
/* NDPI_PROTOCOL_BITTORRENT */
|
||||||
struct hash_ip4p_table *bt_ht;
|
struct hash_ip4p_table *bt_ht;
|
||||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||||
struct hash_ip4p_table *bt6_ht;
|
struct hash_ip4p_table *bt6_ht;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* BT_ANNOUNCE */
|
/* BT_ANNOUNCE */
|
||||||
struct bt_announce *bt_ann;
|
struct bt_announce *bt_ann;
|
||||||
int bt_ann_len;
|
int bt_ann_len;
|
||||||
|
|
||||||
@@ -1131,90 +1131,83 @@ struct ndpi_flow_struct {
|
|||||||
|
|
||||||
ndpi_protocol_category_t category;
|
ndpi_protocol_category_t category;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_REDIS */
|
/* NDPI_PROTOCOL_REDIS */
|
||||||
u_int8_t redis_s2d_first_char, redis_d2s_first_char;
|
u_int8_t redis_s2d_first_char, redis_d2s_first_char;
|
||||||
|
|
||||||
u_int16_t packet_counter; // can be 0 - 65000
|
u_int16_t packet_counter; // can be 0 - 65000
|
||||||
u_int16_t packet_direction_counter[2];
|
u_int16_t packet_direction_counter[2];
|
||||||
u_int16_t byte_counter[2];
|
u_int16_t byte_counter[2];
|
||||||
/* NDPI_PROTOCOL_BITTORRENT */
|
/* NDPI_PROTOCOL_BITTORRENT */
|
||||||
u_int8_t bittorrent_stage; // can be 0 - 255
|
u_int8_t bittorrent_stage; // can be 0 - 255
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
/* NDPI_PROTOCOL_DIRECTCONNECT */
|
||||||
u_int32_t directconnect_stage:2; // 0 - 1
|
u_int8_t directconnect_stage:2; // 0 - 1
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t sip_yahoo_voice:1;
|
u_int8_t sip_yahoo_voice:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_HTTP */
|
/* NDPI_PROTOCOL_HTTP */
|
||||||
u_int32_t http_detected:1;
|
u_int8_t http_detected:1;
|
||||||
|
u_int16_t http_upper_protocol, http_lower_protocol;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTSP */
|
/* NDPI_PROTOCOL_RTSP */
|
||||||
u_int32_t rtsprdt_stage:2;
|
u_int8_t rtsprdt_stage:2, rtsp_control_flow:1;
|
||||||
u_int32_t rtsp_control_flow:1;
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_YAHOO */
|
/* NDPI_PROTOCOL_YAHOO */
|
||||||
u_int32_t yahoo_detection_finished:2;
|
u_int8_t yahoo_detection_finished:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_ZATTOO */
|
/* NDPI_PROTOCOL_ZATTOO */
|
||||||
u_int32_t zattoo_stage:3;
|
u_int8_t zattoo_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_QQ */
|
/* NDPI_PROTOCOL_QQ */
|
||||||
u_int32_t qq_stage:3;
|
u_int8_t qq_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_THUNDER */
|
/* NDPI_PROTOCOL_THUNDER */
|
||||||
u_int32_t thunder_stage:2; // 0 - 3
|
u_int8_t thunder_stage:2; // 0 - 3
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_OSCAR */
|
/* NDPI_PROTOCOL_OSCAR */
|
||||||
u_int32_t oscar_ssl_voice_stage:3;
|
u_int8_t oscar_ssl_voice_stage:3, oscar_video_voice:1;
|
||||||
u_int32_t oscar_video_voice:1;
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_FLORENSIA */
|
/* NDPI_PROTOCOL_FLORENSIA */
|
||||||
u_int32_t florensia_stage:1;
|
u_int8_t florensia_stage:1;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_SOCKS */
|
/* NDPI_PROTOCOL_SOCKS */
|
||||||
u_int32_t socks5_stage:2; // 0 - 3
|
u_int8_t socks5_stage:2, socks4_stage:2; // 0 - 3
|
||||||
u_int32_t socks4_stage:2; // 0 - 3
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_EDONKEY */
|
/* NDPI_PROTOCOL_EDONKEY */
|
||||||
u_int32_t edonkey_stage:2; // 0 - 3
|
u_int8_t edonkey_stage:2; // 0 - 3
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_FTP_CONTROL */
|
/* NDPI_PROTOCOL_FTP_CONTROL */
|
||||||
u_int32_t ftp_control_stage:2;
|
u_int8_t ftp_control_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_RTMP */
|
/* NDPI_PROTOCOL_RTMP */
|
||||||
u_int32_t rtmp_stage:2;
|
u_int8_t rtmp_stage:2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_PANDO */
|
/* NDPI_PROTOCOL_PANDO */
|
||||||
u_int32_t pando_stage:3;
|
u_int8_t pando_stage:3;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_STEAM */
|
/* NDPI_PROTOCOL_STEAM */
|
||||||
u_int32_t steam_stage:3;
|
u_int16_t steam_stage:3, steam_stage1:3, steam_stage2:2, steam_stage3:2;
|
||||||
u_int32_t steam_stage1:3; // 0 - 4
|
|
||||||
u_int32_t steam_stage2:2; // 0 - 2
|
|
||||||
u_int32_t steam_stage3:2; // 0 - 2
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_PPLIVE */
|
/* NDPI_PROTOCOL_PPLIVE */
|
||||||
u_int32_t pplive_stage1:3; // 0 - 6
|
u_int8_t pplive_stage1:3, pplive_stage2:2, pplive_stage3:2;
|
||||||
u_int32_t pplive_stage2:2; // 0 - 2
|
|
||||||
u_int32_t pplive_stage3:2; // 0 - 2
|
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_STARCRAFT */
|
/* NDPI_PROTOCOL_STARCRAFT */
|
||||||
u_int32_t starcraft_udp_stage : 3; // 0-7
|
u_int8_t starcraft_udp_stage : 3; // 0-7
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_OPENVPN */
|
/* NDPI_PROTOCOL_OPENVPN */
|
||||||
u_int8_t ovpn_session_id[8];
|
u_int8_t ovpn_session_id[8];
|
||||||
u_int8_t ovpn_counter;
|
u_int8_t ovpn_counter;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_TINC */
|
/* NDPI_PROTOCOL_TINC */
|
||||||
u_int8_t tinc_state;
|
u_int8_t tinc_state;
|
||||||
struct tinc_cache_entry tinc_cache_entry;
|
struct tinc_cache_entry tinc_cache_entry;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_CSGO */
|
/* NDPI_PROTOCOL_CSGO */
|
||||||
u_int8_t csgo_strid[18],csgo_state,csgo_s2;
|
u_int8_t csgo_strid[18],csgo_state,csgo_s2;
|
||||||
u_int32_t csgo_id2;
|
u_int32_t csgo_id2;
|
||||||
|
|
||||||
/* NDPI_PROTOCOL_1KXUN || NDPI_PROTOCOL_IQIYI */
|
/* NDPI_PROTOCOL_1KXUN || NDPI_PROTOCOL_IQIYI */
|
||||||
u_int16_t kxun_counter, iqiyi_counter;
|
u_int16_t kxun_counter, iqiyi_counter;
|
||||||
|
|
||||||
/* internal structures to save functions calls */
|
/* internal structures to save functions calls */
|
||||||
|
|||||||
+5
-10
@@ -3901,8 +3901,7 @@ void check_ndpi_tcp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
if((proto_id != NDPI_PROTOCOL_UNKNOWN)
|
if((proto_id != NDPI_PROTOCOL_UNKNOWN)
|
||||||
&& NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
|
&& NDPI_BITMASK_COMPARE(flow->excluded_protocol_bitmask,
|
||||||
ndpi_struct->callback_buffer[proto_index].excluded_protocol_bitmask) == 0
|
ndpi_struct->callback_buffer[proto_index].excluded_protocol_bitmask) == 0
|
||||||
&& NDPI_BITMASK_COMPARE(ndpi_struct->callback_buffer[proto_index].detection_bitmask,
|
&& NDPI_BITMASK_COMPARE(ndpi_struct->callback_buffer[proto_index].detection_bitmask, detection_bitmask) != 0
|
||||||
detection_bitmask) != 0
|
|
||||||
&& (ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask & *ndpi_selection_packet) == ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask) {
|
&& (ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask & *ndpi_selection_packet) == ndpi_struct->callback_buffer[proto_index].ndpi_selection_bitmask) {
|
||||||
if((flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN)
|
if((flow->guessed_protocol_id != NDPI_PROTOCOL_UNKNOWN)
|
||||||
&& (ndpi_struct->proto_defaults[flow->guessed_protocol_id].func != NULL))
|
&& (ndpi_struct->proto_defaults[flow->guessed_protocol_id].func != NULL))
|
||||||
@@ -3920,7 +3919,6 @@ void check_ndpi_tcp_flow_func(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
detection_bitmask) != 0) {
|
detection_bitmask) != 0) {
|
||||||
ndpi_struct->callback_buffer_tcp_payload[a].func(ndpi_struct, flow);
|
ndpi_struct->callback_buffer_tcp_payload[a].func(ndpi_struct, flow);
|
||||||
|
|
||||||
|
|
||||||
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
|
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN)
|
||||||
break; /* Stop after detecting the first protocol */
|
break; /* Stop after detecting the first protocol */
|
||||||
}
|
}
|
||||||
@@ -4731,14 +4729,13 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
{
|
{
|
||||||
u_int32_t a;
|
u_int32_t a;
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
if(packet->packet_lines_parsed_complete != 0)
|
if(packet->packet_lines_parsed_complete != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
packet->packet_lines_parsed_complete = 1;
|
packet->packet_lines_parsed_complete = 1;
|
||||||
packet->parsed_lines = 0;
|
packet->parsed_lines = 0;
|
||||||
|
|
||||||
packet->empty_line_position_set = 0;
|
packet->empty_line_position_set = 0;
|
||||||
|
|
||||||
packet->host_line.ptr = NULL;
|
packet->host_line.ptr = NULL;
|
||||||
packet->host_line.len = 0;
|
packet->host_line.len = 0;
|
||||||
packet->referer_line.ptr = NULL;
|
packet->referer_line.ptr = NULL;
|
||||||
@@ -4779,7 +4776,6 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
packet->line[packet->parsed_lines].len = 0;
|
packet->line[packet->parsed_lines].len = 0;
|
||||||
|
|
||||||
for(a = 0; a < packet->payload_packet_len; a++) {
|
for(a = 0; a < packet->payload_packet_len; a++) {
|
||||||
|
|
||||||
if((a + 1) == packet->payload_packet_len)
|
if((a + 1) == packet->payload_packet_len)
|
||||||
return; /* Return if only one byte remains (prevent invalid reads past end-of-buffer) */
|
return; /* Return if only one byte remains (prevent invalid reads past end-of-buffer) */
|
||||||
|
|
||||||
@@ -4791,19 +4787,19 @@ void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struc
|
|||||||
strncasecmp((const char *)packet->line[0].ptr, "HTTP/1.", NDPI_STATICSTRING_LEN("HTTP/1.")) == 0 &&
|
strncasecmp((const char *)packet->line[0].ptr, "HTTP/1.", NDPI_STATICSTRING_LEN("HTTP/1.")) == 0 &&
|
||||||
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] > '0' && /* response code between 000 and 699 */
|
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] > '0' && /* response code between 000 and 699 */
|
||||||
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] < '6') {
|
packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.X ")] < '6') {
|
||||||
|
|
||||||
packet->http_response.ptr = &packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.1 ")];
|
packet->http_response.ptr = &packet->line[0].ptr[NDPI_STATICSTRING_LEN("HTTP/1.1 ")];
|
||||||
packet->http_response.len = packet->line[0].len - NDPI_STATICSTRING_LEN("HTTP/1.1 ");
|
packet->http_response.len = packet->line[0].len - NDPI_STATICSTRING_LEN("HTTP/1.1 ");
|
||||||
packet->http_num_headers++;
|
packet->http_num_headers++;
|
||||||
|
|
||||||
/* Set server HTTP response code */
|
/* Set server HTTP response code */
|
||||||
strncpy((char*)flow->http.response_status_code, (char*)packet->http_response.ptr, 3);
|
strncpy((char*)flow->http.response_status_code, (char*)packet->http_response.ptr, 3);
|
||||||
flow->http.response_status_code[4]='\0';
|
flow->http.response_status_code[4] = '\0';
|
||||||
|
|
||||||
NDPI_LOG_DBG2(ndpi_struct,
|
NDPI_LOG_DBG2(ndpi_struct,
|
||||||
"ndpi_parse_packet_line_info: HTTP response parsed: \"%.*s\"\n",
|
"ndpi_parse_packet_line_info: HTTP response parsed: \"%.*s\"\n",
|
||||||
packet->http_response.len, packet->http_response.ptr);
|
packet->http_response.len, packet->http_response.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "Server:" header line in HTTP response */
|
/* "Server:" header line in HTTP response */
|
||||||
if(packet->line[packet->parsed_lines].len > NDPI_STATICSTRING_LEN("Server:") + 1
|
if(packet->line[packet->parsed_lines].len > NDPI_STATICSTRING_LEN("Server:") + 1
|
||||||
&& strncasecmp((const char *)packet->line[packet->parsed_lines].ptr, "Server:", NDPI_STATICSTRING_LEN("Server:")) == 0) {
|
&& strncasecmp((const char *)packet->line[packet->parsed_lines].ptr, "Server:", NDPI_STATICSTRING_LEN("Server:")) == 0) {
|
||||||
@@ -5253,10 +5249,9 @@ void ndpi_int_reset_protocol(struct ndpi_flow_struct *flow) {
|
|||||||
if(flow) {
|
if(flow) {
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
for(a = 0; a < NDPI_PROTOCOL_SIZE; a++) {
|
for(a = 0; a < NDPI_PROTOCOL_SIZE; a++)
|
||||||
flow->detected_protocol_stack[a] = NDPI_PROTOCOL_UNKNOWN;
|
flow->detected_protocol_stack[a] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********************************************************************************* */
|
/* ********************************************************************************* */
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ static void ndpi_check_apple_push(struct ndpi_detection_module_struct *ndpi_stru
|
|||||||
struct ndpi_flow_struct *flow) {
|
struct ndpi_flow_struct *flow) {
|
||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
|
if(packet->iph) {
|
||||||
/* https://support.apple.com/en-us/HT203609 */
|
/* https://support.apple.com/en-us/HT203609 */
|
||||||
if(((ntohl(packet->iph->saddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)
|
if(((ntohl(packet->iph->saddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)
|
||||||
|| ((ntohl(packet->iph->daddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)) {
|
|| ((ntohl(packet->iph->daddr) & 0xFF000000 /* 255.0.0.0 */) == 0x11000000 /* 17.0.0.0/8 */)) {
|
||||||
@@ -47,6 +48,7 @@ static void ndpi_check_apple_push(struct ndpi_detection_module_struct *ndpi_stru
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-12
@@ -28,11 +28,13 @@
|
|||||||
#include "ndpi_api.h"
|
#include "ndpi_api.h"
|
||||||
#include "lruc.h"
|
#include "lruc.h"
|
||||||
|
|
||||||
/* global variables used for 1kxun protocol and iqiyi service */
|
|
||||||
|
|
||||||
static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
struct ndpi_flow_struct *flow,
|
struct ndpi_flow_struct *flow,
|
||||||
u_int16_t category) {
|
u_int16_t category) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("[%s] [http_dont_dissect_response: %u]->> %s\n", __FUNCTION__,
|
||||||
|
ndpi_struct->http_dont_dissect_response, flow->http.response_status_code);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||||
/* This is HTTP and it is not a sub protocol (e.g. skype or dropbox) */
|
/* This is HTTP and it is not a sub protocol (e.g. skype or dropbox) */
|
||||||
@@ -40,15 +42,27 @@ static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *nd
|
|||||||
ndpi_search_tcp_or_udp(ndpi_struct, flow);
|
ndpi_search_tcp_or_udp(ndpi_struct, flow);
|
||||||
|
|
||||||
/* If no custom protocol has been detected */
|
/* If no custom protocol has been detected */
|
||||||
|
|
||||||
if(flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
|
if(flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
|
||||||
ndpi_int_reset_protocol(flow);
|
ndpi_int_reset_protocol(flow);
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, NDPI_PROTOCOL_HTTP);
|
flow->http_upper_protocol = flow->guessed_host_protocol_id, flow->http_lower_protocol = NDPI_PROTOCOL_HTTP;
|
||||||
} else
|
} else
|
||||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP, NDPI_PROTOCOL_UNKNOWN);
|
flow->http_upper_protocol = NDPI_PROTOCOL_HTTP, flow->http_lower_protocol = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
|
||||||
|
if(ndpi_struct->http_dont_dissect_response)
|
||||||
|
ndpi_set_detected_protocol(ndpi_struct, flow, flow->http_upper_protocol, flow->http_lower_protocol);
|
||||||
|
else {
|
||||||
|
flow->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
flow->packet.detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->packet.detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if((!ndpi_struct->http_dont_dissect_response) && (flow->http.response_status_code[0] == '\0')) {
|
||||||
|
flow->http_upper_protocol = flow->detected_protocol_stack[0], flow->http_lower_protocol = flow->detected_protocol_stack[1];
|
||||||
|
flow->detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
flow->packet.detected_protocol_stack[0] = NDPI_PROTOCOL_UNKNOWN, flow->packet.detected_protocol_stack[1] = NDPI_PROTOCOL_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
flow->http_detected = 1, flow->guessed_category = category;
|
flow->http_detected = 1, flow->guessed_category = category;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NDPI_CONTENT_CATEGORY_FLASH
|
#ifdef NDPI_CONTENT_CATEGORY_FLASH
|
||||||
@@ -198,6 +212,13 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
u_int8_t a;
|
u_int8_t a;
|
||||||
|
|
||||||
|
if((!ndpi_struct->http_dont_dissect_response) && flow->http_detected && (flow->http.response_status_code[0] != 0)) {
|
||||||
|
ndpi_set_detected_protocol(ndpi_struct, flow, flow->http_upper_protocol, flow->http_lower_protocol);
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("[%s] [http_dont_dissect_response: %u]->> %s\n", __FUNCTION__, ndpi_struct->http_dont_dissect_response, flow->http.response_status_code);
|
||||||
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(NDPI_PROTOCOL_1KXUN) || defined(NDPI_PROTOCOL_IQIYI)
|
#if defined(NDPI_PROTOCOL_1KXUN) || defined(NDPI_PROTOCOL_IQIYI)
|
||||||
/* PPStream */
|
/* PPStream */
|
||||||
@@ -378,7 +399,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ndpi_struct->http_dont_dissect_response)
|
if(!ndpi_struct->http_dont_dissect_response)
|
||||||
parseHttpSubprotocol(ndpi_struct, flow);
|
parseHttpSubprotocol(ndpi_struct, flow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -421,8 +442,10 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if(!ndpi_struct->http_dont_dissect_response && flow->http_detected)
|
if(!ndpi_struct->http_dont_dissect_response && flow->http_detected)
|
||||||
parseHttpSubprotocol(ndpi_struct, flow);
|
parseHttpSubprotocol(ndpi_struct, flow);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN)
|
if(flow->guessed_protocol_id == NDPI_PROTOCOL_UNKNOWN)
|
||||||
flow->guessed_protocol_id = NDPI_PROTOCOL_HTTP;
|
flow->guessed_protocol_id = NDPI_PROTOCOL_HTTP;
|
||||||
@@ -458,6 +481,8 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
|||||||
&ret_match, NDPI_PROTOCOL_HTTP);
|
&ret_match, NDPI_PROTOCOL_HTTP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ndpi_int_http_add_connection(ndpi_struct, flow, packet->detected_protocol_stack[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||||
@@ -676,7 +701,6 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
/* Set the first found headers in request */
|
/* Set the first found headers in request */
|
||||||
flow->http.num_request_headers = packet->http_num_headers;
|
flow->http.num_request_headers = packet->http_num_headers;
|
||||||
|
|
||||||
|
|
||||||
/* Check for Ookla */
|
/* Check for Ookla */
|
||||||
if((packet->referer_line.len > 0)
|
if((packet->referer_line.len > 0)
|
||||||
&& ndpi_strnstr((const char *)packet->referer_line.ptr, "www.speedtest.net", packet->referer_line.len)) {
|
&& ndpi_strnstr((const char *)packet->referer_line.ptr, "www.speedtest.net", packet->referer_line.len)) {
|
||||||
@@ -790,9 +814,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
|
|
||||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||||
http_bitmask_exclude_other(flow);
|
http_bitmask_exclude_other(flow);
|
||||||
|
|
||||||
} else if((flow->l4.tcp.http_stage == 1) || (flow->l4.tcp.http_stage == 2)) {
|
} else if((flow->l4.tcp.http_stage == 1) || (flow->l4.tcp.http_stage == 2)) {
|
||||||
|
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "HTTP stage %u: \n", flow->l4.tcp.http_stage);
|
NDPI_LOG_DBG2(ndpi_struct, "HTTP stage %u: \n", flow->l4.tcp.http_stage);
|
||||||
|
|
||||||
if((packet->payload_packet_len == 34) && (flow->l4.tcp.http_stage == 1)) {
|
if((packet->payload_packet_len == 34) && (flow->l4.tcp.http_stage == 1)) {
|
||||||
@@ -879,9 +901,8 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
|||||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||||
check_content_type_and_change_protocol(ndpi_struct, flow);
|
check_content_type_and_change_protocol(ndpi_struct, flow);
|
||||||
|
|
||||||
if(packet->packet_direction == 1 /* server -> client */){
|
if(packet->packet_direction == 1 /* server -> client */)
|
||||||
flow->http.num_response_headers += packet->http_num_headers; /* flow structs are initialized with zeros */
|
flow->http.num_response_headers += packet->http_num_headers; /* flow structs are initialized with zeros */
|
||||||
}
|
|
||||||
|
|
||||||
if(packet->empty_line_position_set != 0 || flow->l4.tcp.http_empty_line_seen == 1) {
|
if(packet->empty_line_position_set != 0 || flow->l4.tcp.http_empty_line_seen == 1) {
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "empty line. check_http_payload\n");
|
NDPI_LOG_DBG2(ndpi_struct, "empty line. check_http_payload\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user