Merge remote-tracking branch 'origin/master' into haskafka
# Conflicts: # docker-nginx/Dockerfile # docker-springboot/Dockerfile
19
docker-doris/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM apache/incubator-doris:build-env-latest
|
||||||
|
|
||||||
|
USER root
|
||||||
|
WORKDIR /root
|
||||||
|
RUN echo '123456' | passwd root --stdin
|
||||||
|
|
||||||
|
RUN yum install -y vim net-tools man wget git mysql lsof bash-completion \
|
||||||
|
&& cp /var/local/thirdparty/installed/bin/thrift /usr/bin
|
||||||
|
|
||||||
|
# 更安全的使用,创建用户而不是使用 root
|
||||||
|
RUN yum install -y sudo \
|
||||||
|
&& useradd -ms /bin/bash endera && echo 123456 | passwd endera --stdin \
|
||||||
|
&& usermod -a -G wheel endera
|
||||||
|
|
||||||
|
USER endera
|
||||||
|
WORKDIR /home/endera
|
||||||
|
RUN git config --global color.ui true \
|
||||||
|
&& git config --global user.email "707475564@qq.com" \
|
||||||
|
&& git config --global user.name "EnderByEndera"
|
||||||
@@ -11,4 +11,4 @@ chmod +x ./gradlew
|
|||||||
./gradlew clean && ./gradlew bootJar
|
./gradlew clean && ./gradlew bootJar
|
||||||
|
|
||||||
# 启动SpringBoot服务
|
# 启动SpringBoot服务
|
||||||
./gradlew bootRun --args="--spring.profiles.active=prod"
|
./gradlew bootRun --args="--spring.profiles.active=test"
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.realtime.protection.server.alertmessage;
|
package com.realtime.protection.server.alertmessage;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.realtime.protection.configuration.entity.defense.template.ProtectLevel;
|
|
||||||
import com.realtime.protection.configuration.entity.alert.AlertMessage;
|
import com.realtime.protection.configuration.entity.alert.AlertMessage;
|
||||||
|
import com.realtime.protection.configuration.entity.defense.template.ProtectLevel;
|
||||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.realtime.protection.server.alertmessage;
|
package com.realtime.protection.server.alertmessage;
|
||||||
|
|
||||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.realtime.protection.configuration.entity.defense.template.ProtectLevel;
|
|
||||||
import com.realtime.protection.configuration.entity.alert.AlertMessage;
|
import com.realtime.protection.configuration.entity.alert.AlertMessage;
|
||||||
|
import com.realtime.protection.configuration.entity.defense.template.ProtectLevel;
|
||||||
import com.realtime.protection.configuration.entity.task.FiveTupleWithMask;
|
import com.realtime.protection.configuration.entity.task.FiveTupleWithMask;
|
||||||
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
import com.realtime.protection.configuration.entity.task.TaskCommandInfo;
|
||||||
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
import com.realtime.protection.configuration.utils.enums.StateEnum;
|
||||||
|
|||||||
@@ -70,14 +70,38 @@ public class ProtectObjectController implements ProtectObjectControllerApi {
|
|||||||
@GetMapping("/query")
|
@GetMapping("/query")
|
||||||
public ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false)
|
public ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false)
|
||||||
String protectObjectName,
|
String protectObjectName,
|
||||||
@RequestParam(value = "proobj_id", required = false) @Min(1)
|
@RequestParam(value = "proobj_id", required = false)
|
||||||
|
@Min(value = 1, message = "ID值不可小于1")
|
||||||
Integer protectObjectId,
|
Integer protectObjectId,
|
||||||
|
@RequestParam(value = "proobj_systemm_name", required = false)
|
||||||
|
String protectObjectSystemName,
|
||||||
|
@RequestParam(value = "proobj_ip_address", required = false)
|
||||||
|
String protectObjectIPAddress,
|
||||||
|
@RequestParam(value = "proobj_port_min", required = false)
|
||||||
|
Integer protectObjectPortMin,
|
||||||
|
@RequestParam(value = "proobj_port_max", required = false)
|
||||||
|
Integer protectObjectPortMax,
|
||||||
|
@RequestParam(value = "proobj_url", required = false)
|
||||||
|
String protectObjectURL,
|
||||||
|
@RequestParam(value = "proobj_protocol", required = false)
|
||||||
|
String protectObjectProtocol,
|
||||||
|
@RequestParam(value = "proobj_create_username", required = false)
|
||||||
|
String protectObjectCreateUsername,
|
||||||
|
@RequestParam(value = "proobj_audit_status", required = false)
|
||||||
|
Integer protectObjectAuditStatus,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("proobj_list", protectObjectService.queryProtectObjects(protectObjectName,
|
.setData("proobj_list", protectObjectService.queryProtectObjects(
|
||||||
protectObjectId, page, pageSize))
|
protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress,
|
||||||
.setData("total_num", protectObjectService.queryProtectObjectsTotalNum(protectObjectName, protectObjectId));
|
protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol,
|
||||||
|
protectObjectCreateUsername, protectObjectAuditStatus,
|
||||||
|
page, pageSize))
|
||||||
|
.setData("total_num", protectObjectService.queryProtectObjectsTotalNum(
|
||||||
|
protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress,
|
||||||
|
protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol,
|
||||||
|
protectObjectCreateUsername, protectObjectAuditStatus
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -158,14 +158,39 @@ public interface ProtectObjectControllerApi {
|
|||||||
parameters = {
|
parameters = {
|
||||||
@Parameter(name = "proobj_name", description = "防护对象名称"),
|
@Parameter(name = "proobj_name", description = "防护对象名称"),
|
||||||
@Parameter(name = "proobj_id", description = "防护对象ID"),
|
@Parameter(name = "proobj_id", description = "防护对象ID"),
|
||||||
|
@Parameter(name = "proobj_system_name", description = "防护对象操作系统"),
|
||||||
|
@Parameter(name = "proobj_ip_address", description = "防护对象IP地址"),
|
||||||
|
@Parameter(name = "proobj_port_min", description = "防护对象端口最小值"),
|
||||||
|
@Parameter(name = "proobj_port_max", description = "防护对象端口最大值"),
|
||||||
|
@Parameter(name = "proobj_url", description = "防护对象URL"),
|
||||||
|
@Parameter(name = "proobj_protocol", description = "防护对象网络协议"),
|
||||||
|
@Parameter(name = "proobj_create_username", description = "防护对象创建人"),
|
||||||
|
@Parameter(name = "proobj_audit_status", description = "防护对象审核状态"),
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "page_size", description = "每页的对象个数", example = "5")
|
@Parameter(name = "page_size", description = "每页的对象个数", example = "5")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false)
|
ResponseResult queryProtectObjects(@RequestParam(value = "proobj_name", required = false)
|
||||||
String protectObjectName,
|
String protectObjectName,
|
||||||
@RequestParam(value = "proobj_id", required = false) @Min(1)
|
@RequestParam(value = "proobj_id", required = false)
|
||||||
|
@Min(value = 1, message = "ID值不可小于1")
|
||||||
Integer protectObjectId,
|
Integer protectObjectId,
|
||||||
|
@RequestParam(value = "proobj_systemm_name", required = false)
|
||||||
|
String protectObjectSystemName,
|
||||||
|
@RequestParam(value = "proobj_ip_address", required = false)
|
||||||
|
String protectObjectIPAddress,
|
||||||
|
@RequestParam(value = "proobj_port_min", required = false)
|
||||||
|
Integer protectObjectPortMin,
|
||||||
|
@RequestParam(value = "proobj_port_max", required = false)
|
||||||
|
Integer protectObjectPortMax,
|
||||||
|
@RequestParam(value = "proobj_url", required = false)
|
||||||
|
String protectObjectURL,
|
||||||
|
@RequestParam(value = "proobj_protocol", required = false)
|
||||||
|
String protectObjectProtocol,
|
||||||
|
@RequestParam(value = "proobj_create_username", required = false)
|
||||||
|
String protectObjectCreateUsername,
|
||||||
|
@RequestParam(value = "proobj_audit_status", required = false)
|
||||||
|
Integer protectObjectAuditStatus,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize);
|
@RequestParam("page_size") @Min(1) Integer pageSize);
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ public interface ProtectObjectMapper {
|
|||||||
|
|
||||||
void newProtectObjects(@Param("proobjs") List<ProtectObject> protectObject);
|
void newProtectObjects(@Param("proobjs") List<ProtectObject> protectObject);
|
||||||
|
|
||||||
List<ProtectObject> queryProtectObjects(@Param("proobj_name") String protectObjectName,
|
|
||||||
@Param("proobj_id") Integer protectObjectId,
|
|
||||||
@Param("page") Integer page,
|
|
||||||
@Param("page_size") Integer pageSize);
|
|
||||||
|
|
||||||
ProtectObject queryProtectObject(@Param("proobj_id") Integer protectObjectId);
|
ProtectObject queryProtectObject(@Param("proobj_id") Integer protectObjectId);
|
||||||
|
|
||||||
@@ -30,5 +26,26 @@ public interface ProtectObjectMapper {
|
|||||||
|
|
||||||
|
|
||||||
Integer queryProtectObjectsTotalNum(@Param("proobj_name") String protectObjectName,
|
Integer queryProtectObjectsTotalNum(@Param("proobj_name") String protectObjectName,
|
||||||
@Param("proobj_id") Integer protectObjectId);
|
@Param("proobj_id") Integer protectObjectId,
|
||||||
|
@Param("proobj_system_name") String protectObjectSystemName,
|
||||||
|
@Param("proobj_ip") String protectObjectIPAddress,
|
||||||
|
@Param("proobj_port_min") Integer protectObjectPortMin,
|
||||||
|
@Param("proobj_port_max") Integer protectObjectPortMax,
|
||||||
|
@Param("proobj_url") String protectObjectURL,
|
||||||
|
@Param("proobj_protocol") String protectObjectProtocol,
|
||||||
|
@Param("proobj_username") String protectObjectCreateUsername,
|
||||||
|
@Param("proobj_audit_status") Integer protectObjectAuditStatus);
|
||||||
|
|
||||||
|
List<ProtectObject> queryProtectObjects(@Param("proobj_name") String protectObjectName,
|
||||||
|
@Param("proobj_id") Integer protectObjectId,
|
||||||
|
@Param("proobj_system_name") String protectObjectSystemName,
|
||||||
|
@Param("proobj_ip") String protectObjectIPAddress,
|
||||||
|
@Param("proobj_port_min") Integer protectObjectPortMin,
|
||||||
|
@Param("proobj_port_max") Integer protectObjectPortMax,
|
||||||
|
@Param("proobj_url") String protectObjectURL,
|
||||||
|
@Param("proobj_protocol") String protectObjectProtocol,
|
||||||
|
@Param("proobj_username") String protectObjectCreateUsername,
|
||||||
|
@Param("proobj_audit_status") Integer protectObjectAuditStatus,
|
||||||
|
@Param("page") Integer page,
|
||||||
|
@Param("page_size") Integer pageSize);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,17 @@ public class ProtectObjectService {
|
|||||||
return sqlSessionWrapper.startBatchSession(ProtectObjectMapper.class, newProtectObjectFunction, protectObjectList);
|
return sqlSessionWrapper.startBatchSession(ProtectObjectMapper.class, newProtectObjectFunction, protectObjectList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProtectObject> queryProtectObjects(String protectObjectName, Integer protectObjectId, Integer page, Integer pageSize) {
|
public List<ProtectObject> queryProtectObjects(String protectObjectName, Integer protectObjectId,
|
||||||
return protectObjectMapper.queryProtectObjects(protectObjectName, protectObjectId, page, pageSize);
|
String protectObjectSystemName, String protectObjectIPAddress,
|
||||||
|
Integer protectObjectPortMin, Integer protectObjectPortMax,
|
||||||
|
String protectObjectURL, String protectObjectProtocol,
|
||||||
|
String protectObjectCreateUsername, Integer protectObjectAuditStatus,
|
||||||
|
Integer page, Integer pageSize) {
|
||||||
|
return protectObjectMapper.queryProtectObjects(
|
||||||
|
protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress,
|
||||||
|
protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol,
|
||||||
|
protectObjectCreateUsername, protectObjectAuditStatus,
|
||||||
|
page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProtectObject queryProtectObject(Integer protectObjectId) {
|
public ProtectObject queryProtectObject(Integer protectObjectId) {
|
||||||
@@ -113,7 +122,15 @@ public class ProtectObjectService {
|
|||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryProtectObjectsTotalNum(String protectObjectName, Integer protectObjectId) {
|
public Integer queryProtectObjectsTotalNum(String protectObjectName, Integer protectObjectId,
|
||||||
return protectObjectMapper.queryProtectObjectsTotalNum(protectObjectName, protectObjectId);
|
String protectObjectSystemName, String protectObjectIPAddress,
|
||||||
|
Integer protectObjectPortMin, Integer protectObjectPortMax,
|
||||||
|
String protectObjectURL, String protectObjectProtocol,
|
||||||
|
String protectObjectCreateUsername, Integer protectObjectAuditStatus) {
|
||||||
|
return protectObjectMapper.queryProtectObjectsTotalNum(
|
||||||
|
protectObjectName, protectObjectId, protectObjectSystemName, protectObjectIPAddress,
|
||||||
|
protectObjectPortMin, protectObjectPortMax, protectObjectURL, protectObjectProtocol,
|
||||||
|
protectObjectCreateUsername, protectObjectAuditStatus
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,13 +39,18 @@ public class TemplateController implements TemplateControllerApi {
|
|||||||
@Override
|
@Override
|
||||||
@GetMapping("/query")
|
@GetMapping("/query")
|
||||||
public ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
public ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
|
@RequestParam(value = "source_system", required = false) String sourceSystem,
|
||||||
|
@RequestParam(value = "create_user_name", required = false) String createUserName,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
@RequestParam("page_size") @Min(1) Integer pageSize) {
|
||||||
List<Template> templates = templateService.queryTemplates(templateName, page, pageSize);
|
List<Template> templates = templateService.queryTemplates(
|
||||||
|
templateName, sourceSystem, createUserName,
|
||||||
|
page, pageSize
|
||||||
|
);
|
||||||
|
|
||||||
return ResponseResult.ok()
|
return ResponseResult.ok()
|
||||||
.setData("templates", templates)
|
.setData("templates", templates)
|
||||||
.setData("total_num", templateService.queryTemplateTotalNum(templateName));
|
.setData("total_num", templateService.queryTemplateTotalNum(templateName, sourceSystem, createUserName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -168,11 +168,15 @@ public interface TemplateControllerApi {
|
|||||||
},
|
},
|
||||||
parameters = {
|
parameters = {
|
||||||
@Parameter(name = "template_name", description = "防御策略模板名称", example = "DDOS"),
|
@Parameter(name = "template_name", description = "防御策略模板名称", example = "DDOS"),
|
||||||
|
@Parameter(name = "source_system", description = "策略模板来源那系统", example = "xxx系统"),
|
||||||
|
@Parameter(name = "create_user_name", description = "创建人名称", example = "xxx"),
|
||||||
@Parameter(name = "page", description = "页码", example = "1"),
|
@Parameter(name = "page", description = "页码", example = "1"),
|
||||||
@Parameter(name = "page_size", description = "每页对象数量", example = "5")
|
@Parameter(name = "page_size", description = "每页对象数量", example = "5")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
ResponseResult queryTemplates(@RequestParam(value = "template_name", required = false) String templateName,
|
||||||
|
@RequestParam(value = "source_system", required = false) String sourceSystem,
|
||||||
|
@RequestParam(value = "create_user_name", required = false) String createUserName,
|
||||||
@RequestParam("page") @Min(1) Integer page,
|
@RequestParam("page") @Min(1) Integer page,
|
||||||
@RequestParam("page_size") @Min(1) Integer pageSize);
|
@RequestParam("page_size") @Min(1) Integer pageSize);
|
||||||
|
|
||||||
@@ -379,6 +383,5 @@ public interface TemplateControllerApi {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
ResponseResult queryTemplateId(@RequestBody Map<String, String> map);
|
||||||
public ResponseResult queryTemplateId(@RequestBody Map<String,String> map);
|
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,8 @@ public interface TemplateMapper {
|
|||||||
void newProtectLevel(@Param("level") ProtectLevel protectLevel);
|
void newProtectLevel(@Param("level") ProtectLevel protectLevel);
|
||||||
|
|
||||||
List<Template> queryTemplates(@Param("template_name") String templateName,
|
List<Template> queryTemplates(@Param("template_name") String templateName,
|
||||||
|
@Param("source_system") String sourceSystem,
|
||||||
|
@Param("create_username") String createUsername,
|
||||||
@Param("page") Integer page,
|
@Param("page") Integer page,
|
||||||
@Param("page_size") Integer pageSize);
|
@Param("page_size") Integer pageSize);
|
||||||
|
|
||||||
@@ -27,7 +29,9 @@ public interface TemplateMapper {
|
|||||||
@Delete("DELETE FROM t_strategy_template WHERE strategy_template_id = #{template_id}")
|
@Delete("DELETE FROM t_strategy_template WHERE strategy_template_id = #{template_id}")
|
||||||
Boolean deleteTemplate(@Param("template_id") Integer templateId);
|
Boolean deleteTemplate(@Param("template_id") Integer templateId);
|
||||||
|
|
||||||
Integer queryTemplateTotalNum(String templateName);
|
Integer queryTemplateTotalNum(@Param("template_name") String templateName,
|
||||||
|
@Param("source_system") String sourceSystem,
|
||||||
|
@Param("create_username") String createUsername);
|
||||||
|
|
||||||
List<String> querySourceSystem();
|
List<String> querySourceSystem();
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ public class TemplateService {
|
|||||||
return template.getTemplateId();
|
return template.getTemplateId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Template> queryTemplates(String templateName, Integer page, Integer pageSize) {
|
public List<Template> queryTemplates(String templateName, String sourceSystem, String createUserName,
|
||||||
return templateMapper.queryTemplates(templateName, page, pageSize);
|
Integer page, Integer pageSize) {
|
||||||
|
return templateMapper.queryTemplates(templateName, sourceSystem, createUserName, page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean updateTemplate(Integer templateId, Template template) {
|
public Boolean updateTemplate(Integer templateId, Template template) {
|
||||||
@@ -47,8 +48,8 @@ public class TemplateService {
|
|||||||
return templateMapper.deleteTemplate(templateId);
|
return templateMapper.deleteTemplate(templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer queryTemplateTotalNum(String templateName) {
|
public Integer queryTemplateTotalNum(String templateName, String sourceSystem, String createUserName) {
|
||||||
return templateMapper.queryTemplateTotalNum(templateName);
|
return templateMapper.queryTemplateTotalNum(templateName, sourceSystem, createUserName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> querySourceSystem() {
|
public List<String> querySourceSystem() {
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -32,15 +35,16 @@ public interface StaticRuleControllerApi {
|
|||||||
implementation = ResponseResult.class),
|
implementation = ResponseResult.class),
|
||||||
examples = @ExampleObject(
|
examples = @ExampleObject(
|
||||||
name = "新增静态规则",
|
name = "新增静态规则",
|
||||||
value = "{\n" +
|
value = """
|
||||||
" \"code\": 200,\n" +
|
{
|
||||||
" \"message\": \"request succeed\",\n" +
|
"code": 200,
|
||||||
" \"data\": {\n" +
|
"message": "request succeed",
|
||||||
" \"static_rule_id\": 1095,\n" +
|
"data": {
|
||||||
" \"static_rule_name\": \"静态规则测试\"\n" +
|
"static_rule_id": 1095,
|
||||||
" }\n" +
|
"static_rule_name": "静态规则测试"
|
||||||
"}",
|
}
|
||||||
description = "static_rule_id:新增静态规则名称"+
|
}""",
|
||||||
|
description = "static_rule_id:新增静态规则名称" +
|
||||||
"static_rule_name:新增静态规则id"
|
"static_rule_name:新增静态规则id"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -49,7 +53,7 @@ public interface StaticRuleControllerApi {
|
|||||||
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
|
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||||
description = "静态规则信息")
|
description = "静态规则信息")
|
||||||
)
|
)
|
||||||
ResponseResult newStaticRuleObject(@RequestBody @Valid StaticRuleObject object) ;
|
ResponseResult newStaticRuleObject(@RequestBody @Valid StaticRuleObject object);
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "批量导入静态规则",
|
summary = "批量导入静态规则",
|
||||||
@@ -66,7 +70,7 @@ public interface StaticRuleControllerApi {
|
|||||||
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
|
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
|
||||||
description = "Excel文件")
|
description = "Excel文件")
|
||||||
)
|
)
|
||||||
ResponseResult uploadFile(@NotNull(message = "uploadFile字段不能为空")MultipartFile uploadFile) throws IOException;
|
ResponseResult uploadFile(@NotNull(message = "uploadFile字段不能为空") MultipartFile uploadFile) throws IOException;
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "下载静态规则模板",
|
summary = "下载静态规则模板",
|
||||||
@@ -81,7 +85,7 @@ public interface StaticRuleControllerApi {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
void downloadTemplate(HttpServletResponse response) throws IOException ;
|
void downloadTemplate(HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "删除静态规则",
|
summary = "删除静态规则",
|
||||||
@@ -94,17 +98,18 @@ public interface StaticRuleControllerApi {
|
|||||||
schema = @Schema(implementation = ResponseResult.class),
|
schema = @Schema(implementation = ResponseResult.class),
|
||||||
examples = @ExampleObject(
|
examples = @ExampleObject(
|
||||||
name = "删除多个静态规则",
|
name = "删除多个静态规则",
|
||||||
value = "{\n" +
|
value = """
|
||||||
" \"code\": 200,\n" +
|
{
|
||||||
" \"message\": \"request succeed\",\n" +
|
"code": 200,
|
||||||
" \"data\": {\n" +
|
"message": "request succeed",
|
||||||
" \"success\": true,\n" +
|
"data": {
|
||||||
" \"static_rule_id\": [\n" +
|
"success": true,
|
||||||
" 11\n" +
|
"static_rule_id": [
|
||||||
" ]\n" +
|
11
|
||||||
" }\n" +
|
]
|
||||||
"}",
|
}
|
||||||
description = "static_rule_id:删除静态规则id列表"+
|
}""",
|
||||||
|
description = "static_rule_id:删除静态规则id列表" +
|
||||||
"success:是否成功"
|
"success:是否成功"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -115,7 +120,7 @@ public interface StaticRuleControllerApi {
|
|||||||
@Parameter(name = "ids", description = "静态规则id数组")
|
@Parameter(name = "ids", description = "静态规则id数组")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ResponseResult delete(@PathVariable List<Integer> ids) ;
|
ResponseResult delete(@PathVariable List<Integer> ids);
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "修改静态规则",
|
summary = "修改静态规则",
|
||||||
@@ -128,11 +133,12 @@ public interface StaticRuleControllerApi {
|
|||||||
schema = @Schema(implementation = ResponseResult.class),
|
schema = @Schema(implementation = ResponseResult.class),
|
||||||
examples = @ExampleObject(
|
examples = @ExampleObject(
|
||||||
name = "修改静态规则",
|
name = "修改静态规则",
|
||||||
value = "{\n" +
|
value = """
|
||||||
" \"code\": 200,\n" +
|
{
|
||||||
" \"message\": \"request succeed\",\n" +
|
"code": 200,
|
||||||
" \"data\": {\"success\": true,}\n" +
|
"message": "request succeed",
|
||||||
"}"
|
"data": {"success": true,}
|
||||||
|
}"""
|
||||||
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -145,7 +151,7 @@ public interface StaticRuleControllerApi {
|
|||||||
description = "静态规则信息")
|
description = "静态规则信息")
|
||||||
)
|
)
|
||||||
ResponseResult updateStaticRule(@PathVariable Integer id,
|
ResponseResult updateStaticRule(@PathVariable Integer id,
|
||||||
@RequestBody @Valid StaticRuleObject object) ;
|
@RequestBody @Valid StaticRuleObject object);
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "查询单个静态规则",
|
summary = "查询单个静态规则",
|
||||||
@@ -162,7 +168,7 @@ public interface StaticRuleControllerApi {
|
|||||||
},
|
},
|
||||||
parameters = {@Parameter(name = "id", description = "静态规则ID", example = "38")}
|
parameters = {@Parameter(name = "id", description = "静态规则ID", example = "38")}
|
||||||
)
|
)
|
||||||
ResponseResult queryStaticRuleById(@PathVariable Integer id) ;
|
ResponseResult queryStaticRuleById(@PathVariable Integer id);
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
summary = "分页查询静态规则",
|
summary = "分页查询静态规则",
|
||||||
@@ -177,17 +183,18 @@ public interface StaticRuleControllerApi {
|
|||||||
anyOf = {ResponseResult.class, StaticRuleObject.class}),
|
anyOf = {ResponseResult.class, StaticRuleObject.class}),
|
||||||
examples = @ExampleObject(
|
examples = @ExampleObject(
|
||||||
name = "分页查询静态规则",
|
name = "分页查询静态规则",
|
||||||
value = "{\n" +
|
value = """
|
||||||
" \"code\": 200,\n" +
|
{
|
||||||
" \"message\": \"request succeed\",\n" +
|
"code": 200,
|
||||||
" \"data\": {\n" +
|
"message": "request succeed",
|
||||||
" \"static_rule_list\": [\n" +
|
"data": {
|
||||||
" ],\n" +
|
"static_rule_list": [
|
||||||
" \"static_rule_total_num\": 1080\n" +
|
],
|
||||||
" }\n" +
|
"static_rule_total_num": 1080
|
||||||
"}",
|
}
|
||||||
|
}""",
|
||||||
|
|
||||||
description = "static_rule_list:静态规则列表"+
|
description = "static_rule_list:静态规则列表" +
|
||||||
"static_rule_total_num:静态规则总数"
|
"static_rule_total_num:静态规则总数"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -211,7 +218,7 @@ public interface StaticRuleControllerApi {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@Operation( summary = "批量查询静态规则",
|
@Operation(summary = "批量查询静态规则",
|
||||||
description = "根据静态规则ID列表查询多个静态规则的所有详细信息",
|
description = "根据静态规则ID列表查询多个静态规则的所有详细信息",
|
||||||
responses = {
|
responses = {
|
||||||
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(
|
||||||
@@ -239,11 +246,12 @@ public interface StaticRuleControllerApi {
|
|||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = ResponseResult.class),
|
schema = @Schema(implementation = ResponseResult.class),
|
||||||
examples = @ExampleObject(
|
examples = @ExampleObject(
|
||||||
value = "{\n" +
|
value = """
|
||||||
" \"code\": 200,\n" +
|
{
|
||||||
" \"message\": \"request succeed\",\n" +
|
"code": 200,
|
||||||
" \"data\": {}\n" +
|
"message": "request succeed",
|
||||||
"}"
|
"data": {}
|
||||||
|
}"""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -252,10 +260,7 @@ public interface StaticRuleControllerApi {
|
|||||||
@Parameter(name = "id", description = "静态规则id")
|
@Parameter(name = "id", description = "静态规则id")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ResponseResult deleteStaticRule(@PathVariable Integer id) ;
|
ResponseResult deleteStaticRule(@PathVariable Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Operation(
|
@Operation(
|
||||||
@@ -275,6 +280,5 @@ public interface StaticRuleControllerApi {
|
|||||||
@Parameter(name = "auditStatus", description = "要修改为的静态规则审核状态")
|
@Parameter(name = "auditStatus", description = "要修改为的静态规则审核状态")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public ResponseResult updateStaticRuleAuditStatus(@PathVariable Integer id, @PathVariable Integer auditStatus) ;
|
ResponseResult updateStaticRuleAuditStatus(@PathVariable Integer id, @PathVariable Integer auditStatus);
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import io.swagger.v3.oas.annotations.media.ExampleObject;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -31,15 +30,16 @@ public interface WhiteListControllerApi {
|
|||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = ResponseResult.class),
|
schema = @Schema(implementation = ResponseResult.class),
|
||||||
examples = {@ExampleObject(
|
examples = {@ExampleObject(
|
||||||
value = "{\n" +
|
value = """
|
||||||
" \"code\": 200,\n" +
|
{
|
||||||
" \"message\": \"request succeed\",\n" +
|
"code": 200,
|
||||||
" \"data\": {\n" +
|
"message": "request succeed",
|
||||||
" \"whiteobj_name\": \"白名单测试\",\n" +
|
"data": {
|
||||||
" \"success\": true,\n" +
|
"whiteobj_name": "白名单测试",
|
||||||
" \"whiteobj_id\": 7026\n" +
|
"success": true,
|
||||||
" }\n" +
|
"whiteobj_id": 7026
|
||||||
"}"
|
}
|
||||||
|
}"""
|
||||||
)}
|
)}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -206,9 +206,12 @@
|
|||||||
from t_protect_object
|
from t_protect_object
|
||||||
where protect_object_id = #{protectObjectId}
|
where protect_object_id = #{protectObjectId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryDynamicRuleTotalNum" resultType="java.lang.Integer">
|
<select id="queryDynamicRuleTotalNum" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM t_dynamic_rule
|
FROM t_dynamic_rule
|
||||||
|
left join t_strategy_template
|
||||||
|
on t_dynamic_rule.template_id = t_strategy_template.strategy_template_id
|
||||||
<where>
|
<where>
|
||||||
<if test="dynamicRuleName != null">
|
<if test="dynamicRuleName != null">
|
||||||
t_dynamic_rule.dynamic_rule_name like concat('%', #{dynamicRuleName}, '%')
|
t_dynamic_rule.dynamic_rule_name like concat('%', #{dynamicRuleName}, '%')
|
||||||
|
|||||||
@@ -51,8 +51,35 @@
|
|||||||
protect_object_port, protect_object_url, protect_object_protocol, protect_object_audit_status
|
protect_object_port, protect_object_url, protect_object_protocol, protect_object_audit_status
|
||||||
FROM t_protect_object
|
FROM t_protect_object
|
||||||
<where>
|
<where>
|
||||||
<if test="proobj_name != null">protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
|
<if test="proobj_name != null">AND protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
|
||||||
<if test="proobj_id != null">protect_object_id = #{proobj_id}</if>
|
<if test="proobj_id != null">AND protect_object_id = #{proobj_id}</if>
|
||||||
|
<if test="proobj_system_name != null">
|
||||||
|
AND protect_object_system_name LIKE CONCAT('%', #{proobj_system_name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="proobj_ip != null">
|
||||||
|
AND protect_object_id IN (
|
||||||
|
SELECT protect_object_id FROM t_protect_object_inet_addr_view tpo_view
|
||||||
|
WHERE tpo_view.protect_object_ip LIKE CONCAT('%', #{proobj_ip}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="proobj_port_min != null">
|
||||||
|
AND protect_object_port > #{proobj_port_min}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_port_max != null">
|
||||||
|
AND protect_object_port < #{proobj_port_max}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_url != null">
|
||||||
|
AND protect_object_url LIKE CONCAT('%', #{proobj_url}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="proobj_protocol != null">
|
||||||
|
AND protect_object_protocol = #{proobj_protocol}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_username != null">
|
||||||
|
AND protect_object_create_username = #{proobj_username}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_audit_status != null">
|
||||||
|
AND protect_object_audit_status = #{proobj_audit_status}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
LIMIT ${(page-1) * page_size}, #{page_size}
|
LIMIT ${(page-1) * page_size}, #{page_size}
|
||||||
</select>
|
</select>
|
||||||
@@ -69,11 +96,39 @@
|
|||||||
FROM t_protect_object
|
FROM t_protect_object
|
||||||
WHERE protect_object_id = #{proobj_id}
|
WHERE protect_object_id = #{proobj_id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryProtectObjectsTotalNum" resultType="java.lang.Integer">
|
<select id="queryProtectObjectsTotalNum" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(protect_object_id) FROM t_protect_object
|
SELECT COUNT(protect_object_id) FROM t_protect_object
|
||||||
<where>
|
<where>
|
||||||
<if test="proobj_name != null">protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
|
<if test="proobj_name != null">AND protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
|
||||||
<if test="proobj_id != null">protect_object_id = #{proobj_id}</if>
|
<if test="proobj_id != null">AND protect_object_id = #{proobj_id}</if>
|
||||||
|
<if test="proobj_system_name != null">
|
||||||
|
AND protect_object_system_name LIKE CONCAT('%', #{proobj_system_name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="proobj_ip != null">
|
||||||
|
AND protect_object_id IN (
|
||||||
|
SELECT protect_object_id FROM t_protect_object_inet_addr_view tpo_view
|
||||||
|
WHERE tpo_view.protect_object_ip LIKE CONCAT('%', #{proobj_ip}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="proobj_port_min != null">
|
||||||
|
AND protect_object_port >= #{proobj_port_min}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_port_max != null">
|
||||||
|
AND protect_object_port <= #{proobj_port_max}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_url != null">
|
||||||
|
AND protect_object_url LIKE CONCAT('%', #{proobj_url}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="proobj_protocol != null">
|
||||||
|
AND protect_object_protocol = #{proobj_protocol}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_username != null">
|
||||||
|
AND protect_object_create_username = #{proobj_username}
|
||||||
|
</if>
|
||||||
|
<if test="proobj_audit_status != null">
|
||||||
|
AND protect_object_audit_status = #{proobj_audit_status}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,12 @@
|
|||||||
<select id="queryTemplates" resultMap="templateMap">
|
<select id="queryTemplates" resultMap="templateMap">
|
||||||
SELECT * FROM template_view
|
SELECT * FROM template_view
|
||||||
<where>
|
<where>
|
||||||
|
<if test="source_system != null">
|
||||||
|
AND strategy_template_source_system = #{source_system}
|
||||||
|
</if>
|
||||||
|
<if test="create_username != null">
|
||||||
|
AND strategy_template_create_username = #{create_username}
|
||||||
|
</if>
|
||||||
<if test="template_name != null">
|
<if test="template_name != null">
|
||||||
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
|
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -108,6 +114,12 @@
|
|||||||
<select id="queryTemplateTotalNum" resultType="java.lang.Integer">
|
<select id="queryTemplateTotalNum" resultType="java.lang.Integer">
|
||||||
SELECT COUNT(strategy_template_id) FROM t_strategy_template
|
SELECT COUNT(strategy_template_id) FROM t_strategy_template
|
||||||
<where>
|
<where>
|
||||||
|
<if test="source_system != null">
|
||||||
|
AND strategy_template_source_system = #{source_system}
|
||||||
|
</if>
|
||||||
|
<if test="create_username != null">
|
||||||
|
AND strategy_template_create_username = #{create_username}
|
||||||
|
</if>
|
||||||
<if test="template_name != null">
|
<if test="template_name != null">
|
||||||
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
|
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<svg width="1361px" height="609px" viewBox="0 0 1361 609" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
<svg width="1361px" height="609px" viewBox="0 0 1361 609" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
<!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
|
<!-- Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch -->
|
||||||
<title>Group 21</title>
|
<title>Group 21</title>
|
||||||
<desc>Created with Sketch.</desc>
|
<desc>Created with Sketch.</desc>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||||
viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
|
viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.st0{fill:#1890FF;}
|
.st0{fill:#1890FF;}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 988 B After Width: | Height: | Size: 948 B |
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||||
viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
|
viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.st0{fill:#FFFFFF;}
|
.st0{fill:#FFFFFF;}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 972 B After Width: | Height: | Size: 932 B |
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg viewBox="0 0 128 128" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
<svg viewBox="0 0 128 128" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||||
<!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
|
<!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
|
||||||
<title>Vue</title>
|
<title>Vue</title>
|
||||||
<desc>Created with Sketch.</desc>
|
<desc>Created with Sketch.</desc>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -39,8 +39,12 @@ public class AlertMessageTest {
|
|||||||
@Test
|
@Test
|
||||||
void testReceiveAlertMessage() {
|
void testReceiveAlertMessage() {
|
||||||
|
|
||||||
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(null, null, 1, 1);
|
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(
|
||||||
List<Template> templates = templateService.queryTemplates(null, 1, 1);
|
null, null, null, null,
|
||||||
|
null, null, null, null,
|
||||||
|
null, null, 1, 1);
|
||||||
|
List<Template> templates = templateService.queryTemplates(
|
||||||
|
null, null, null,1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("UpdateDynamicRule2");
|
object.setDynamicRuleName("UpdateDynamicRule2");
|
||||||
|
|||||||
@@ -71,18 +71,49 @@ class ProtectObjectServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
protectObjects.forEach(protectObject -> {
|
protectObjects.forEach(protectObject -> {
|
||||||
assertNotNull(protectObjectService.queryProtectObject(protectObject.getProtectObjectId()));
|
assertNotNull(protectObjectService.queryProtectObject(protectObject.getProtectObjectId()));
|
||||||
assertNotNull(protectObjectService.queryProtectObjects(null,
|
assertNotNull(protectObjectService.queryProtectObjects(
|
||||||
protectObject.getProtectObjectId(), 1, 1));
|
null,
|
||||||
|
protectObject.getProtectObjectId(),
|
||||||
|
protectObject.getProtectObjectSystemName(),
|
||||||
|
protectObject.getProtectObjectIPAddress(),
|
||||||
|
protectObject.getProtectObjectPort(),
|
||||||
|
protectObject.getProtectObjectPort(),
|
||||||
|
protectObject.getProtectObjectURL(),
|
||||||
|
protectObject.getProtectObjectProtocol(),
|
||||||
|
protectObject.getProtectObjectCreateUsername(),
|
||||||
|
protectObject.getProtectObjectAuditStatus(),
|
||||||
|
1, 1));
|
||||||
});
|
});
|
||||||
|
|
||||||
assertEquals(100,
|
assertEquals(100,
|
||||||
protectObjectService.queryProtectObjects(testName, null, 1, 1000).size());
|
protectObjectService.queryProtectObjects(testName,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
1, 100).size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateProtectObject() {
|
void updateProtectObject() {
|
||||||
List<ProtectObject> protectObjects = protectObjectService.queryProtectObjects(null, null, 1, 1);
|
List<ProtectObject> protectObjects = protectObjectService.queryProtectObjects(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
1, 1);
|
||||||
Integer testId = protectObjects.get(0).getProtectObjectId();
|
Integer testId = protectObjects.get(0).getProtectObjectId();
|
||||||
|
|
||||||
protectObject.setProtectObjectName("x-1-1");
|
protectObject.setProtectObjectName("x-1-1");
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ class TemplateServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryTemplate() {
|
void testQueryTemplate() {
|
||||||
List<Template> templates = templateService.queryTemplates("DDOS", 1, 5);
|
List<Template> templates = templateService.queryTemplates(
|
||||||
|
"DDOS", null, null,1, 5);
|
||||||
assertEquals(5, templates.size());
|
assertEquals(5, templates.size());
|
||||||
for (Template template : templates) {
|
for (Template template : templates) {
|
||||||
assertTrue(template.getTemplateId() > 0);
|
assertTrue(template.getTemplateId() > 0);
|
||||||
@@ -93,7 +94,8 @@ class TemplateServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testUpdateTemplateSuccess() {
|
void testUpdateTemplateSuccess() {
|
||||||
List<Template> templates = templateService.queryTemplates("DDOS", 1, 1);
|
List<Template> templates = templateService.queryTemplates(
|
||||||
|
"DDOS", null, null, 1, 1);
|
||||||
Template testTemplate = templates.get(0);
|
Template testTemplate = templates.get(0);
|
||||||
testTemplate.setTemplateName("洪泛型DDOS攻击-" + LocalDateTime.now());
|
testTemplate.setTemplateName("洪泛型DDOS攻击-" + LocalDateTime.now());
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,12 @@ public class DynamicRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testNewDynamicRule() {
|
void testNewDynamicRule() {
|
||||||
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(null, null, 1, 1);
|
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(
|
||||||
List<Template> templates = templateService.queryTemplates(null, 1, 1);
|
null, null, null,null,
|
||||||
|
null,null,null,null,
|
||||||
|
null,null, 1, 1);
|
||||||
|
List<Template> templates = templateService.queryTemplates(
|
||||||
|
null, null, null, 1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("UpdateDynamicRule2");
|
object.setDynamicRuleName("UpdateDynamicRule2");
|
||||||
@@ -52,8 +56,20 @@ public class DynamicRuleServiceTest extends ProtectionApplicationTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDeleteDynamicRule() {
|
void testDeleteDynamicRule() {
|
||||||
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(null, null, 1, 1);
|
List<ProtectObject> protectObject = protectObjectService.queryProtectObjects(
|
||||||
List<Template> templates = templateService.queryTemplates(null, 1, 1);
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
1, 1);
|
||||||
|
List<Template> templates = templateService.queryTemplates(
|
||||||
|
null, null,null, 1, 1);
|
||||||
|
|
||||||
DynamicRuleObject object = new DynamicRuleObject();
|
DynamicRuleObject object = new DynamicRuleObject();
|
||||||
object.setDynamicRuleName("UpdateDynamicRule2");
|
object.setDynamicRuleName("UpdateDynamicRule2");
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ import org.junit.jupiter.api.BeforeEach;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.cglib.core.Local;
|
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -30,7 +28,7 @@ class TaskServiceTest extends ProtectionApplicationTests {
|
|||||||
private Task task;
|
private Task task;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskServiceTest(TaskService taskService, StaticRuleService staticRuleService, DynamicRuleService dynamicRuleService, StateChangeService stateChangeService) {
|
TaskServiceTest(TaskService taskService, StaticRuleService staticRuleService, DynamicRuleService dynamicRuleService) {
|
||||||
this.taskService = taskService;
|
this.taskService = taskService;
|
||||||
this.staticRuleService = staticRuleService;
|
this.staticRuleService = staticRuleService;
|
||||||
this.dynamicRuleService = dynamicRuleService;
|
this.dynamicRuleService = dynamicRuleService;
|
||||||
|
|||||||