parent
20c56c79ba
commit
0e91b3a064
|
@ -275,7 +275,7 @@ public class DpTechAbilityImpl implements DisposeAbility {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
||||||
return DpTechAttackType.formDdosAttackTypeMaks(ddosAttackTypeMask);
|
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[] {DpTechAttackType.UDP_FLOOD});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
private final Hashtable<String, ServiceInfo> disposeServiceGroup = new Hashtable<>();
|
private final Hashtable<String, ServiceInfo> disposeServiceGroup = new Hashtable<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Obj prefix.
|
* The Object prefix.
|
||||||
*/
|
*/
|
||||||
private final String objectPrefix = "CMHI";
|
private final String objectPrefix = "CMHI";
|
||||||
/**
|
/**
|
||||||
|
@ -1026,4 +1026,15 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
|
|
||||||
return super.deviceReady();
|
return super.deviceReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To device attack type long.
|
||||||
|
*
|
||||||
|
* @param ddosAttackTypeMask the ddos attack type mask
|
||||||
|
* @return the long
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
||||||
|
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[] {DpTechAttackType.AUTO_ATTACK_TYPE});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,73 +135,75 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
|
|
||||||
// 启动迪普设备,采用一种攻击类型
|
// 启动迪普设备,采用一种攻击类型
|
||||||
DpTechAttackType attackType = DpTechAttackType.maskToDdosAttackType(deviceTask.getTaskAttackType()).get(0);
|
DpTechAttackType attackType = DpTechAttackType.maskToDdosAttackType(deviceTask.getTaskAttackType()).get(0);
|
||||||
// 出方向
|
// 出方向
|
||||||
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_IN) {
|
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_IN) {
|
||||||
// 设置启动任务攻击类型状态
|
// 设置启动任务攻击类型状态
|
||||||
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
|
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
|
||||||
attackType.getValue());
|
attackType.getValue());
|
||||||
// 调用迪普设备启动处置任务
|
// 调用迪普设备启动处置任务
|
||||||
ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getObjectType(),
|
ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getObjectType(),
|
||||||
disposeTask.getDisposeCapacity(), NetflowDirection.DIRECTION_OUT,
|
disposeTask.getDisposeCapacity(), NetflowDirection.DIRECTION_OUT,
|
||||||
attackType.getValue(), null);
|
attackType.getValue(), null);
|
||||||
|
|
||||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||||
// 标志启动成功
|
// 标志启动成功
|
||||||
deviceTaskManager.attackTypeStatusSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
|
deviceTaskManager.attackTypeStatusSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
|
||||||
attackType.getValue());
|
attackType.getValue());
|
||||||
|
|
||||||
log.info("DPTECH_UMC setup task {}, {} succeed: {}", attackType, NetflowDirection.DIRECTION_OUT, deviceTask);
|
log.info("DPTECH_UMC setup task {}, {} succeed: {}", attackType, NetflowDirection.DIRECTION_OUT,
|
||||||
|
deviceTask);
|
||||||
|
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
||||||
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES * 10) {
|
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES * 10) {
|
||||||
// 设置该任务为新任务,待下次重试启动
|
// 设置该任务为新任务,待下次重试启动
|
||||||
// 记录任务出错重试次数
|
// 记录任务出错重试次数
|
||||||
deviceTask.setErrRetry(deviceTask.getErrRetry() + 1);
|
deviceTask.setErrRetry(deviceTask.getErrRetry() + 1);
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry());
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry());
|
||||||
//清除任务攻击类型启动标志
|
//清除任务攻击类型启动标志
|
||||||
deviceTaskManager.execAttackTypeCleanBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
|
deviceTaskManager.execAttackTypeCleanBit(deviceTask.getId(), NetflowDirection.DIRECTION_OUT,
|
||||||
attackType.getValue());
|
attackType.getValue());
|
||||||
log.error("DPTECH_UMC setup task {}, {} times {} error: {}", attackType,
|
log.error("DPTECH_UMC setup task {}, {} times {} error: {}", attackType,
|
||||||
NetflowDirection.DIRECTION_OUT, deviceTask.getErrRetry(), deviceTask);
|
NetflowDirection.DIRECTION_OUT, deviceTask.getErrRetry(), deviceTask);
|
||||||
} else {
|
} else {
|
||||||
log.error("DPTECH_UMC setup task {}, {} error {}: {}", attackType,
|
log.error("DPTECH_UMC setup task {}, {} error {}: {}", attackType,
|
||||||
NetflowDirection.DIRECTION_OUT, ret.getFirstParam(), deviceTask);
|
NetflowDirection.DIRECTION_OUT, ret.getFirstParam(), deviceTask);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 入方向
|
// 入方向
|
||||||
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_OUT) {
|
if (disposeTask.getFlowDirection() != NetflowDirection.DIRECTION_OUT) {
|
||||||
// 设置启动任务攻击类型状态
|
// 设置启动任务攻击类型状态
|
||||||
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
|
deviceTaskManager.execAttackTypeSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
|
||||||
attackType.getValue());
|
attackType.getValue());
|
||||||
// 调用迪普设备启动处置任务
|
// 调用迪普设备启动处置任务
|
||||||
ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getObjectType(),
|
ret = ai.getDb().runDispose(disposeTask.getDisposeObject(), disposeTask.getObjectType(),
|
||||||
disposeTask.getDisposeCapacity(), NetflowDirection.DIRECTION_IN,
|
disposeTask.getDisposeCapacity(), NetflowDirection.DIRECTION_IN,
|
||||||
attackType.getValue(), null);
|
attackType.getValue(), null);
|
||||||
|
|
||||||
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
if (ret.getFirstParam() == ErrorCode.ERR_OK) {
|
||||||
// 标志启动成功
|
// 标志启动成功
|
||||||
deviceTaskManager.attackTypeStatusSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
|
deviceTaskManager.attackTypeStatusSetBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
|
||||||
attackType.getValue());
|
attackType.getValue());
|
||||||
|
|
||||||
log.info("DPTECH_UMC setup task {}, {} succeed: {}", attackType, NetflowDirection.DIRECTION_IN, deviceTask);
|
log.info("DPTECH_UMC setup task {}, {} succeed: {}", attackType, NetflowDirection.DIRECTION_IN,
|
||||||
|
deviceTask);
|
||||||
|
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), 0);
|
||||||
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES * 10) {
|
} else if (deviceTask.getErrRetry() < DisposeConfigValue.CALL_ERROR_RETRY_TIMES * 10) {
|
||||||
// 设置该任务为新任务,待下次重试启动
|
// 设置该任务为新任务,待下次重试启动
|
||||||
// 记录任务出错重试次数
|
// 记录任务出错重试次数
|
||||||
deviceTask.setErrRetry(deviceTask.getErrRetry() + 1);
|
deviceTask.setErrRetry(deviceTask.getErrRetry() + 1);
|
||||||
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry());
|
deviceTaskManager.setTaskErrRetryTimes(deviceTask.getId(), deviceTask.getErrRetry());
|
||||||
//清除任务攻击类型启动标志
|
//清除任务攻击类型启动标志
|
||||||
deviceTaskManager.execAttackTypeCleanBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
|
deviceTaskManager.execAttackTypeCleanBit(deviceTask.getId(), NetflowDirection.DIRECTION_IN,
|
||||||
attackType.getValue());
|
attackType.getValue());
|
||||||
log.error("DPTECH_UMC setup task {}, {} times {} error: {}", attackType,
|
log.error("DPTECH_UMC setup task {}, {} times {} error: {}", attackType,
|
||||||
NetflowDirection.DIRECTION_IN, deviceTask.getErrRetry(), deviceTask);
|
NetflowDirection.DIRECTION_IN, deviceTask.getErrRetry(), deviceTask);
|
||||||
} else {
|
} else {
|
||||||
log.error("DPTECH_UMC setup task {}, {} error {}: {}", attackType,
|
log.error("DPTECH_UMC setup task {}, {} error {}: {}", attackType,
|
||||||
NetflowDirection.DIRECTION_IN, ret.getFirstParam(), deviceTask);
|
NetflowDirection.DIRECTION_IN, ret.getFirstParam(), deviceTask);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 检查需要处置的各种攻击类型任务启动状态与处置任务执行状态,判断该处置任务是否调用成功
|
// 检查需要处置的各种攻击类型任务启动状态与处置任务执行状态,判断该处置任务是否调用成功
|
||||||
|
@ -482,9 +484,10 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
|
||||||
.forEach(d -> {
|
.forEach(d -> {
|
||||||
log.info("Add dispose task for device: {}", d.getDev());
|
log.info("Add dispose task for device: {}", d.getDev());
|
||||||
|
|
||||||
if (!deviceTaskManager.addDisposeDeviceTaskInfo(v.getId(), d.getDev().getId(),
|
if (!deviceTaskManager
|
||||||
d.getDb()
|
.addDisposeDeviceTaskInfo(v.getId(),
|
||||||
.toDeviceAttackType(v.getAttackType()))) {
|
d.getDev().getId(),
|
||||||
|
d.getDb().toDeviceAttackType(v.getAttackType()))) {
|
||||||
log.error("Add task {} to device {} error", v, d);
|
log.error("Add task {} to device {} error", v, d);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue