parent
cc35b50dcb
commit
fea3f7d971
|
@ -12,6 +12,8 @@ import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.huawei.dispose.common.HuaWeiLoginResp;
|
import com.huawei.dispose.common.HuaWeiLoginResp;
|
||||||
import com.huawei.dispose.protocol.HuaWeiInterface;
|
import com.huawei.dispose.protocol.HuaWeiInterface;
|
||||||
|
import inet.ipaddr.IPAddress;
|
||||||
|
import inet.ipaddr.IPAddressString;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -93,7 +95,15 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
@Nullable Integer attackType,
|
@Nullable Integer attackType,
|
||||||
@Nullable Long duration) {
|
@Nullable Long duration) {
|
||||||
String url = urlRootPath + "/divert";
|
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) {
|
if (token == null || token.length() == 0) {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_LOGOUT, "");
|
return new MulReturnType<>(ErrorCode.ERR_LOGOUT, "");
|
||||||
|
@ -151,7 +161,15 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
@Nullable Integer attackType,
|
@Nullable Integer attackType,
|
||||||
@Nullable String taskId) {
|
@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;
|
String url = urlRootPath + "/divert/" + disposeObj;
|
||||||
|
|
||||||
if (token == null || token.length() == 0) {
|
if (token == null || token.length() == 0) {
|
||||||
|
|
Loading…
Reference in New Issue