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