REM:
1. 备份代码
This commit is contained in:
HuangXin 2020-09-27 14:36:03 +08:00
parent 6667ae9735
commit f7599efa4b
15 changed files with 126 additions and 114 deletions

View File

@ -18,7 +18,7 @@
</parent> </parent>
<groupId>com.dispose</groupId> <groupId>com.dispose</groupId>
<artifactId>phoenix_ddos_handle</artifactId> <artifactId>phoenix_ddos_handle</artifactId>
<version>2.0.0</version> <version>2.0.1</version>
<name>phoenix_ddos_handle</name> <name>phoenix_ddos_handle</name>
<description>Dispose Platform</description> <description>Dispose Platform</description>
<dependencies> <dependencies>

View File

@ -4,6 +4,7 @@ import com.dispose.common.CommonEnumHandler;
import com.dispose.common.DDoSAttackType; import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType; import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue; import com.dispose.common.DisposeConfigValue;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.ErrorCode; import com.dispose.common.ErrorCode;
import com.dispose.common.Helper; import com.dispose.common.Helper;
import com.dispose.common.NetflowDirection; import com.dispose.common.NetflowDirection;
@ -101,7 +102,8 @@ public class DisposeTaskController {
.get(0))) .get(0)))
.disposeCapacity(CommonEnumHandler.codeOf(DisposeCapacityType.class, .disposeCapacity(CommonEnumHandler.codeOf(DisposeCapacityType.class,
req.getType())) req.getType()))
.disposeIp(Helper.ipAddressNormalize(req.getDisposeIp())) .disposeObject(Helper.ipAddressNormalize(req.getDisposeIp()))
.objectType(DisposeObjectType.IP)
.planEndTime(String.valueOf(req.getDisposeTime())) .planEndTime(String.valueOf(req.getDisposeTime()))
.flowDirection(CommonEnumHandler.codeOf(NetflowDirection.class, .flowDirection(CommonEnumHandler.codeOf(NetflowDirection.class,
Optional.ofNullable(req.getFlowDirection()) Optional.ofNullable(req.getFlowDirection())
@ -118,7 +120,7 @@ public class DisposeTaskController {
// 设置返回消息 // 设置返回消息
TaskStartRsp rspInfo = TaskStartRsp.builder() TaskStartRsp rspInfo = TaskStartRsp.builder()
.disposeIp(task.getDisposeIp()) .disposeIp(task.getDisposeObject())
.build(); .build();
rspInfo.setStatus(ret.getFirstParam().getCode()); rspInfo.setStatus(ret.getFirstParam().getCode());
@ -173,7 +175,8 @@ public class DisposeTaskController {
.deviceId(devId) .deviceId(devId)
.accountId(aId) .accountId(aId)
.disposeCapacity(capType) .disposeCapacity(capType)
.disposeIp(Helper.ipAddressNormalize(ip)) .disposeObject(Helper.ipAddressNormalize(ip))
.objectType(DisposeObjectType.IP)
.planEndTime(endTime) .planEndTime(endTime)
.flowDirection(netDir) .flowDirection(netDir)
.attackType(attackType) .attackType(attackType)
@ -235,7 +238,7 @@ public class DisposeTaskController {
.map(String::valueOf) .map(String::valueOf)
.toArray(String[]::new)); .toArray(String[]::new));
rspInfo.setType(ret.getSecondParam().getDisposeCapacity().getValue()); rspInfo.setType(ret.getSecondParam().getDisposeCapacity().getValue());
rspInfo.setDisposeIp(ret.getSecondParam().getDisposeIp()); rspInfo.setDisposeIp(ret.getSecondParam().getDisposeObject());
rspInfo.setLeftTime(String.valueOf(Math.abs( rspInfo.setLeftTime(String.valueOf(Math.abs(
Helper.getTimestampDiffNow(ret.getSecondParam().getPlanEndTime())) / 60)); Helper.getTimestampDiffNow(ret.getSecondParam().getPlanEndTime())) / 60));
} }
@ -267,7 +270,8 @@ public class DisposeTaskController {
List<GetTaskDetail> getTaskDetail = new ArrayList<>(); List<GetTaskDetail> getTaskDetail = new ArrayList<>();
//获取TaskId列表 //获取TaskId列表
List<Long> reqTaskIds = Arrays.stream(Optional.ofNullable(mr.getMsgContent().getTaskId()).orElse(new String[]{})). List<Long> reqTaskIds = Arrays.stream(Optional.ofNullable(mr.getMsgContent().getTaskId())
.orElse(new String[]{})).
map(Long::parseLong).collect(Collectors.toList()); map(Long::parseLong).collect(Collectors.toList());
//获取所有可用处置任务 //获取所有可用处置任务
@ -292,7 +296,7 @@ public class DisposeTaskController {
.taskId(String.valueOf(v.getId())) .taskId(String.valueOf(v.getId()))
.accountId(String.valueOf(v.getAccountId())) .accountId(String.valueOf(v.getAccountId()))
.disposeCapacity(v.getDisposeCapacity().getValue()) .disposeCapacity(v.getDisposeCapacity().getValue())
.disposeIp(v.getDisposeIp()) .disposeIp(v.getDisposeObject())
.createTime(v.getCreateTime()) .createTime(v.getCreateTime())
.planEndTime(v.getPlanEndTime()) .planEndTime(v.getPlanEndTime())
.endTime(v.getEndTime()) .endTime(v.getEndTime())

View File

@ -1,6 +1,7 @@
package com.dispose.pojo.entity; package com.dispose.pojo.entity;
import com.dispose.common.DisposeCapacityType; import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeObjectType;
import com.dispose.common.DisposeTaskStatus; import com.dispose.common.DisposeTaskStatus;
import com.dispose.common.NetflowDirection; import com.dispose.common.NetflowDirection;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
@ -56,9 +57,13 @@ public class DisposeTask implements Serializable {
*/ */
private DisposeCapacityType disposeCapacity; private DisposeCapacityType disposeCapacity;
/** /**
* The Dispose ip. * The Dispose object.
*/ */
private String disposeIp; private String disposeObject;
/**
* The Object type.
*/
private DisposeObjectType objectType;
/** /**
* The Create time. * The Create time.
*/ */
@ -88,7 +93,7 @@ public class DisposeTask implements Serializable {
*/ */
private DisposeTaskStatus currentStatus; private DisposeTaskStatus currentStatus;
/** /**
* The Task info. * The Device task.
*/ */
private List<DeviceTask> deviceTask; private List<DeviceTask> deviceTask;
} }

View File

@ -68,7 +68,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTask.getTaskAttackType()); deviceTask.getTaskAttackType());
// 调用设备执行处置任务 // 调用设备执行处置任务
ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null, null); ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null, null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
// 设置攻击类型任务启动结果 // 设置攻击类型任务启动结果
@ -97,7 +97,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
MulReturnType<ErrorCode, Long> ret; MulReturnType<ErrorCode, Long> ret;
// 调用设备执行处置任务 // 调用设备执行处置任务
ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null, null); ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null, null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),disposeTask.getFlowDirection(), 0L); deviceTaskManager.setAttackTypeStatus(deviceTask.getId(),disposeTask.getFlowDirection(), 0L);
@ -132,7 +132,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.setExecAttackType(deviceTask.getId(), NetflowDirection.DIRECTION_BI, deviceTaskManager.setExecAttackType(deviceTask.getId(), NetflowDirection.DIRECTION_BI,
deviceTask.getTaskAttackType()); deviceTask.getTaskAttackType());
ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null, ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null,
(long) -(Helper.getTimestampDiffNow(disposeTask.getPlanEndTime()) / 60)); (long) -(Helper.getTimestampDiffNow(disposeTask.getPlanEndTime()) / 60));
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@ -175,7 +175,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
MulReturnType<ErrorCode, Long> ret; MulReturnType<ErrorCode, Long> ret;
// 停止处置任务 // 停止处置任务
ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), null, null, ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(), null, null,
deviceTask.getExternId()); deviceTask.getExternId());
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@ -219,7 +219,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT, deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
t.getValue()); t.getValue());
// 调用迪普设备启动处置任务 // 调用迪普设备启动处置任务
ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_OUT, t.getValue(), null); NetflowDirection.DIRECTION_OUT, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@ -256,7 +256,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN, deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
t.getValue()); t.getValue());
// 调用迪普设备启动处置任务 // 调用迪普设备启动处置任务
ret = ai.getDb().runDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_IN, t.getValue(), null); NetflowDirection.DIRECTION_IN, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@ -331,7 +331,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 出方向 // 出方向
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_IN) { if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_IN) {
// 调用迪普设备停止处置任务 // 调用迪普设备停止处置任务
ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_OUT, t.getValue(), null); NetflowDirection.DIRECTION_OUT, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@ -357,7 +357,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 入方向 // 入方向
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_OUT) { if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_OUT) {
// 调用迪普设备启动处置任务 // 调用迪普设备启动处置任务
ret = ai.getDb().stopDispose(disposeTask.getDisposeIp(), disposeTask.getDisposeCapacity(), ret = ai.getDb().stopDispose(disposeTask.getDisposeObject(), disposeTask.getDisposeCapacity(),
NetflowDirection.DIRECTION_IN, t.getValue(), null); NetflowDirection.DIRECTION_IN, t.getValue(), null);
if (ret.getFirstParam() == ErrorCode.ERR_OK) { if (ret.getFirstParam() == ErrorCode.ERR_OK) {
@ -421,7 +421,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 清理过期任务 // 清理过期任务
for (DisposeTask v : disposeTaskManager.getExpiredTasks()) { for (DisposeTask v : disposeTaskManager.getExpiredTasks()) {
log.info("Task {} {} {} is expired, expect finished at {}", log.info("Task {} {} {} is expired, expect finished at {}",
v.getId(), v.getDisposeCapacity(), v.getDisposeIp(), v.getPlanEndTime()); v.getId(), v.getDisposeCapacity(), v.getDisposeObject(), v.getPlanEndTime());
// 设置任务状态过期任务不再为设备创建处置任务 // 设置任务状态过期任务不再为设备创建处置任务
disposeTaskManager.changeDisposeTaskStatus(v.getId(), DisposeTaskStatus.TASK_EXPIRED); disposeTaskManager.changeDisposeTaskStatus(v.getId(), DisposeTaskStatus.TASK_EXPIRED);
} }
@ -438,7 +438,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
// 当前设备是否支持该处置能力 // 当前设备是否支持该处置能力
.filter(c -> c.getDev().getDevCapacity().stream().anyMatch(m -> m.getCapacityType() == v .filter(c -> c.getDev().getDevCapacity().stream().anyMatch(m -> m.getCapacityType() == v
.getDisposeCapacity())) .getDisposeCapacity()))
.filter(c -> c.getDb().isCarryProtectIp(v.getDisposeIp())) .filter(c -> c.getDb().isCarryProtectIp(v.getDisposeObject()))
.forEach(d -> { .forEach(d -> {
log.info("Add dispose task for device: {}", d.getDev()); log.info("Add dispose task for device: {}", d.getDev());
@ -467,7 +467,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId()); AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId());
// 对处置IP生成一个唯一的操作标识符 // 对处置IP生成一个唯一的操作标识符
String taskStartKey = task.getDisposeIp() + "Start" + ai.getDev().getDeviceType().getDescription(); String taskStartKey = task.getDisposeObject() + "Start" + ai.getDev().getDeviceType().getDescription();
if (taskCache.containsKey(taskStartKey)) { if (taskCache.containsKey(taskStartKey)) {
continue; continue;
@ -526,7 +526,7 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId()); AbilityInfo ai = disposeAbilityRouterService.getAbilityDevice(v.getDeviceId());
// 对处置IP生成一个唯一的操作标识符 // 对处置IP生成一个唯一的操作标识符
String taskStopKey = task.getDisposeIp() + "Stop" + ai.getDev().getDeviceType().getDescription(); String taskStopKey = task.getDisposeObject() + "Stop" + ai.getDev().getDeviceType().getDescription();
if (taskCache.containsKey(taskStopKey)) { if (taskCache.containsKey(taskStopKey)) {
continue; continue;

View File

@ -41,14 +41,14 @@ public class DisposeTaskServiceImpl implements DisposeTaskService {
@Override @Override
public MulReturnType<ErrorCode, DisposeTask> createTask(DisposeTask task) { public MulReturnType<ErrorCode, DisposeTask> createTask(DisposeTask task) {
DisposeTask exitTask = disposeTaskManager.getDisposeTask(task.getDeviceId(), DisposeTask exitTask = disposeTaskManager.getDisposeTask(task.getDeviceId(),
task.getDisposeIp(), task.getDisposeCapacity()); task.getDisposeObject(), task.getDisposeCapacity());
if (exitTask != null) { if (exitTask != null) {
return new MulReturnType<>(ErrorCode.ERR_TASKRUNNING, exitTask); return new MulReturnType<>(ErrorCode.ERR_TASKRUNNING, exitTask);
} }
ErrorCode err = disposeAbilityRouterService.verifyDisposeCapacity( ErrorCode err = disposeAbilityRouterService.verifyDisposeCapacity(
task.getDeviceId(), task.getDisposeIp(), task.getDisposeCapacity() task.getDeviceId(), task.getDisposeObject(), task.getDisposeCapacity()
); );
if (err != ErrorCode.ERR_OK) { if (err != ErrorCode.ERR_OK) {
@ -100,6 +100,7 @@ public class DisposeTaskServiceImpl implements DisposeTaskService {
* *
* @return the dispose task list * @return the dispose task list
*/ */
@Override
public List<DisposeTask> getAllDisposeTask() { public List<DisposeTask> getAllDisposeTask() {
return disposeTaskManager.getDisposeTasks(); return disposeTaskManager.getDisposeTasks();
} }

View File

@ -1,8 +1,8 @@
-- ---------------------------- -- ----------------------------
-- Records of dispose_device -- Records of dispose_device
-- ---------------------------- -- ----------------------------
INSERT INTO `dispose_device` VALUES (1, '10.88.77.88:18080', 1, 1, 0, '中移杭研实验室浩瀚清洗设备', 'HaoHan', 'Unknown', 'Unknown', '', '', 'http://%s/DDoSClean/clean', '实验室测试设备', 0); -- INSERT INTO `dispose_device` VALUES (1, '10.88.77.88:18080', 1, 1, 0, '中移杭研实验室浩瀚清洗设备', 'HaoHan', 'Unknown', 'Unknown', '', '', 'http://%s/DDoSClean/clean', '实验室测试设备', 0);
INSERT INTO `dispose_device` VALUES (2, '10.88.77.15', 0, 1, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', 'B5.2.27.7', 'admin', 'UMCAdministrator', 'http://%s/UMC/service/AbnormalFlowCleaningService', '实验室测试设备', 0); -- INSERT INTO `dispose_device` VALUES (2, '10.88.77.15', 0, 1, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', 'B5.2.27.7', 'admin', 'UMCAdministrator', 'http://%s/UMC/service/AbnormalFlowCleaningService', '实验室测试设备', 0);
-- ---------------------------- -- ----------------------------

View File

@ -6,7 +6,8 @@
<id column="deviceId" property="deviceId"/> <id column="deviceId" property="deviceId"/>
<id column="accountId" property="accountId"/> <id column="accountId" property="accountId"/>
<result column="disposeCapacity" property="disposeCapacity" javaType="com.dispose.common.DisposeCapacityType"/> <result column="disposeCapacity" property="disposeCapacity" javaType="com.dispose.common.DisposeCapacityType"/>
<result column="disposeIp" property="disposeIp"/> <result column="disposeObject" property="disposeObject"/>
<result column="objectType" property="objectType" javaType="com.dispose.common.DisposeObjectType"/>
<result column="createTime" property="createTime"/> <result column="createTime" property="createTime"/>
<result column="planEndTime" property="planEndTime"/> <result column="planEndTime" property="planEndTime"/>
<result column="endTime" property="endTime"/> <result column="endTime" property="endTime"/>
@ -103,7 +104,7 @@
FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId FROM dispose_task dt LEFT JOIN device_task ti on dt.id = ti.taskId
WHERE WHERE
dt.disposeCapacity = #{capType} AND dt.disposeCapacity = #{capType} AND
dt.disposeIp = #{disposeIp} AND dt.disposeObject = #{disposeObject} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()} AND dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_FINISHED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()} AND dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_CANCELED.getValue()} AND
dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()} AND dt.currentStatus != ${@com.dispose.common.DisposeTaskStatus@TASK_EXPIRED.getValue()} AND
@ -130,10 +131,10 @@
<insert id="addNewTask" useGeneratedKeys="true" keyProperty="id" <insert id="addNewTask" useGeneratedKeys="true" keyProperty="id"
parameterType="com.dispose.pojo.entity.DisposeTask"> parameterType="com.dispose.pojo.entity.DisposeTask">
INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeIp, INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeObject, objectType,
planEndTime, flowDirection, attackType, flowBandWidth, planEndTime, flowDirection, attackType, flowBandWidth,
currentStatus) currentStatus)
VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeIp}, VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeObject}, ${objectType},
date_add(now(), interval #{planEndTime} MINUTE), #{flowDirection}, #{attackType}, date_add(now(), interval #{planEndTime} MINUTE), #{flowDirection}, #{attackType},
#{flowBandWidth}, ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()}) #{flowBandWidth}, ${@com.dispose.common.DisposeTaskStatus@TASK_NEW.getValue()})
</insert> </insert>

View File

@ -116,7 +116,8 @@ CREATE TABLE `dispose_task` (
`deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符', `deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
`accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符', `accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
`disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型0清洗 1高防 2黑洞 3检测', `disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型0清洗 1高防 2黑洞 3检测',
`disposeIp` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置IP', `disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象',
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0IP\r\n1域名 \r\n2URL',
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间', `createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
`planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间', `planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
`endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间', `endTime` timestamp(0) NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
@ -132,8 +133,8 @@ CREATE TABLE `dispose_task` (
-- ---------------------------- -- ----------------------------
-- Records of dispose_task -- Records of dispose_task
-- ---------------------------- -- ----------------------------
INSERT INTO `dispose_task` VALUES (1, -1, 1, 0, '192.168.10.1', CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0); INSERT INTO `dispose_task` VALUES (1, -1, 1, 0, '192.168.10.1', 1, CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0);
INSERT INTO `dispose_task` VALUES (2, -1, 1, 0, '192.168.10.2', CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0); INSERT INTO `dispose_task` VALUES (2, -1, 1, 0, '192.168.10.2', 1, CURRENT_TIMESTAMP, date_add(now(), interval 60 MINUTE), null, 2, 8796093022207, 1024, 0);
-- ---------------------------- -- ----------------------------
-- Table structure for user_account -- Table structure for user_account

View File

@ -144,7 +144,7 @@ public class DisposeTaskControllerTest extends InitTestEnvironment {
disposeTaskMapper.selectAll().forEach(v -> { disposeTaskMapper.selectAll().forEach(v -> {
if (v.getDeviceId().equals(Long.valueOf(req.getId())) && if (v.getDeviceId().equals(Long.valueOf(req.getId())) &&
v.getDisposeIp().equals(req.getDisposeIp()) && v.getDisposeObject().equals(req.getDisposeIp()) &&
v.getAttackType().equals((long) DDoSAttackType.ACK_FLOOD.getValue())) { v.getAttackType().equals((long) DDoSAttackType.ACK_FLOOD.getValue())) {
Assert.assertEquals(Long.valueOf(rspInfo.getMsgContent().getTaskId()), v.getId()); Assert.assertEquals(Long.valueOf(rspInfo.getMsgContent().getTaskId()), v.getId());
} }
@ -164,7 +164,7 @@ public class DisposeTaskControllerTest extends InitTestEnvironment {
TaskStartReq req = TaskStartReq.builder() TaskStartReq req = TaskStartReq.builder()
.id(String.valueOf(disposeTask.getDeviceId())) .id(String.valueOf(disposeTask.getDeviceId()))
.type(disposeTask.getDisposeCapacity().getValue()) .type(disposeTask.getDisposeCapacity().getValue())
.disposeIp(disposeTask.getDisposeIp()) .disposeIp(disposeTask.getDisposeObject())
.disposeTime(60) .disposeTime(60)
.flowDirection(NetflowDirection.DIRECTION_IN.getValue()) .flowDirection(NetflowDirection.DIRECTION_IN.getValue())
.attackType(new Integer[]{DDoSAttackType.ACK_FLOOD.getValue()}) .attackType(new Integer[]{DDoSAttackType.ACK_FLOOD.getValue()})

View File

@ -75,7 +75,7 @@ public class DisposeTaskManagerTest extends InitTestEnvironment {
@Test @Test
public void a1_disposeIpRunning() { public void a1_disposeIpRunning() {
disposeTaskMapper.selectAll().forEach(v -> { disposeTaskMapper.selectAll().forEach(v -> {
DisposeTask runningResult = disposeTaskManager.getDisposeTask(v.getDeviceId(), v.getDisposeIp(), DisposeTask runningResult = disposeTaskManager.getDisposeTask(v.getDeviceId(), v.getDisposeObject(),
v.getDisposeCapacity()); v.getDisposeCapacity());
log.info("runningResult-->{}", runningResult); log.info("runningResult-->{}", runningResult);
@ -178,7 +178,7 @@ public class DisposeTaskManagerTest extends InitTestEnvironment {
.deviceId(dId) .deviceId(dId)
.accountId(uId) .accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.0.1") .disposeObject("192.168.0.1")
.planEndTime("30") .planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI) .flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))

View File

@ -76,7 +76,7 @@ public class DisposeTaskMapperTest extends InitTestEnvironment {
.deviceId(dId) .deviceId(dId)
.accountId(uId) .accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.0.1") .disposeObject("192.168.0.1")
.planEndTime("30") .planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI) .flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))

View File

@ -98,7 +98,7 @@ public class DeviceTaskManagerServiceTest extends InitTestEnvironment {
.deviceId(dId) .deviceId(dId)
.accountId(uId) .accountId(uId)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.0.1") .disposeObject("192.168.0.1")
.planEndTime("30") .planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_BI) .flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))

View File

@ -99,7 +99,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId()) .deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId())
.accountId(1L) .accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.5.2") .disposeObject("192.168.5.2")
.planEndTime("30") .planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_IN) .flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
@ -124,7 +124,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
Assert.assertEquals(result.getFirstParam().getCode(), ErrorCode.ERR_TASKRUNNING.getCode()); Assert.assertEquals(result.getFirstParam().getCode(), ErrorCode.ERR_TASKRUNNING.getCode());
Assert.assertEquals(result.getSecondParam().getId(), disposeTaskManager.getDisposeTask(newTask.getDeviceId(), Assert.assertEquals(result.getSecondParam().getId(), disposeTaskManager.getDisposeTask(newTask.getDeviceId(),
newTask.getDisposeIp(), newTask.getDisposeCapacity()).getId()); newTask.getDisposeObject(), newTask.getDisposeCapacity()).getId());
}); });
} }
@ -137,7 +137,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId()) .deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId())
.accountId(1L) .accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.5.2") .disposeObject("192.168.5.2")
.planEndTime("30") .planEndTime("30")
.flowDirection(NetflowDirection.DIRECTION_IN) .flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))
@ -175,7 +175,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
.deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId()) .deviceId(disposeDeviceManager.getAllNormalDisposeDevices().get(0).getId())
.accountId(1L) .accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.10.2") .disposeObject("192.168.10.2")
.planEndTime("60") .planEndTime("60")
.flowDirection(NetflowDirection.DIRECTION_IN) .flowDirection(NetflowDirection.DIRECTION_IN)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new Integer[]{DDoSAttackType.ALL_ATTACKS.getValue()}))

View File

@ -54,7 +54,7 @@ public class JsonTestCaseRun extends CommonRestfulJson implements TestCaseRun {
/** /**
* The constant jsonIdFilter. * The constant jsonIdFilter.
*/ */
private static final Integer[] jsonIdFilter = new Integer[]{}; private static final Integer[] jsonIdFilter = new Integer[]{5};
/** /**
* The Spring method rule. * The Spring method rule.
*/ */

View File

@ -100,7 +100,7 @@ public class P2TaskList {
.deviceId(1L) .deviceId(1L)
.accountId(1L) .accountId(1L)
.disposeCapacity(DisposeCapacityType.CLEANUP) .disposeCapacity(DisposeCapacityType.CLEANUP)
.disposeIp("192.168.0." + i) .disposeObject("192.168.0." + i)
.planEndTime("60") .planEndTime("60")
.flowDirection(NetflowDirection.DIRECTION_BI) .flowDirection(NetflowDirection.DIRECTION_BI)
.attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS})) .attackType(DDoSAttackType.getTypeMaskFromAttackType(new DDoSAttackType[]{DDoSAttackType.ALL_ATTACKS}))