1、WhiteList新增testWhiteListCommandJudge方法,判断指令是否命中白名单

existWhiteListObject方法根据规则id,判断规则是否命中白名单还有待完善
This commit is contained in:
Hao Miao
2024-01-11 17:08:10 +08:00
parent 930ba8b5ac
commit 6a24e4a692
5 changed files with 125 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
package com.realtime.protection.server.whitelist;
import com.realtime.protection.configuration.entity.task.Command;
import com.realtime.protection.configuration.entity.whitelist.WhiteListObject;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -63,12 +64,24 @@ class WhiteListServiceTest {
@Test
void testExistWhiteList() {
List<Integer> ruleIds = List.of(6,7,8);
List<String> ip_list = whiteListService.existWhiteListObject(ruleIds);
System.out.println(ip_list);
// List<String> ip_list = whiteListService.existWhiteListObject(ruleIds);
// System.out.println(ip_list);
}
@Test
void testUpdateWhiteListAuditStatus() {
whiteListService.updateWhiteListObjectAuditStatus(7, 1);
}
@Test
void testWhiteListCommandJudge() {
Command command = new Command();
command.setDestinationIP("128.1.1.123");
command.setMaskDestinationIP("255.255.255.0");
command.setDestinationPort("81");
List<WhiteListObject> whitelists = whiteListService.whiteListCommandJudge(command);
System.out.println(whitelists);
}
}