diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index 7a9d567..b2aada9 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -2736,7 +2736,7 @@ void cache_write(const struct tfe_http_session * session, enum tfe_http_event ev int http_ip_subscribe_id_scan(struct Maat_rule_t *result, const char* sip, const char* dip, int hit_cnt, unsigned int thread_id, struct pangu_http_ctx * ctx) { - int scan_ret=0; + int scan_ret=0, hit_cnt_ip=0; char* source_subscribe_id=NULL, *dest_subscribe_id=NULL; source_subscribe_id=(char*)Maat_plugin_get_EX_data(g_pangu_rt->dyn_maat, g_pangu_rt->subscriber_id_table_id, sip); @@ -2750,7 +2750,7 @@ int http_ip_subscribe_id_scan(struct Maat_rule_t *result, const char* sip, const &(ctx->scan_mid), (int) thread_id); if(scan_ret>0) { - hit_cnt+=scan_ret; + hit_cnt_ip+=scan_ret; } } if(dest_subscribe_id!=NULL) @@ -2761,19 +2761,19 @@ int http_ip_subscribe_id_scan(struct Maat_rule_t *result, const char* sip, const &(ctx->scan_mid), (int) thread_id); if(scan_ret>0) { - hit_cnt+=scan_ret; + hit_cnt_ip+=scan_ret; } } if(source_subscribe_id!=NULL) free(source_subscribe_id); if(dest_subscribe_id!=NULL) free(dest_subscribe_id); - return hit_cnt; + return hit_cnt_ip; } int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, struct ip_address *dip, int hit_cnt, unsigned int thread_id, struct pangu_http_ctx * ctx ) { - int scan_ret=0; + int scan_ret=0, hit_cnt_ip=0; char buff[TFE_STRING_MAX]={0}; struct ip_data_table* ip_location_client=NULL, *ip_location_server=NULL; @@ -2798,7 +2798,7 @@ int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, st &(ctx->scan_mid), (int) thread_id); if(scan_ret>0) { - hit_cnt+=scan_ret; + hit_cnt_ip+=scan_ret; } memset(buff,0,sizeof(buff)); snprintf(buff, sizeof(buff), "%s,%s,%s", ip_location_server->city_full, ip_location_server->province_full, ip_location_server->country_full); @@ -2813,7 +2813,7 @@ int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, st &(ctx->scan_mid), (int) thread_id); if(scan_ret>0) { - hit_cnt+=scan_ret; + hit_cnt_ip+=scan_ret; } memset(buff,0,sizeof(buff)); snprintf(buff, sizeof(buff), "%s,%s,%s", ip_location_client->city_full, ip_location_client->province_full, ip_location_client->country_full); @@ -2824,12 +2824,12 @@ int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, st ip_table_free(ip_location_server); if(ip_location_client) ip_table_free(ip_location_client); - return hit_cnt; + return hit_cnt_ip; } int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct ip_address* dip, int hit_cnt, unsigned int thread_id, struct pangu_http_ctx * ctx) { - int scan_ret=0; + int scan_ret=0, hit_cnt_ip=0; char buff[TFE_STRING_MAX]={0}; struct ip_data_table* ip_asn_client=NULL, *ip_asn_server=NULL; @@ -2854,7 +2854,7 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct if(scan_ret>0) { - hit_cnt+=scan_ret; + hit_cnt_ip+=scan_ret; } snprintf(buff, sizeof(buff), "%s(%s)", ip_asn_server->asn, ip_asn_server->organization); ctx->ip_ctx.asn_server=tfe_strdup(buff); @@ -2867,7 +2867,7 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct &(ctx->scan_mid), (int) thread_id); if(scan_ret>0) { - hit_cnt+=scan_ret; + hit_cnt_ip+=scan_ret; } snprintf(buff, sizeof(buff), "%s(%s)", ip_asn_client->asn, ip_asn_client->organization); ctx->ip_ctx.asn_client=tfe_strdup(buff); @@ -2876,7 +2876,7 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct ip_table_free(ip_asn_server); if(ip_asn_client) ip_table_free(ip_asn_client); - return hit_cnt; + return hit_cnt_ip; } int tfe_stream_addr_to_address(const struct tfe_stream_addr *addr, struct ip_address *dest_ip, struct ip_address *source_ip) diff --git a/resource/pangu/table_info.conf b/resource/pangu/table_info.conf index 1a57fa2..8df24bc 100644 --- a/resource/pangu/table_info.conf +++ b/resource/pangu/table_info.conf @@ -47,14 +47,14 @@ 26 TSG_SECURITY_COMPILE plugin {"key":1,"valid":8} 27 PXY_PROFILE_TRAFFIC_MIRROR plugin {"key":1,"valid":4} 28 TSG_PROFILE_DECRYPTION plugin {"key":1,"valid":4} -29 TSG_IP_ASN_BUILT_IN ip_plugin {"row_id":1,"ip_type":2,"start_ip":3,"end_ip":4,"valid":7} -30 TSG_IP_ASN_USER_DEFINED ip_plugin {"row_id":1,"ip_type":2,"start_ip":3,"end_ip":4,"valid":7} -31 TSG_IP_LOCATION_BUILT_IN ip_plugin {"row_id":1,"ip_type":3,"start_ip":4,"end_ip":5,"valid":18} -32 TSG_IP_LOCATION_USER_DEFINED ip_plugin {"row_id":1,"ip_type":3,"start_ip":4,"end_ip":5,"valid":18} -33 TSG_OBJ_AS_NUMBER expr UTF8 UTF8/GBK yes 0 -34 TSG_SECURITY_SOURCE_ASN virtual TSG_OBJ_AS_NUMBER -- -35 TSG_SECURITY_DESTINATION_ASN virtual TSG_OBJ_AS_NUMBER -- -36 TSG_OBJ_GEO_LOCATION expr UTF8 UTF8/GBK yes 0 -37 TSG_SECURITY_SOURCE_LOCATION virtual TSG_OBJ_GEO_LOCATION -- -38 TSG_SECURITY_DESTINATION_LOCATION virtual TSG_OBJ_GEO_LOCATION -- +29 TSG_IP_ASN_BUILT_IN ip_plugin {"row_id":1,"ip_type":2,"start_ip":3,"end_ip":4,"valid":7,"estimate_size":4194304} +30 TSG_IP_ASN_USER_DEFINED ip_plugin {"row_id":1,"ip_type":2,"start_ip":3,"end_ip":4,"valid":7,"estimate_size":4194304} +31 TSG_IP_LOCATION_BUILT_IN ip_plugin {"row_id":1,"ip_type":3,"start_ip":4,"end_ip":5,"valid":18,"estimate_size":4194304} +32 TSG_IP_LOCATION_USER_DEFINED ip_plugin {"row_id":1,"ip_type":3,"start_ip":4,"end_ip":5,"valid":18,"estimate_size":4194304} +33 TSG_OBJ_AS_NUMBER expr UTF8 UTF8/GBK yes 0 +34 TSG_SECURITY_SOURCE_ASN virtual TSG_OBJ_AS_NUMBER -- +35 TSG_SECURITY_DESTINATION_ASN virtual TSG_OBJ_AS_NUMBER -- +36 TSG_OBJ_GEO_LOCATION expr UTF8 UTF8/GBK yes 0 +37 TSG_SECURITY_SOURCE_LOCATION virtual TSG_OBJ_GEO_LOCATION -- +38 TSG_SECURITY_DESTINATION_LOCATION virtual TSG_OBJ_GEO_LOCATION --