From 3d4e23b5a12f4024ebd6f837d83ee38b46c7b53d Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Tue, 15 Sep 2020 15:59:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?OCT=20REM:=201.=E4=BF=AE=E6=94=B9=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=A4=84=E7=BD=AE=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8D=95=E6=B5=8B=E7=9A=84name=202.=E4=BF=AE=E6=94=B9=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=A4=84=E7=BD=AE=E4=BB=BB=E5=8A=A1=E5=8D=95=E6=B5=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E8=AF=B7=E6=B1=82=E6=B6=88=E6=81=AF?= =?UTF-8?q?=203.=E4=BF=AE=E6=94=B9=E5=90=AF=E5=8A=A8=E5=A4=9A=E5=A4=84?= =?UTF-8?q?=E7=BD=AE=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3=E5=8D=95=E6=B5=8B?= =?UTF-8?q?=E7=9A=84=E8=AF=B7=E6=B1=82=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dispose/test/testcase/qa/v200/P2TaskList.java | 2 +- .../java/com/dispose/test/testcase/qa/v200/P2TaskStart.java | 4 ++-- .../com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java | 6 +++--- .../java/com/dispose/test/testcase/qa/v200/P2TaskStop.java | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java index 984800e9..f409db51 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskList.java @@ -29,7 +29,7 @@ public class P2TaskList { private static final QATestItem[] testItemArray = new QATestItem[]{ QATestItem.builder() .id(BASE_P2_TASK_LIST_ID) - .name("获取第二页20个设备信息") + .name("获取第二页20个处置任务信息") .priority(TestPriority.P2_PRIORITY) .urlPath("/task/taskList") .method(RequestMethod.POST) diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java index e7086400..366a4df7 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStart.java @@ -93,7 +93,7 @@ public class P2TaskStart { .priority(TestPriority.P2_PRIORITY) .urlPath("/task/start") .method(RequestMethod.POST) - .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":1," + + .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":2," + "\"disposeIp\":\"192.168.50.3\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") .rspClass(TaskStartRsp.class) @@ -108,7 +108,7 @@ public class P2TaskStart { .priority(TestPriority.P2_PRIORITY) .urlPath("/task/start") .method(RequestMethod.POST) - .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":2," + + .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":1," + "\"disposeIp\":\"192.168.50.2\",\"disposeTime\":10,\"flowDirection\":2," + "\"attackType\":[-1]}}") .rspClass(TaskStartRsp.class) diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java index d2a3992a..7d23e2c3 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStartMulIp.java @@ -30,7 +30,7 @@ public class P2TaskStartMulIp { private static final QATestItem[] testItemArray = new QATestItem[]{ QATestItem.builder() .id(BASE_P2_TASK_START_MUL_ID) - .name("对一个IP全部攻击类型进行清洗") + .name("对多个IP指定攻击类型进行清洗") .priority(TestPriority.P2_PRIORITY) .urlPath("/task/startMulIp") .method(RequestMethod.POST) @@ -173,7 +173,7 @@ public class P2TaskStartMulIp { .priority(TestPriority.P2_PRIORITY) .urlPath("/task/startMulIp") .method(RequestMethod.POST) - .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":1," + + .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":2," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") .rspClass(TaskStartMulRsp.class) @@ -190,7 +190,7 @@ public class P2TaskStartMulIp { .priority(TestPriority.P2_PRIORITY) .urlPath("/task/startMulIp") .method(RequestMethod.POST) - .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":2," + + .caseJsonValue("{\"ver\":3,\"cryptoType\":0,\"timeStamp\":1598597142580,\"msgContent\":{\"type\":1," + "\"mulDisposeIp\":[\"192.168.50.4\",\"192.168.50.3\"],\"disposeTime\":10," + "\"flowDirection\":2,\"attackType\":[-1]}}") .rspClass(TaskStartMulRsp.class) diff --git a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStop.java b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStop.java index 559fd634..57d23944 100644 --- a/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStop.java +++ b/src/test/java/com/dispose/test/testcase/qa/v200/P2TaskStop.java @@ -50,7 +50,6 @@ public class P2TaskStop { Assert.assertNotEquals(k.getDisposeIp().length(), 0); Assert.assertNotNull(k.getLeftTime()); } - }); }) From 189f9f97af95c8a379ab6dfdee4326bb27593f4d Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 16 Sep 2020 10:17:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?OCT=20REM:=201.=E4=BF=AE=E6=94=B9=E6=B5=A9?= =?UTF-8?q?=E7=80=9A=E8=AE=BE=E5=A4=87=E9=98=B2=E6=8A=A4IP=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ability/impl/HaoHanAbilityImpl.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java b/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java index 52eb142b..651bd522 100644 --- a/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java @@ -9,6 +9,8 @@ import com.dispose.pojo.vo.DeviceFirewareInfo; import com.haohan.dispose.common.HaoHanStartCleanResp; import com.haohan.dispose.common.HaoHanStopCleanResp; import com.haohan.dispose.protocol.RestfulInterface; +import inet.ipaddr.IPAddress; +import inet.ipaddr.IPAddressString; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -71,7 +73,7 @@ public class HaoHanAbilityImpl implements DisposeAbility { } HaoHanStartCleanResp resp = restfulInterface.startClean(this.urlRootPath, ip, Math.max(duration.intValue(), 0), - DISPOSE_PLATFORM_NAME); + DISPOSE_PLATFORM_NAME); if (resp == null) { log.error("----Error Haohan start clean {} server return error", ip); @@ -109,7 +111,7 @@ public class HaoHanAbilityImpl implements DisposeAbility { } HaoHanStopCleanResp resp = restfulInterface.stopClean(this.urlRootPath, taskId.intValue(), - DISPOSE_PLATFORM_NAME); + DISPOSE_PLATFORM_NAME); if (resp == null) { log.error("----Error Haohan stop task{} server return error", taskId); @@ -139,18 +141,18 @@ public class HaoHanAbilityImpl implements DisposeAbility { @Override public MulReturnType getAbilityDeviceFireware() { return new MulReturnType<>(ErrorCode.ERR_OK, - DeviceFirewareInfo.builder() - .vendor("HaoHan") - .model("Unknown") - .firmware("Unknown") - .os("Linux Server") - .kernel("Linux") - .arch("x86_64") - .version("Unknown") - .memory(-1) - .freeMemory(-1) - .cpuUsed(-1) - .build()); + DeviceFirewareInfo.builder() + .vendor("HaoHan") + .model("Unknown") + .firmware("Unknown") + .os("Linux Server") + .kernel("Linux") + .arch("x86_64") + .version("Unknown") + .memory(-1) + .freeMemory(-1) + .cpuUsed(-1) + .build()); } /** @@ -179,6 +181,7 @@ public class HaoHanAbilityImpl implements DisposeAbility { */ @Override public boolean isCarryProtectIp(String ipAddr) { - return true; + IPAddress addr = new IPAddressString(ipAddr).getAddress(); + return addr.isIPv4(); } } From 1b490c9274186d15481e6c4a3a0f32b453bbb543 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 16 Sep 2020 14:35:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?OCT=20REM:=201.=E4=BF=AE=E6=94=B9=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=AE=BE=E5=A4=87=E8=83=BD=E5=8A=9B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java b/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java index 766f0481..bddd4a5b 100644 --- a/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java +++ b/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java @@ -62,7 +62,7 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager { if (tDev.getStatus() == ObjectStatus.DELETED) { // 重置状态 tDev.setStatus(ObjectStatus.NORMAL); - return upgradeDisposeDevice(tDev); + return upgradeDisposeDevice(dev); } return new MulReturnType<>(ErrorCode.ERR_DEVICEEXISTS, tDev.getId());