Merge branch 'v2.0.1_dev' into 'master'
# Conflicts: # src/main/resources/db/data.sql # src/test/java/com/dispose/test/dev/function/CryptoHelperTest.java
This commit is contained in:
commit
abea651564
2
pom.xml
2
pom.xml
|
@ -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>
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -74,12 +74,12 @@ public interface DisposeTaskMapper {
|
||||||
*
|
*
|
||||||
* @param deviceId the device id
|
* @param deviceId the device id
|
||||||
* @param capType the cap type
|
* @param capType the cap type
|
||||||
* @param disposeIp the dispose ip
|
* @param disposeObject the dispose object
|
||||||
* @return the running task
|
* @return the running task
|
||||||
*/
|
*/
|
||||||
DisposeTask getRunningTask(@Param("deviceId") Long deviceId,
|
DisposeTask getRunningTask(@Param("deviceId") Long deviceId,
|
||||||
@Param("capType") DisposeCapacityType capType,
|
@Param("capType") DisposeCapacityType capType,
|
||||||
@Param("disposeIp") String disposeIp);
|
@Param("disposeObject") String disposeObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets new task.
|
* Gets new task.
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -568,12 +568,12 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
@Scheduled(fixedDelay = 1000)
|
@Scheduled(fixedDelay = 1000)
|
||||||
public void scheduleRunnerThread() {
|
public void scheduleRunnerThread() {
|
||||||
// 处理处置任务数据
|
// 处理处置任务数据
|
||||||
disposeTaskManagerSchedule();
|
//disposeTaskManagerSchedule();
|
||||||
|
|
||||||
// 处置设备启动任务
|
// 处置设备启动任务
|
||||||
deviceTaskRunnerSchedule();
|
//deviceTaskRunnerSchedule();
|
||||||
|
|
||||||
// 处置设备停止任务
|
// 处置设备停止任务
|
||||||
deviceTaskStopSchedule();
|
//deviceTaskStopSchedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of dispose_device
|
-- Records of dispose_device
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `dispose_device` VALUES (1, '10.88.77.15', '', 0, 0, '中移杭研实验室迪普清洗设备', 'DPTech', 'UMC', '5.7.13', 'admin', 'UMCAdministrator', 'UMC/service/AbnormalFlowCleaningService', 0, '实验室测试设备', 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.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);
|
||||||
|
|
||||||
|
|
||||||
-- id, deviceId, capacityType, objectType, ipType, protectIp, reserveNetflow
|
-- id, deviceId, capacityType, objectType, ipType, protectIp, reserveNetflow
|
||||||
|
|
|
@ -1,117 +1,129 @@
|
||||||
/*
|
/*
|
||||||
Navicat Premium Data Transfer
|
Navicat Premium Data Transfer
|
||||||
|
|
||||||
|
Source Server : 测试环境MySQL服务器
|
||||||
Source Server Type : MySQL
|
Source Server Type : MySQL
|
||||||
Source Server Version : 50723
|
Source Server Version : 50731
|
||||||
|
Source Host : 10.88.77.65:33061
|
||||||
|
Source Schema : ci_dispose_v2
|
||||||
|
|
||||||
Target Server Type : MySQL
|
Target Server Type : MySQL
|
||||||
Target Server Version : 50723
|
Target Server Version : 50731
|
||||||
File Encoding : 65001
|
File Encoding : 65001
|
||||||
|
|
||||||
Date: 29/06/2020 14:32:25
|
Date: 11/09/2020 00:46:15
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for task_info
|
-- Table structure for device_task
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `task_info`;
|
DROP TABLE IF EXISTS `device_task`;
|
||||||
CREATE TABLE `task_info`
|
CREATE TABLE `device_task` (
|
||||||
(
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符',
|
||||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '任务信息唯一标识符',
|
`taskId` int(11) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符',
|
||||||
`taskId` int(10) UNSIGNED NOT NULL COMMENT '处置任务唯一标识符',
|
|
||||||
`deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符',
|
`deviceId` int(10) UNSIGNED NOT NULL COMMENT '处置设备唯一标识符',
|
||||||
`beginTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '任务开始时间',
|
`beginTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务开始时间',
|
||||||
`endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间',
|
`endTime` timestamp(0) NULL DEFAULT NULL COMMENT '任务结束时间',
|
||||||
`externId` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '扩展ID(供浩瀚处置任务使用)',
|
`taskAttackType` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '需要处置的攻击类型',
|
||||||
`status` int(10) NOT NULL DEFAULT 0 COMMENT '任务状态',
|
`execAttackTypeIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Input)',
|
||||||
|
`attackTypeStatusIn` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
|
||||||
|
`execAttackTypeOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已经执行处置的攻击类型(Output)',
|
||||||
|
`attackTypeStatusOut` bigint(255) UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行的攻击类型状态(Input)',
|
||||||
|
`externId` int(11) NULL DEFAULT NULL COMMENT '扩展任务ID',
|
||||||
|
`errRetry` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '调用失败重试次数',
|
||||||
|
`status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '任务状态',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
INDEX `task_info_ibfk_1`(`taskId`) USING BTREE,
|
INDEX `task_info_ibfk_1`(`taskId`) USING BTREE,
|
||||||
INDEX `task_info_ibfk_2`(`deviceId`) USING BTREE,
|
INDEX `task_info_ibfk_2`(`deviceId`) USING BTREE,
|
||||||
CONSTRAINT `task_info_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT,
|
CONSTRAINT `device_task_ibfk_1` FOREIGN KEY (`taskId`) REFERENCES `dispose_task` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
CONSTRAINT `task_info_ibfk_2` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT
|
CONSTRAINT `device_task_ibfk_2` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
AUTO_INCREMENT = 1
|
|
||||||
CHARACTER SET = utf8
|
|
||||||
COLLATE = utf8_general_ci
|
|
||||||
ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for dispose_task
|
-- Table structure for dispose_capacity
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `dispose_task`;
|
DROP TABLE IF EXISTS `dispose_capacity`;
|
||||||
CREATE TABLE `dispose_task`
|
CREATE TABLE `dispose_capacity` (
|
||||||
(
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备处置能力唯一标识符',
|
||||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符',
|
`deviceId` int(11) UNSIGNED NOT NULL COMMENT '设备ID',
|
||||||
`deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
|
`capacityType` int(8) NOT NULL COMMENT '处置能力:\r\n0:清洗\r\n1:高防 \r\n2:路由黑洞 \r\n3:检测\r\n4:WAF封堵\r\n',
|
||||||
`accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
|
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0:IP\r\n1:域名 \r\n2:URL',
|
||||||
`type` int(11) UNSIGNED NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测',
|
`ipType` int(8) NOT NULL DEFAULT 3 COMMENT 'IP 地址类型:\r\n1 << 0:支持IPV4\r\n1 << 1:支持IPV6',
|
||||||
`disposeIp` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置IP',
|
`protectIp` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '该处置能力能够处置的IP',
|
||||||
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '开始时间',
|
`reserveNetflow` int(11) NULL DEFAULT NULL COMMENT '清洗能力储备流量值,单位(G)',
|
||||||
`planEndTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '计划结束时间',
|
|
||||||
`endTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '实际结束时间',
|
|
||||||
`flowDirection` int(11) NULL DEFAULT 2 COMMENT '流量方向, 0:流入;1:流出;2:双向',
|
|
||||||
`attackType` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '攻击类型,默认0, 全部攻击',
|
|
||||||
`flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽',
|
|
||||||
`currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:新建;1:运行中;2:停止;3:停止;4:删除',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
INDEX `dispose_task_device_capacity_id_fk` (`type`) USING BTREE,
|
INDEX `id`(`deviceId`) USING BTREE,
|
||||||
INDEX `dispose_task_user_account_id_fk` (`accountId`) USING BTREE,
|
CONSTRAINT `dispose_capacity_ibfk_1` FOREIGN KEY (`deviceId`) REFERENCES `dispose_device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
CONSTRAINT `dispose_task_ibfk_1` FOREIGN KEY (`accountId`) REFERENCES `user_account` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
) ENGINE = InnoDB
|
|
||||||
AUTO_INCREMENT = 1
|
|
||||||
CHARACTER SET = utf8
|
|
||||||
COLLATE = utf8_general_ci
|
|
||||||
ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for dispose_device
|
-- Table structure for dispose_device
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `dispose_device`;
|
DROP TABLE IF EXISTS `dispose_device`;
|
||||||
CREATE TABLE `dispose_device`
|
CREATE TABLE `dispose_device` (
|
||||||
(
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符',
|
||||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识符',
|
`ipAddr` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备IP地址, IPv4/IPv6',
|
||||||
`ipAddr` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备IP地址, IPv4/IPv6',
|
`ipPort` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '端口',
|
||||||
`type` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型,0:迪普UMC平台,1:浩瀚设备',
|
`deviceType` int(11) NOT NULL DEFAULT 0 COMMENT '能力节点类型,0:迪普UMC平台,1:浩瀚设备',
|
||||||
`areaCode` int(11) NULL DEFAULT NULL COMMENT '设备物理位置区域码',
|
`areaCode` int(11) NOT NULL COMMENT '设备物理位置区域码',
|
||||||
`name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
|
`deviceName` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称',
|
||||||
`manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商',
|
`manufacturer` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '生产厂商',
|
||||||
`model` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '型号',
|
`model` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '型号',
|
||||||
`version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
|
`version` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '软件版本',
|
||||||
`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理用户名',
|
`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理用户名',
|
||||||
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
|
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '系统管理密码',
|
||||||
`url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'URL类型',
|
`urlPath` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'URL路径',
|
||||||
`readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
|
`urlType` int(11) NOT NULL DEFAULT 0 COMMENT 'URL类型: 0: HTTP, 1: HTTPS',
|
||||||
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:正常, 1:删除',
|
`readme` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注',
|
||||||
|
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:正常,1:锁定,2:禁用, 3:删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE INDEX `ipAddr` (`ipAddr`) USING BTREE
|
INDEX `ipAddr`(`ipAddr`) USING BTREE
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
AUTO_INCREMENT = 1
|
|
||||||
CHARACTER SET = utf8
|
-- ----------------------------
|
||||||
COLLATE = utf8_general_ci
|
-- Table structure for dispose_task
|
||||||
ROW_FORMAT = Dynamic;
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `dispose_task`;
|
||||||
|
CREATE TABLE `dispose_task` (
|
||||||
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '处置任务唯一标识符',
|
||||||
|
`deviceId` int(10) NOT NULL COMMENT '处置设备唯一标识符',
|
||||||
|
`accountId` int(10) UNSIGNED NOT NULL COMMENT '用户唯一标识符',
|
||||||
|
`disposeCapacity` int(11) NOT NULL COMMENT '处置能力类型:0:清洗 1:高防 2:黑洞 3:检测',
|
||||||
|
`disposeObject` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '处置对象',
|
||||||
|
`objectType` int(8) NOT NULL COMMENT '处置对象类型:\r\n0:IP\r\n1:域名 \r\n2:URL',
|
||||||
|
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) 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 '实际结束时间',
|
||||||
|
`flowDirection` int(11) NOT NULL DEFAULT 2 COMMENT '流量方向, 0:流入;1:流出;2:双向',
|
||||||
|
`attackType` bigint(20) UNSIGNED NOT NULL DEFAULT 18446744073709551615 COMMENT '攻击类型,默认0, 全部攻击',
|
||||||
|
`flowBandWidth` int(10) UNSIGNED NULL DEFAULT 1024 COMMENT '攻击流量占用带宽(MB)',
|
||||||
|
`currentStatus` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0:停止。1:启动',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `dispose_task_device_capacity_id_fk`(`disposeCapacity`) USING BTREE,
|
||||||
|
INDEX `dispose_task_user_account_id_fk`(`accountId`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for user_account
|
-- Table structure for user_account
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `user_account`;
|
DROP TABLE IF EXISTS `user_account`;
|
||||||
CREATE TABLE `user_account`
|
CREATE TABLE `user_account` (
|
||||||
(
|
|
||||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号',
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户唯一编号',
|
||||||
`username` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
|
`username` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名',
|
||||||
`password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
|
`password` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
|
||||||
`lastLoginTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后一次成功登录时间',
|
`createTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
|
||||||
|
`operators` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '操作员',
|
||||||
|
`lastLoginTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '最后一次成功登录时间',
|
||||||
|
`token` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '用户token',
|
||||||
|
`lastAccess` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '最后一次访问时间戳',
|
||||||
`lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间',
|
`lockTime` timestamp(0) NOT NULL DEFAULT '1970-01-02 00:00:00' COMMENT '账户锁定时间',
|
||||||
`status` int(11) NULL DEFAULT NULL COMMENT '账户状态',
|
`pwdErrTimes` int(10) NOT NULL DEFAULT 0 COMMENT '密码错误次数',
|
||||||
|
`status` int(11) NULL DEFAULT 0 COMMENT '账户状态',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
UNIQUE INDEX `USERNAME`(`username`) USING BTREE
|
UNIQUE INDEX `USERNAME`(`username`) USING BTREE
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
AUTO_INCREMENT = 1
|
|
||||||
CHARACTER SET = utf8
|
|
||||||
COLLATE = utf8_general_ci
|
|
||||||
ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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\n0:IP\r\n1:域名 \r\n2:URL',
|
||||||
`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
|
||||||
|
|
|
@ -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()})
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.dispose.test.dev.manager;
|
||||||
|
|
||||||
import com.dispose.common.DDoSAttackType;
|
import com.dispose.common.DDoSAttackType;
|
||||||
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.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
import com.dispose.common.NetflowDirection;
|
import com.dispose.common.NetflowDirection;
|
||||||
|
@ -75,7 +76,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 +179,8 @@ 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")
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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}))
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.dispose.test.dev.mapper;
|
||||||
|
|
||||||
import com.dispose.common.DDoSAttackType;
|
import com.dispose.common.DDoSAttackType;
|
||||||
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.dispose.mapper.DisposeDeviceMapper;
|
import com.dispose.mapper.DisposeDeviceMapper;
|
||||||
|
@ -76,7 +77,8 @@ 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")
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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}))
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.dispose.test.dev.service;
|
||||||
|
|
||||||
import com.dispose.common.DDoSAttackType;
|
import com.dispose.common.DDoSAttackType;
|
||||||
import com.dispose.common.DisposeCapacityType;
|
import com.dispose.common.DisposeCapacityType;
|
||||||
|
import com.dispose.common.DisposeObjectType;
|
||||||
import com.dispose.common.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
import com.dispose.common.NetflowDirection;
|
import com.dispose.common.NetflowDirection;
|
||||||
import com.dispose.manager.DisposeDeviceManager;
|
import com.dispose.manager.DisposeDeviceManager;
|
||||||
|
@ -98,7 +99,8 @@ 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")
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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}))
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.dispose.test.dev.service;
|
||||||
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.DisposeTaskStatus;
|
import com.dispose.common.DisposeTaskStatus;
|
||||||
import com.dispose.common.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
import com.dispose.common.NetflowDirection;
|
import com.dispose.common.NetflowDirection;
|
||||||
|
@ -99,7 +100,8 @@ 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")
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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 +126,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 +139,8 @@ 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")
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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 +178,8 @@ 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")
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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()}))
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.dispose.test.testcase.qa.v200;
|
||||||
|
|
||||||
import com.dispose.common.DDoSAttackType;
|
import com.dispose.common.DDoSAttackType;
|
||||||
import com.dispose.common.DisposeCapacityType;
|
import com.dispose.common.DisposeCapacityType;
|
||||||
|
import com.dispose.common.DisposeObjectType;
|
||||||
import com.dispose.common.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
import com.dispose.common.NetflowDirection;
|
import com.dispose.common.NetflowDirection;
|
||||||
import com.dispose.pojo.dto.protocol.task.GetTaskRsp;
|
import com.dispose.pojo.dto.protocol.task.GetTaskRsp;
|
||||||
|
@ -100,7 +101,8 @@ 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)
|
||||||
|
.objectType(DisposeObjectType.IP)
|
||||||
.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}))
|
||||||
|
|
Loading…
Reference in New Issue