From bbbe71ae3357b5ce94eab9f8938a7db8864ad1e7 Mon Sep 17 00:00:00 2001 From: shizhendong Date: Mon, 26 Aug 2024 17:58:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E7=94=A8=20pcap-common=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=97=B6=E6=B7=BB=E5=8A=A0=20url,id=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../net/geedge/asw/module/feign/client/PcapCommentClient.java | 2 +- .../asw/module/runner/service/impl/PcapServiceImpl.java | 4 ++++ .../net/geedge/asw/module/runner/util/PcapParserThread.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/geedge/asw/module/feign/client/PcapCommentClient.java b/src/main/java/net/geedge/asw/module/feign/client/PcapCommentClient.java index b435504..b725ba3 100644 --- a/src/main/java/net/geedge/asw/module/feign/client/PcapCommentClient.java +++ b/src/main/java/net/geedge/asw/module/feign/client/PcapCommentClient.java @@ -13,6 +13,6 @@ public interface PcapCommentClient { @RequestLine("POST /api/v1/pcap/comment") @Headers("Content-Type: multipart/form-data") - Response addCommon(@Param("file") File file); + Response addCommon(@Param("file") File file, @Param("url") String url, @Param("id") String pcapId); } \ No newline at end of file diff --git a/src/main/java/net/geedge/asw/module/runner/service/impl/PcapServiceImpl.java b/src/main/java/net/geedge/asw/module/runner/service/impl/PcapServiceImpl.java index d0ff3d0..c827014 100644 --- a/src/main/java/net/geedge/asw/module/runner/service/impl/PcapServiceImpl.java +++ b/src/main/java/net/geedge/asw/module/runner/service/impl/PcapServiceImpl.java @@ -91,6 +91,9 @@ public class PcapServiceImpl extends ServiceImpl implements @jakarta.annotation.Resource private KibanaClient kibanaClient; + @Value("${controller.url:http://127.0.0.1}") + private String aswControllerUrl; + @Override public PcapEntity queryInfo(String id) { PcapEntity pcap = this.getById(id); @@ -212,6 +215,7 @@ public class PcapServiceImpl extends ServiceImpl implements // parse thread config properties Properties properties = new Properties(); properties.setProperty("sharkdApiHostAddr", this.sharkdApiHostAddr); + properties.setProperty("aswControllerUrl", this.aswControllerUrl); for (String id : ids) { PcapEntity pcapEntity = this.getById(id); diff --git a/src/main/java/net/geedge/asw/module/runner/util/PcapParserThread.java b/src/main/java/net/geedge/asw/module/runner/util/PcapParserThread.java index 3885162..262856f 100644 --- a/src/main/java/net/geedge/asw/module/runner/util/PcapParserThread.java +++ b/src/main/java/net/geedge/asw/module/runner/util/PcapParserThread.java @@ -90,7 +90,7 @@ public class PcapParserThread implements Runnable { */ private void addCommonToPcap() throws IOException { // pcap common - Response response = pcapCommentClient.addCommon(T.FileUtil.file(pcapEntity.getPath())); + Response response = pcapCommentClient.addCommon(T.FileUtil.file(pcapEntity.getPath()), properties.getProperty("aswControllerUrl"), pcapEntity.getId()); if (log.isDebugEnabled()) { log.debug("[addCommonToPcap] [response: {}]", null != response ? response.status() : RCode.ERROR.getCode());