增加IP virtual的测试用例。
This commit is contained in:
@@ -1462,6 +1462,106 @@
|
||||
"not_flag" : 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 170,
|
||||
"service": 0,
|
||||
"action": 0,
|
||||
"do_blacklist": 0,
|
||||
"do_log": 0,
|
||||
"effective_rage": 0,
|
||||
"user_region": "IPScan.IPv4_component.source",
|
||||
"is_valid": "no",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "ipv4_component.source",
|
||||
"regions": [
|
||||
{
|
||||
"table_type": "ip_plus",
|
||||
"table_name": "IP_PLUS_CONFIG",
|
||||
"table_content": {
|
||||
"addr_type": "ipv4",
|
||||
"saddr_format": "CIDR",
|
||||
"src_ip1": "192.168.40.10",
|
||||
"src_ip2": "0",
|
||||
"sport_format": "mask",
|
||||
"src_port1": "443",
|
||||
"src_port2": "65535",
|
||||
"daddr_format": "CIDR",
|
||||
"dst_ip1": "0.0.0.0",
|
||||
"dst_ip2": "0",
|
||||
"dport_format": "range",
|
||||
"dst_port1": "0",
|
||||
"dst_port2": "0",
|
||||
"protocol": 6,
|
||||
"direction": "double"
|
||||
}
|
||||
}
|
||||
],
|
||||
"not_flag" : 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 171,
|
||||
"service": 0,
|
||||
"action": 0,
|
||||
"do_blacklist": 0,
|
||||
"do_log": 0,
|
||||
"effective_rage": 0,
|
||||
"user_region": "IPScan.IPv4_component.destination",
|
||||
"is_valid": "no",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "ipv4_component.destination",
|
||||
"regions": [
|
||||
{
|
||||
"table_type": "ip_plus",
|
||||
"table_name": "IP_PLUS_CONFIG",
|
||||
"table_content": {
|
||||
"addr_type": "ipv4",
|
||||
"saddr_format": "CIDR",
|
||||
"src_ip1": "192.168.231.46",
|
||||
"src_ip2": "0",
|
||||
"sport_format": "mask",
|
||||
"src_port1": "25705",
|
||||
"src_port2": "65535",
|
||||
"daddr_format": "CIDR",
|
||||
"dst_ip1": "0.0.0.0",
|
||||
"dst_ip2": "0",
|
||||
"dport_format": "range",
|
||||
"dst_port1": "0",
|
||||
"dst_port2": "0",
|
||||
"protocol": 6,
|
||||
"direction": "double"
|
||||
}
|
||||
}
|
||||
],
|
||||
"not_flag" : 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 172,
|
||||
"service": 0,
|
||||
"action": 0,
|
||||
"do_blacklist": 0,
|
||||
"do_log": 0,
|
||||
"effective_rage": 0,
|
||||
"user_region": "ipv4_component.match",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name":"ipv4_component.source",
|
||||
"virtual_table":"VIRTUAL_IP_PLUS_SOURCE",
|
||||
"not_flag":0
|
||||
},
|
||||
{
|
||||
"group_name":"ipv4_component.destination",
|
||||
"virtual_table":"VIRTUAL_IP_PLUS_DESTINATION",
|
||||
"not_flag":0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"plugin_table": [
|
||||
|
||||
@@ -42,3 +42,6 @@
|
||||
20 HTTP_RESPONSE_KEYWORDS virtual KEYWORDS_TABLE --
|
||||
21 HTTP_REQUEST_HEADER virtual HTTP_SIGNATURE --
|
||||
22 HTTP_RESPONSE_HEADER virtual HTTP_SIGNATURE --
|
||||
23 VIRTUAL_IP_PLUS_TABLE virtual IP_PLUS_CONFIG --
|
||||
23 VIRTUAL_IP_PLUS_SOURCE virtual IP_PLUS_CONFIG --
|
||||
23 VIRTUAL_IP_PLUS_DESTINATION virtual IP_PLUS_CONFIG --
|
||||
@@ -703,6 +703,28 @@ TEST(IPScan, IPv4_Port)
|
||||
Maat_clean_status(&mid);
|
||||
return;
|
||||
}
|
||||
TEST(IPScan, IPv4_virtual)
|
||||
{
|
||||
int table_id=0,ret=0;
|
||||
const char* table_name="VIRTUAL_IP_PLUS_TABLE";
|
||||
struct Maat_rule_t result[4];
|
||||
scan_status_t mid=NULL;
|
||||
struct ipaddr ipv4_addr;
|
||||
struct stream_tuple4_v4 v4_addr;
|
||||
ipv4_addr_set(&ipv4_addr, &v4_addr, "192.168.40.10", 443, "192.168.231.46", 25705);
|
||||
|
||||
table_id=Maat_table_register(g_feather, table_name);
|
||||
|
||||
EXPECT_GT(table_id, 0);
|
||||
|
||||
ret=Maat_scan_proto_addr(g_feather, table_id, &ipv4_addr, 6, result, 4, &mid, 0);
|
||||
|
||||
EXPECT_EQ(ret, 1);
|
||||
EXPECT_EQ(result[0].config_id, 172);
|
||||
|
||||
Maat_clean_status(&mid);
|
||||
return;
|
||||
}
|
||||
|
||||
#define TEST_NOTLogic 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user