parent
1278d69e87
commit
bc0bbf2524
|
@ -14,6 +14,7 @@ import com.dispose.common.NetflowDirection;
|
||||||
import com.dispose.pojo.entity.ServiceInfo;
|
import com.dispose.pojo.entity.ServiceInfo;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||||
|
import com.dispose.security.arithmetic.CryptoHelper;
|
||||||
import com.dptech.dispose.AbnormalFlowCleaningServicePortType;
|
import com.dptech.dispose.AbnormalFlowCleaningServicePortType;
|
||||||
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
|
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
|
||||||
import com.dptech.dispose.NtcRequestResultInfo;
|
import com.dptech.dispose.NtcRequestResultInfo;
|
||||||
|
@ -101,7 +102,7 @@ public class DpTechAbilityImpl implements DisposeAbility {
|
||||||
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
|
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
|
||||||
|
|
||||||
Map<String, Object> ctx = ((BindingProvider) this.cleanTypePort).getRequestContext();
|
Map<String, Object> ctx = ((BindingProvider) this.cleanTypePort).getRequestContext();
|
||||||
ctx.put("password", password);
|
ctx.put("password", new String(CryptoHelper.base64Decryption(password)));
|
||||||
ctx.put("username", username);
|
ctx.put("username", username);
|
||||||
|
|
||||||
// 配置连接,访问超时时间
|
// 配置连接,访问超时时间
|
||||||
|
@ -145,24 +146,24 @@ public class DpTechAbilityImpl implements DisposeAbility {
|
||||||
log.debug("DpTech startAbnormalTaskForUMC request: {}, {}, {}", disposeObject, attackType, nfDirection);
|
log.debug("DpTech startAbnormalTaskForUMC request: {}, {}, {}", disposeObject, attackType, nfDirection);
|
||||||
|
|
||||||
NtcRequestResultInfo ret = cleanTypePort.startAbnormalTaskForUMC(disposeObject, attackType,
|
NtcRequestResultInfo ret = cleanTypePort.startAbnormalTaskForUMC(disposeObject, attackType,
|
||||||
nfDirection.getValue());
|
nfDirection.getValue());
|
||||||
|
|
||||||
log.debug("DpTech startAbnormalTaskForUMC response: {}", ret);
|
log.debug("DpTech startAbnormalTaskForUMC response: {}", ret);
|
||||||
|
|
||||||
if (ret.getResultRetVal() != 0) {
|
if (ret.getResultRetVal() != 0) {
|
||||||
err = ErrorCode.ERR_CALLDEVICE;
|
err = ErrorCode.ERR_CALLDEVICE;
|
||||||
log.error("----Error DPTech Start Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
log.error("----Error DPTech Start Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
||||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||||
ret.getResultInfo().getValue());
|
ret.getResultInfo().getValue());
|
||||||
} else {
|
} else {
|
||||||
log.debug("----Finish DPTech Start Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
log.debug("----Finish DPTech Start Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
||||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||||
ret.getResultInfo().getValue());
|
ret.getResultInfo().getValue());
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
err = ErrorCode.ERR_SYSTEMEXCEPTION;
|
err = ErrorCode.ERR_SYSTEMEXCEPTION;
|
||||||
log.error("----Exception DPTech Start Cleanup Task: {}, {}, {}", disposeObject, nfDirection,
|
log.error("----Exception DPTech Start Cleanup Task: {}, {}, {}", disposeObject, nfDirection,
|
||||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType));
|
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MulReturnType<>(err, null);
|
return new MulReturnType<>(err, null);
|
||||||
|
@ -197,23 +198,23 @@ public class DpTechAbilityImpl implements DisposeAbility {
|
||||||
log.debug("DpTech stopAbnormalTaskForUMC request: {}, {}, {}", disposeObject, attackType, nfDirection);
|
log.debug("DpTech stopAbnormalTaskForUMC request: {}, {}, {}", disposeObject, attackType, nfDirection);
|
||||||
|
|
||||||
NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(disposeObject, attackType,
|
NtcRequestResultInfo ret = cleanTypePort.stopAbnormalTaskForUMC(disposeObject, attackType,
|
||||||
nfDirection.getValue());
|
nfDirection.getValue());
|
||||||
log.debug("DpTech stopAbnormalTaskForUMC response: {}", ret);
|
log.debug("DpTech stopAbnormalTaskForUMC response: {}", ret);
|
||||||
|
|
||||||
if (ret.getResultRetVal() != 0) {
|
if (ret.getResultRetVal() != 0) {
|
||||||
err = ErrorCode.ERR_CALLDEVICE;
|
err = ErrorCode.ERR_CALLDEVICE;
|
||||||
log.error("----Error DPTech Stop Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
log.error("----Error DPTech Stop Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
||||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||||
ret.getResultInfo().getValue());
|
ret.getResultInfo().getValue());
|
||||||
} else {
|
} else {
|
||||||
log.info("----Finish DPTech Stop Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
log.info("----Finish DPTech Stop Cleanup Task: {}, {}, {}, {}", disposeObject, nfDirection,
|
||||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType),
|
||||||
ret.getResultInfo().getValue());
|
ret.getResultInfo().getValue());
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
err = ErrorCode.ERR_SYSTEMEXCEPTION;
|
err = ErrorCode.ERR_SYSTEMEXCEPTION;
|
||||||
log.error("----Exception DPTech Stop Cleanup Task: {}, {}, {}", disposeObject, nfDirection,
|
log.error("----Exception DPTech Stop Cleanup Task: {}, {}, {}", disposeObject, nfDirection,
|
||||||
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType));
|
CommonEnumHandler.codeOf(DpTechAttackType.class, attackType));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MulReturnType<>(err, null);
|
return new MulReturnType<>(err, null);
|
||||||
|
@ -253,18 +254,18 @@ public class DpTechAbilityImpl implements DisposeAbility {
|
||||||
@Override
|
@Override
|
||||||
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK,
|
return new MulReturnType<>(ErrorCode.ERR_OK,
|
||||||
DeviceFirewareInfo.builder()
|
DeviceFirewareInfo.builder()
|
||||||
.vendor("DpTech")
|
.vendor("DpTech")
|
||||||
.model("UMC")
|
.model("UMC")
|
||||||
.firmware("Unknown")
|
.firmware("Unknown")
|
||||||
.os("Windows Server")
|
.os("Windows Server")
|
||||||
.kernel("Windows")
|
.kernel("Windows")
|
||||||
.arch("x86_64")
|
.arch("x86_64")
|
||||||
.version("5.7.31")
|
.version("5.7.31")
|
||||||
.memory(-1)
|
.memory(-1)
|
||||||
.freeMemory(-1)
|
.freeMemory(-1)
|
||||||
.cpuUsed(-1)
|
.cpuUsed(-1)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -275,7 +276,7 @@ public class DpTechAbilityImpl implements DisposeAbility {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
|
||||||
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[] {DpTechAttackType.UDP_FLOOD});
|
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[]{DpTechAttackType.UDP_FLOOD});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.dispose.common.NetflowDirection;
|
||||||
import com.dispose.pojo.entity.ServiceInfo;
|
import com.dispose.pojo.entity.ServiceInfo;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||||
|
import com.dispose.security.arithmetic.CryptoHelper;
|
||||||
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;
|
||||||
|
@ -85,7 +86,7 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
public void initDeviceEnv(String urlPath, String username, String password) {
|
public void initDeviceEnv(String urlPath, String username, String password) {
|
||||||
this.urlRootPath = urlPath;
|
this.urlRootPath = urlPath;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = new String(CryptoHelper.base64Decryption(password));
|
||||||
|
|
||||||
upgradeToken();
|
upgradeToken();
|
||||||
}
|
}
|
||||||
|
@ -146,7 +147,7 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
|
|
||||||
if (resp != ErrorCode.ERR_OK) {
|
if (resp != ErrorCode.ERR_OK) {
|
||||||
log.error("----Error HuaWei start clean {} return error: {}, {}", disposeObject, resp.getCode(),
|
log.error("----Error HuaWei start clean {} return error: {}, {}", disposeObject, resp.getCode(),
|
||||||
resp.getMsg());
|
resp.getMsg());
|
||||||
return new MulReturnType<>(ErrorCode.ERR_HUAWEI_ERROR, null);
|
return new MulReturnType<>(ErrorCode.ERR_HUAWEI_ERROR, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,9 +155,9 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("----Exception HuaWei Start Cleanup Task [{}]: {}, {}, {}, {}, {}", ex.getMessage(),
|
log.error("----Exception HuaWei Start Cleanup Task [{}]: {}, {}, {}, {}, {}", ex.getMessage(),
|
||||||
disposeObject,
|
disposeObject,
|
||||||
nfDirection,
|
nfDirection,
|
||||||
duration, url, token);
|
duration, url, token);
|
||||||
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
|
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,8 +229,8 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
return new MulReturnType<>(ErrorCode.ERR_OK, null);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.error("----Exception HuaWei Stop Cleanup Task [{}]: {}, {}, {}, {}", ex.getMessage(),
|
log.error("----Exception HuaWei Stop Cleanup Task [{}]: {}, {}, {}, {}", ex.getMessage(),
|
||||||
disposeObject,
|
disposeObject,
|
||||||
nfDirection, url, token);
|
nfDirection, url, token);
|
||||||
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
|
return new MulReturnType<>(ErrorCode.ERR_SYSTEMEXCEPTION, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,18 +254,18 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
|
||||||
@Override
|
@Override
|
||||||
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK,
|
return new MulReturnType<>(ErrorCode.ERR_OK,
|
||||||
DeviceFirewareInfo.builder()
|
DeviceFirewareInfo.builder()
|
||||||
.vendor("HuaWei")
|
.vendor("HuaWei")
|
||||||
.model("Unknown")
|
.model("Unknown")
|
||||||
.firmware("Unknown")
|
.firmware("Unknown")
|
||||||
.os("Linux Server")
|
.os("Linux Server")
|
||||||
.kernel("Linux")
|
.kernel("Linux")
|
||||||
.arch("x86_64")
|
.arch("x86_64")
|
||||||
.version("Unknown")
|
.version("Unknown")
|
||||||
.memory(-1)
|
.memory(-1)
|
||||||
.freeMemory(-1)
|
.freeMemory(-1)
|
||||||
.cpuUsed(-1)
|
.cpuUsed(-1)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class HuaWeiFireWallAbilityImpl implements DisposeAbility {
|
||||||
public void initDeviceEnv(String urlPath, String username, String password) {
|
public void initDeviceEnv(String urlPath, String username, String password) {
|
||||||
this.urlRootPath = urlPath;
|
this.urlRootPath = urlPath;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = new String(CryptoHelper.base64Decryption(password));
|
||||||
|
|
||||||
upgradeToken();
|
upgradeToken();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
||||||
import com.dispose.pojo.entity.ServiceInfo;
|
import com.dispose.pojo.entity.ServiceInfo;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||||
|
import com.dispose.security.arithmetic.CryptoHelper;
|
||||||
import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
|
import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
|
||||||
import com.pengxin.dispose.common.PengXinLoginRsp;
|
import com.pengxin.dispose.common.PengXinLoginRsp;
|
||||||
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
||||||
|
@ -127,7 +128,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
public void initDeviceEnv(String urlPath, String username, String password) {
|
public void initDeviceEnv(String urlPath, String username, String password) {
|
||||||
this.urlRootPath = urlPath;
|
this.urlRootPath = urlPath;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = new String(CryptoHelper.base64Decryption(password));
|
||||||
restfulInterface.setParams(1, 0);
|
restfulInterface.setParams(1, 0);
|
||||||
|
|
||||||
upgradeToken();
|
upgradeToken();
|
||||||
|
@ -172,12 +173,12 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
reqItems.add(PengXinStartTaskItem.builder()
|
reqItems.add(PengXinStartTaskItem.builder()
|
||||||
.type(getPengXinTaskType(capType))
|
.type(getPengXinTaskType(capType))
|
||||||
.disposeObject(disposeObject)
|
.disposeObject(disposeObject)
|
||||||
.objectType(getPengXinObjectType(objectType))
|
.objectType(getPengXinObjectType(objectType))
|
||||||
.disposeTime(duration)
|
.disposeTime(duration)
|
||||||
.taskReqId(String.valueOf(taskReqId++))
|
.taskReqId(String.valueOf(taskReqId++))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
|
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
|
||||||
|
|
||||||
|
@ -245,7 +246,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
|
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
|
||||||
new String[]{taskId});
|
new String[]{taskId});
|
||||||
|
|
||||||
// 判断是否token过期
|
// 判断是否token过期
|
||||||
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
|
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
|
||||||
|
@ -285,18 +286,18 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
@Override
|
@Override
|
||||||
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK,
|
return new MulReturnType<>(ErrorCode.ERR_OK,
|
||||||
DeviceFirewareInfo.builder()
|
DeviceFirewareInfo.builder()
|
||||||
.vendor("PengXin")
|
.vendor("PengXin")
|
||||||
.model("Unknown")
|
.model("Unknown")
|
||||||
.firmware("Unknown")
|
.firmware("Unknown")
|
||||||
.os("Linux Server")
|
.os("Linux Server")
|
||||||
.kernel("Linux")
|
.kernel("Linux")
|
||||||
.arch("x86_64")
|
.arch("x86_64")
|
||||||
.version("Unknown")
|
.version("Unknown")
|
||||||
.memory(-1)
|
.memory(-1)
|
||||||
.freeMemory(-1)
|
.freeMemory(-1)
|
||||||
.cpuUsed(-1)
|
.cpuUsed(-1)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -373,7 +374,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rspInfo != null && rspInfo.getCode() == ErrorCode.ERR_OK.getHttpCode()
|
if (rspInfo != null && rspInfo.getCode() == ErrorCode.ERR_OK.getHttpCode()
|
||||||
&& rspInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
|
&& rspInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
|
||||||
|
|
||||||
rspInfo.getMsgContent().getCapacity().forEach(v -> {
|
rspInfo.getMsgContent().getCapacity().forEach(v -> {
|
||||||
if (v.getObjectType().equals(DisposeObjectType.DOMAIN.getValue())) {
|
if (v.getObjectType().equals(DisposeObjectType.DOMAIN.getValue())) {
|
||||||
|
@ -459,7 +460,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
String url = urlRootPath + "dispose_device/task/get";
|
String url = urlRootPath + "dispose_device/task/get";
|
||||||
|
|
||||||
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
|
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
|
||||||
new String[]{taskId});
|
new String[]{taskId});
|
||||||
|
|
||||||
// 判断是否token过期
|
// 判断是否token过期
|
||||||
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
|
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
|
||||||
|
@ -474,7 +475,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK,
|
return new MulReturnType<>(ErrorCode.ERR_OK,
|
||||||
rspInfo.getMsgContent().getItems().get(0).getTaskStatus());
|
rspInfo.getMsgContent().getItems().get(0).getTaskStatus());
|
||||||
} else {
|
} else {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, -1L);
|
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, -1L);
|
||||||
}
|
}
|
||||||
|
@ -512,7 +513,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
|
||||||
|
|
||||||
if (rspInfo.getCode() == HttpServletResponse.SC_OK &&
|
if (rspInfo.getCode() == HttpServletResponse.SC_OK &&
|
||||||
(status == ErrorCode.ERR_LOGOUT.getCode() || status == ErrorCode.ERR_TOKENTIMEOUT.getCode() ||
|
(status == ErrorCode.ERR_LOGOUT.getCode() || status == ErrorCode.ERR_TOKENTIMEOUT.getCode() ||
|
||||||
status == ErrorCode.ERR_TOKENNOTFOUND.getCode())){
|
status == ErrorCode.ERR_TOKENNOTFOUND.getCode())) {
|
||||||
upgradeToken();
|
upgradeToken();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
|
||||||
import com.dispose.pojo.entity.ServiceInfo;
|
import com.dispose.pojo.entity.ServiceInfo;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
import com.dispose.pojo.vo.DeviceFirewareInfo;
|
||||||
|
import com.dispose.security.arithmetic.CryptoHelper;
|
||||||
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
import com.pengxin.dispose.common.PengXinStartTaskItem;
|
||||||
import com.pengxin.dispose.common.PengXinStartTaskRsp;
|
import com.pengxin.dispose.common.PengXinStartTaskRsp;
|
||||||
import com.pengxin.dispose.common.PengXinStopTaskRsp;
|
import com.pengxin.dispose.common.PengXinStopTaskRsp;
|
||||||
|
@ -102,7 +103,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
|
||||||
public void initDeviceEnv(String urlPath, String username, String password) {
|
public void initDeviceEnv(String urlPath, String username, String password) {
|
||||||
this.urlRootPath = urlPath;
|
this.urlRootPath = urlPath;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = new String(CryptoHelper.base64Decryption(password));
|
||||||
restfulInterface.setParams(1, 0);
|
restfulInterface.setParams(1, 0);
|
||||||
//获取token值
|
//获取token值
|
||||||
upgradeToken();
|
upgradeToken();
|
||||||
|
|
|
@ -82,18 +82,18 @@ public class VirtualAbilityImpl implements DisposeAbility {
|
||||||
@Override
|
@Override
|
||||||
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
|
||||||
return new MulReturnType<>(ErrorCode.ERR_OK,
|
return new MulReturnType<>(ErrorCode.ERR_OK,
|
||||||
DeviceFirewareInfo.builder()
|
DeviceFirewareInfo.builder()
|
||||||
.vendor("Virtual")
|
.vendor("Virtual")
|
||||||
.model("Dispose_1000")
|
.model("Dispose_1000")
|
||||||
.firmware("Unknown")
|
.firmware("Unknown")
|
||||||
.os("Unknown")
|
.os("Unknown")
|
||||||
.kernel("Linux")
|
.kernel("Linux")
|
||||||
.arch("x86_64")
|
.arch("x86_64")
|
||||||
.version("Virtual_Device_2.0")
|
.version("Virtual_Device_2.0")
|
||||||
.memory(-1)
|
.memory(-1)
|
||||||
.freeMemory(-1)
|
.freeMemory(-1)
|
||||||
.cpuUsed(-1)
|
.cpuUsed(-1)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.dispose.pojo.entity.DisposeDevice;
|
||||||
import com.dispose.pojo.po.MulReturnType;
|
import com.dispose.pojo.po.MulReturnType;
|
||||||
import com.dispose.security.annotation.Decryption;
|
import com.dispose.security.annotation.Decryption;
|
||||||
import com.dispose.security.annotation.Encryption;
|
import com.dispose.security.annotation.Encryption;
|
||||||
|
import com.dispose.security.arithmetic.CryptoHelper;
|
||||||
import com.dispose.service.DisposeDeviceManagerService;
|
import com.dispose.service.DisposeDeviceManagerService;
|
||||||
import com.dispose.validation.group.ValidGroups;
|
import com.dispose.validation.group.ValidGroups;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
@ -45,6 +46,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ public class DisposeDeviceManagerController {
|
||||||
private DisposeDeviceManagerService disposeDeviceManagerService;
|
private DisposeDeviceManagerService disposeDeviceManagerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request to device list list.
|
* Request to device list.
|
||||||
*
|
*
|
||||||
* @param req the req
|
* @param req the req
|
||||||
* @return the list
|
* @return the list
|
||||||
|
@ -91,14 +93,14 @@ public class DisposeDeviceManagerController {
|
||||||
.ipAddr(v.getIpAddr())
|
.ipAddr(v.getIpAddr())
|
||||||
.ipPort(port)
|
.ipPort(port)
|
||||||
.deviceType(CommonEnumHandler.codeOf(DisposeDeviceType.class,
|
.deviceType(CommonEnumHandler.codeOf(DisposeDeviceType.class,
|
||||||
v.getDeviceType()))
|
v.getDeviceType()))
|
||||||
.areaCode(v.getAreaCode())
|
.areaCode(v.getAreaCode())
|
||||||
.deviceName(v.getDeviceName())
|
.deviceName(v.getDeviceName())
|
||||||
.manufacturer(v.getManufacturer())
|
.manufacturer(v.getManufacturer())
|
||||||
.model(v.getModel())
|
.model(v.getModel())
|
||||||
.version(v.getVersion())
|
.version(v.getVersion())
|
||||||
.userName(v.getUserName())
|
.userName(v.getUserName())
|
||||||
.password(v.getPassword())
|
.password(CryptoHelper.base64Encryption(v.getPassword().getBytes(StandardCharsets.UTF_8)))
|
||||||
.urlPath(v.getUrlPath())
|
.urlPath(v.getUrlPath())
|
||||||
.urlType(hType)
|
.urlType(hType)
|
||||||
.readme(v.getReadme())
|
.readme(v.getReadme())
|
||||||
|
@ -112,7 +114,7 @@ public class DisposeDeviceManagerController {
|
||||||
DisposeCapacity cap = DisposeCapacity.builder()
|
DisposeCapacity cap = DisposeCapacity.builder()
|
||||||
.capacityType(CommonEnumHandler.codeOf(DisposeCapacityType.class, k.getCapacityType()))
|
.capacityType(CommonEnumHandler.codeOf(DisposeCapacityType.class, k.getCapacityType()))
|
||||||
.ipType(k.getIpType() == null ? IpAddrType.IPV4 :
|
.ipType(k.getIpType() == null ? IpAddrType.IPV4 :
|
||||||
CommonEnumHandler.codeOf(IpAddrType.class, k.getIpType()))
|
CommonEnumHandler.codeOf(IpAddrType.class, k.getIpType()))
|
||||||
.objectType(CommonEnumHandler.codeOf(DisposeObjectType.class, k.getObjectType()))
|
.objectType(CommonEnumHandler.codeOf(DisposeObjectType.class, k.getObjectType()))
|
||||||
.protectIp(k.getProtectIp() == null ? "" : k.getProtectIp())
|
.protectIp(k.getProtectIp() == null ? "" : k.getProtectIp())
|
||||||
.reserveNetflow(k.getReserveNetflow())
|
.reserveNetflow(k.getReserveNetflow())
|
||||||
|
@ -265,7 +267,7 @@ public class DisposeDeviceManagerController {
|
||||||
|
|
||||||
MulReturnType<PageInfo<DisposeDevice>, List<DisposeDevice>> ret =
|
MulReturnType<PageInfo<DisposeDevice>, List<DisposeDevice>> ret =
|
||||||
disposeDeviceManagerService.getPageDisposeDevice(mr.getMsgContent().getStartPage(),
|
disposeDeviceManagerService.getPageDisposeDevice(mr.getMsgContent().getStartPage(),
|
||||||
mr.getMsgContent().getPageSize());
|
mr.getMsgContent().getPageSize());
|
||||||
|
|
||||||
GetDeviceRsp rspInfo = new GetDeviceRsp();
|
GetDeviceRsp rspInfo = new GetDeviceRsp();
|
||||||
|
|
||||||
|
@ -284,7 +286,7 @@ public class DisposeDeviceManagerController {
|
||||||
GetDeviceDetail devInfo = new GetDeviceDetail();
|
GetDeviceDetail devInfo = new GetDeviceDetail();
|
||||||
devInfo.setId(v.getId().toString());
|
devInfo.setId(v.getId().toString());
|
||||||
devInfo.setIpAddr(DisposeConfigValue.USED_PRIVACY_PROTECT ?
|
devInfo.setIpAddr(DisposeConfigValue.USED_PRIVACY_PROTECT ?
|
||||||
PrivacyHelper.ipAddressPrivacy(v.getIpAddr()) : v.getIpAddr());
|
PrivacyHelper.ipAddressPrivacy(v.getIpAddr()) : v.getIpAddr());
|
||||||
devInfo.setIpPort(Helper.ipPortNormalize(v.getIpPort(), v.getUrlType()));
|
devInfo.setIpPort(Helper.ipPortNormalize(v.getIpPort(), v.getUrlType()));
|
||||||
devInfo.setDeviceType(v.getDeviceType().getValue());
|
devInfo.setDeviceType(v.getDeviceType().getValue());
|
||||||
devInfo.setAreaCode(v.getAreaCode());
|
devInfo.setAreaCode(v.getAreaCode());
|
||||||
|
@ -293,7 +295,7 @@ public class DisposeDeviceManagerController {
|
||||||
devInfo.setModel(v.getModel());
|
devInfo.setModel(v.getModel());
|
||||||
devInfo.setVersion(v.getVersion());
|
devInfo.setVersion(v.getVersion());
|
||||||
devInfo.setUserName(DisposeConfigValue.USED_PRIVACY_PROTECT ?
|
devInfo.setUserName(DisposeConfigValue.USED_PRIVACY_PROTECT ?
|
||||||
PrivacyHelper.usernamePrivacy(v.getUserName()) : v.getUserName());
|
PrivacyHelper.usernamePrivacy(v.getUserName()) : v.getUserName());
|
||||||
devInfo.setUrlType(v.getUrlType().getValue());
|
devInfo.setUrlType(v.getUrlType().getValue());
|
||||||
devInfo.setReadme(v.getReadme());
|
devInfo.setReadme(v.getReadme());
|
||||||
devInfo.setDevStatus(v.getStatus().getValue());
|
devInfo.setDevStatus(v.getStatus().getValue());
|
||||||
|
|
Loading…
Reference in New Issue