1、修复防护对象按id、ids查询返回ip不正确问题。

2、指令入库增加写入RULE_NAME字段
This commit is contained in:
PushM
2024-06-11 00:39:28 +08:00
parent 1edea5b31a
commit b1a211630a
6 changed files with 23 additions and 9 deletions

View File

@@ -118,6 +118,9 @@ public class TaskCommandInfo {
@Schema(description = "指令展示id", accessMode = Schema.AccessMode.READ_ONLY) @Schema(description = "指令展示id", accessMode = Schema.AccessMode.READ_ONLY)
private String displayId; private String displayId;
@Schema(description = "规则名称", accessMode = Schema.AccessMode.READ_ONLY)
private String ruleName;
// 复制构造函数 // 复制构造函数
public void copyTaskCommandInfo(TaskCommandInfo original) { public void copyTaskCommandInfo(TaskCommandInfo original) {
this.UUID = original.UUID; this.UUID = original.UUID;
@@ -144,6 +147,7 @@ public class TaskCommandInfo {
this.templateId = original.templateId; this.templateId = original.templateId;
this.protectLevel = original.protectLevel; this.protectLevel = original.protectLevel;
this.taskStatus = original.taskStatus; this.taskStatus = original.taskStatus;
this.ruleName = original.ruleName;
} }
public void setProtocolNum() { public void setProtocolNum() {

View File

@@ -34,6 +34,7 @@ public class AuditAdvice implements ResponseBodyAdvice<ResponseResult> {
private final WebClient webClient = WebClient private final WebClient webClient = WebClient
.builder() .builder()
.baseUrl("http://39.105.210.156:8090/chanct-log/audit-xgs") .baseUrl("http://39.105.210.156:8090/chanct-log/audit-xgs")
// .baseUrl("http://10.58.44.241:1888/api/chanct-log/audit-xgs")
.build(); .build();
@Data @Data

View File

@@ -26,6 +26,8 @@
<result column="dynamic_rule_protect_level" property="protectLevel"/> <result column="dynamic_rule_protect_level" property="protectLevel"/>
<result column="task_status" property="taskStatus"/> <result column="task_status" property="taskStatus"/>
<result column="dynamic_rule_name" property="ruleName"/>
</resultMap> </resultMap>
<resultMap id="protectLevelMap" type="com.realtime.protection.configuration.entity.defense.template.ProtectLevel"> <resultMap id="protectLevelMap" type="com.realtime.protection.configuration.entity.defense.template.ProtectLevel">
<!-- <id column="protect_level_id" property="protectLevelId"/>--> <!-- <id column="protect_level_id" property="protectLevelId"/>-->
@@ -238,8 +240,9 @@
t_task.task_range, t_task.task_range,
t_task.protect_level, t_task.protect_level,
t_task.task_status, t_task.task_status,
t_task.event_type t_task.event_type,
-- t_tmplate.strategy_template_name -- t_tmplate.strategy_template_name
t_dr.dynamic_rule_name
from t_task from t_task
left join realtime_protection.t_dynamic_rule t_dr on left join realtime_protection.t_dynamic_rule t_dr on

View File

@@ -9,7 +9,7 @@
MASK_SRC_IP, MASK_SRC_PORT, MASK_DST_IP, MASK_DST_PORT, MASK_PROTOCOL, VALID_TIME, MASK_SRC_IP, MASK_SRC_PORT, MASK_DST_IP, MASK_DST_PORT, MASK_PROTOCOL, VALID_TIME,
INVALID_TIME, IS_VALID, IS_JUDGED, INVALID_TIME, IS_VALID, IS_JUDGED,
SEND_TIMES, SUCCESS_TIMES, CREATE_TIME, LAST_UPDATE, IS_DELETED, SEND_TIMES, SUCCESS_TIMES, CREATE_TIME, LAST_UPDATE, IS_DELETED,
TASKTYPE, RULE_ID, display_id) TASKTYPE, RULE_ID, display_id,RULE_NAME)
values (#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.taskName}, #{info.eventType}, #{info.taskCreateDepart}, #{info.distributePoint}, values (#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.taskName}, #{info.eventType}, #{info.taskCreateDepart}, #{info.distributePoint},
#{info.frequency}, #{info.frequency},
DEFAULT, DEFAULT,
@@ -22,7 +22,8 @@
#{info.startTime}, #{info.endTime}, #{info.isValid}, #{info.startTime}, #{info.endTime}, #{info.isValid},
#{info.isJudged}, #{info.isJudged},
0, 0, 0, 0,
NOW(), NOW(), FALSE, #{info.taskType}, #{info.ruleId}, #{info.displayId} NOW(), NOW(), FALSE, #{info.taskType}, #{info.ruleId}, #{info.displayId},
#{info.ruleName}
) )
</insert> </insert>
@@ -33,7 +34,7 @@
MASK_SRC_IP, MASK_SRC_PORT, MASK_DST_IP, MASK_DST_PORT, MASK_PROTOCOL, VALID_TIME, INVALID_TIME, IS_VALID, MASK_SRC_IP, MASK_SRC_PORT, MASK_DST_IP, MASK_DST_PORT, MASK_PROTOCOL, VALID_TIME, INVALID_TIME, IS_VALID,
IS_JUDGED, IS_JUDGED,
SEND_TIMES, SUCCESS_TIMES, CREATE_TIME, LAST_UPDATE, IS_DELETED, SEND_TIMES, SUCCESS_TIMES, CREATE_TIME, LAST_UPDATE, IS_DELETED,
TASKTYPE, RULE_ID, display_id) TASKTYPE, RULE_ID, display_id,RULE_NAME)
values values
<foreach collection="command_infos" item="info" separator=","> <foreach collection="command_infos" item="info" separator=",">
(#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.taskName}, #{info.eventType}, #{info.taskCreateDepart}, #{info.distributePoint}, (#{info.UUID}, #{info.taskId}, #{info.taskAct}, #{info.taskName}, #{info.eventType}, #{info.taskCreateDepart}, #{info.distributePoint},
@@ -48,7 +49,8 @@
#{info.startTime}, #{info.endTime}, #{info.isValid}, #{info.startTime}, #{info.endTime}, #{info.isValid},
#{info.isJudged}, #{info.isJudged},
0, 0, 0, 0,
NOW(), NOW(), FALSE, #{info.taskType}, #{info.ruleId}, #{info.displayId} NOW(), NOW(), FALSE, #{info.taskType}, #{info.ruleId}, #{info.displayId},
#{info.ruleName}
) )
</foreach> </foreach>
</insert> </insert>

View File

@@ -203,7 +203,7 @@
SELECT protect_object_id, SELECT protect_object_id,
protect_object_name, protect_object_name,
protect_object_system_name, protect_object_system_name,
INET_NTOA(protect_object_ip) as protect_object_ip, INET_NTOA(protect_object_ip) as protect_object_ip_d,
protect_object_port, protect_object_port,
protect_object_url, protect_object_url,
protect_object_protocol, protect_object_protocol,
@@ -278,7 +278,8 @@
WHERE protect_object_id = #{proobj_id} WHERE protect_object_id = #{proobj_id}
</select> </select>
<select id="queryHistory" resultMap="protectObjectMap"> <select id="queryHistory" resultMap="protectObjectMap">
SELECT * SELECT *,
INET_NTOA(protect_object_ip) as protect_object_ip_d
FROM t_protect_object_status_log FROM t_protect_object_status_log
WHERE protect_object_id = #{id} WHERE protect_object_id = #{id}
ORDER BY effective_time DESC ORDER BY effective_time DESC
@@ -286,7 +287,8 @@
</select> </select>
<select id="queryProtectObjectByIds" <select id="queryProtectObjectByIds"
resultMap="protectObjectMap"> resultMap="protectObjectMap">
SELECT * SELECT *,
INET_NTOA(protect_object_ip) as protect_object_ip_d
FROM t_protect_object FROM t_protect_object
WHERE protect_object_id IN WHERE protect_object_id IN
<foreach collection="protectObjectIds" item="id" open="(" separator="," close=")"> <foreach collection="protectObjectIds" item="id" open="(" separator="," close=")">

View File

@@ -332,6 +332,7 @@
<result column="task_start_time" property="startTime"/> <result column="task_start_time" property="startTime"/>
<result column="task_end_time" property="endTime"/> <result column="task_end_time" property="endTime"/>
<result column="event_type" property="eventType"/> <result column="event_type" property="eventType"/>
<result column="static_rule_name" property="ruleName"/>
<association property="fiveTupleWithMask"> <association property="fiveTupleWithMask">
<result column="addr_type" property="addrType"/> <result column="addr_type" property="addrType"/>
@@ -511,7 +512,8 @@
tsr.static_rule_msport, tsr.static_rule_msport,
INET_NTOA(tsr.static_rule_mdip) as static_rule_mdip, INET_NTOA(tsr.static_rule_mdip) as static_rule_mdip,
tsr.static_rule_mdport, tsr.static_rule_mdport,
tsr.static_rule_mprotocol tsr.static_rule_mprotocol,
tsr.static_rule_name
FROM t_task FROM t_task
LEFT JOIN realtime_protection.t_static_rule tsr on t_task.task_id = tsr.static_rule_used_task_id LEFT JOIN realtime_protection.t_static_rule tsr on t_task.task_id = tsr.static_rule_used_task_id
WHERE task_id = #{task_id} WHERE task_id = #{task_id}