REM:
1.华为设备启动和停止任务时增加Ipv6地址
This commit is contained in:
chenlinghy 2020-12-08 14:51:19 +08:00
parent cc35b50dcb
commit fea3f7d971
1 changed files with 20 additions and 2 deletions

View File

@ -12,6 +12,8 @@ import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huawei.dispose.common.HuaWeiLoginResp;
import com.huawei.dispose.protocol.HuaWeiInterface;
import inet.ipaddr.IPAddress;
import inet.ipaddr.IPAddressString;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -93,7 +95,15 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
@Nullable Integer attackType,
@Nullable Long duration) {
String url = urlRootPath + "/divert";
String disposeObj = disposeObject + "/32";
String disposeObj = null;
IPAddress addr = new IPAddressString(disposeObject).getAddress();
if (addr.isIPv4()) {
disposeObj = disposeObject + "/32";
}else if(addr.isIPv6()) {
disposeObj = disposeObject + "/128";
}
if (token == null || token.length() == 0) {
return new MulReturnType<>(ErrorCode.ERR_LOGOUT, "");
@ -151,7 +161,15 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
@Nullable Integer attackType,
@Nullable String taskId) {
String disposeObj = disposeObject + "-32";
IPAddress addr = new IPAddressString(disposeObject).getAddress();
String disposeObj = null;
if (addr.isIPv4()) {
disposeObj = disposeObject + "-32";
}else if(addr.isIPv6()) {
disposeObj = disposeObject + "-128";
}
String url = urlRootPath + "/divert/" + disposeObj;
if (token == null || token.length() == 0) {