parent
f7599efa4b
commit
fcd5f3b836
|
@ -177,7 +177,7 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
||||||
|
|
||||||
if (tDev.getDevCapacity().size() != 0) {
|
if (tDev.getDevCapacity().size() != 0) {
|
||||||
tDev.getDevCapacity().forEach(v -> {
|
tDev.getDevCapacity().forEach(v -> {
|
||||||
v.setDeviceId(dev.getId());
|
v.setDeviceId(devId);
|
||||||
if (v.getIpType() == null) {
|
if (v.getIpType() == null) {
|
||||||
v.setIpType(IpAddrType.IPV4_IPV6);
|
v.setIpType(IpAddrType.IPV4_IPV6);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,14 +72,14 @@ public interface DisposeTaskMapper {
|
||||||
/**
|
/**
|
||||||
* Gets running task.
|
* Gets running task.
|
||||||
*
|
*
|
||||||
* @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.
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeObject, objectType,
|
INSERT IGNORE INTO dispose_task(deviceId, accountId, disposeCapacity, disposeObject, objectType,
|
||||||
planEndTime, flowDirection, attackType, flowBandWidth,
|
planEndTime, flowDirection, attackType, flowBandWidth,
|
||||||
currentStatus)
|
currentStatus)
|
||||||
VALUES (#{deviceId}, #{accountId}, #{disposeCapacity}, #{disposeObject}, ${objectType},
|
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>
|
||||||
|
|
|
@ -8,10 +8,8 @@ import org.junit.Test;
|
||||||
import javax.crypto.BadPaddingException;
|
import javax.crypto.BadPaddingException;
|
||||||
import javax.crypto.IllegalBlockSizeException;
|
import javax.crypto.IllegalBlockSizeException;
|
||||||
import javax.crypto.NoSuchPaddingException;
|
import javax.crypto.NoSuchPaddingException;
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
@ -107,22 +105,22 @@ public class CryptoHelperTest {
|
||||||
String testEncValue1 = "P3mq9iSIvQcvfyfdWR8sAnfAadO";
|
String testEncValue1 = "P3mq9iSIvQcvfyfdWR8sAnfAadO";
|
||||||
String testEncValue2 = "h0K0_8u";
|
String testEncValue2 = "h0K0_8u";
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
// BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||||
log.info("Version Information:");
|
// log.info("Version Information:");
|
||||||
while (true) {
|
// while (true) {
|
||||||
String val = reader.readLine();
|
// String val = reader.readLine();
|
||||||
log.info("{}", val);
|
// log.info("{}", val);
|
||||||
|
//
|
||||||
|
// if (val == null) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (val.startsWith("git.commit.id=")) {
|
||||||
|
// password = val.substring("git.commit.id=".length());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (val == null) {
|
password = "63debfca1d2dc72af38014a7bb6f567202cc1345" + "cmcc@10086!";
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (val.startsWith("git.commit.id=")) {
|
|
||||||
password = val.substring("git.commit.id=".length());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
password = password + "cmcc@10086!";
|
|
||||||
|
|
||||||
byte[] encode = CryptoHelper.aes256Encryption(testEncValue.getBytes(StandardCharsets.UTF_8), password);
|
byte[] encode = CryptoHelper.aes256Encryption(testEncValue.getBytes(StandardCharsets.UTF_8), password);
|
||||||
Assert.assertEquals(CryptoHelper.base64Encryption(encode), "Trf2LEETes3oKnY1CF7LINcm2KlJbJxHIyvERz2174CTzQEhJtuo+PnO+fR3eDf+");
|
Assert.assertEquals(CryptoHelper.base64Encryption(encode), "Trf2LEETes3oKnY1CF7LINcm2KlJbJxHIyvERz2174CTzQEhJtuo+PnO+fR3eDf+");
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -179,6 +180,7 @@ public class DisposeTaskManagerTest extends InitTestEnvironment {
|
||||||
.accountId(uId)
|
.accountId(uId)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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;
|
||||||
|
@ -77,6 +78,7 @@ public class DisposeTaskMapperTest extends InitTestEnvironment {
|
||||||
.accountId(uId)
|
.accountId(uId)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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;
|
||||||
|
@ -99,6 +100,7 @@ public class DeviceTaskManagerServiceTest extends InitTestEnvironment {
|
||||||
.accountId(uId)
|
.accountId(uId)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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;
|
||||||
|
@ -100,6 +101,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
|
||||||
.accountId(1L)
|
.accountId(1L)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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()}))
|
||||||
|
@ -138,6 +140,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
|
||||||
.accountId(1L)
|
.accountId(1L)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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()}))
|
||||||
|
@ -176,6 +179,7 @@ public class DisposeTaskServiceTest extends InitTestEnvironment {
|
||||||
.accountId(1L)
|
.accountId(1L)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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()}))
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class JsonTestCaseRun extends CommonRestfulJson implements TestCaseRun {
|
||||||
/**
|
/**
|
||||||
* The constant jsonIdFilter.
|
* The constant jsonIdFilter.
|
||||||
*/
|
*/
|
||||||
private static final Integer[] jsonIdFilter = new Integer[]{5};
|
private static final Integer[] jsonIdFilter = new Integer[]{};
|
||||||
/**
|
/**
|
||||||
* The Spring method rule.
|
* The Spring method rule.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -101,6 +102,7 @@ public class P2TaskList {
|
||||||
.accountId(1L)
|
.accountId(1L)
|
||||||
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
.disposeCapacity(DisposeCapacityType.CLEANUP)
|
||||||
.disposeObject("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