From 160cbe39fbddf3853399cb394db2d868dc07fcf3 Mon Sep 17 00:00:00 2001 From: PushM <584406942@qq.com> Date: Mon, 29 Apr 2024 22:53:35 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81fakecc=E5=88=A0=E5=8E=BB=E5=8F=91?= =?UTF-8?q?=E6=9D=A5=E6=8E=A9=E7=A0=81=202=E3=80=81c3pzff=E7=9A=84url?= =?UTF-8?q?=E5=92=8Csso=E7=9A=84url=E5=8A=A8=E6=80=81=E9=85=8D=E7=BD=AE=20?= =?UTF-8?q?3=E3=80=81=E4=BF=AE=E6=94=B9application-test=E4=BB=8E=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fake_dynamic_test/main.py | 12 +++++++----- .../protection/server/task/status/StateHandler.java | 6 +++++- .../protection/server/user/login/LoginService.java | 8 ++++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/fake_dynamic_test/main.py b/fake_dynamic_test/main.py index 4339026..9001026 100644 --- a/fake_dynamic_test/main.py +++ b/fake_dynamic_test/main.py @@ -47,11 +47,11 @@ def format_data_to_json(test_data): "protocol": protocol_v4, "event_id": data_parts[24], # test_data_2.split(",")[-7], - "mask_src_ip": data_parts[5], - "mask_dst_ip": data_parts[6], - "mask_src_port": int(data_parts[7]), - "mask_dst_ip": int(data_parts[8]), - "mask_protocol": int(data_parts[9]) +# "mask_src_ip": data_parts[5], +# "mask_dst_ip": data_parts[6], +# "mask_src_port": int(data_parts[7]), +# "mask_dst_ip": int(data_parts[8]), +# "mask_protocol": int(data_parts[9]) }, "content": test_data } @@ -65,6 +65,8 @@ def delivery_report(err, msg): conf = { 'bootstrap.servers': "192.168.107.49:9092", +# ‘bootstrap.servers’: '10.58.72.125:9092,10.58.72.126:9092,10.58.72.127:9092,10.58.72.128:9092,10.58.72.129:9092,\ +# 10.58.72.130:9092,10.58.72.131:9092,10.58.72.132:9092,10.58.72.133:9092,10.58.72.134:9092', 'client.id': 'python-server' } diff --git a/src/main/java/com/realtime/protection/server/task/status/StateHandler.java b/src/main/java/com/realtime/protection/server/task/status/StateHandler.java index 5b2d4e5..7273983 100644 --- a/src/main/java/com/realtime/protection/server/task/status/StateHandler.java +++ b/src/main/java/com/realtime/protection/server/task/status/StateHandler.java @@ -8,6 +8,7 @@ import com.realtime.protection.configuration.utils.enums.TaskTypeEnum; import com.realtime.protection.configuration.utils.enums.audit.AuditStatusEnum; import com.realtime.protection.server.command.CommandService; import com.realtime.protection.server.task.TaskService; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClientResponseException; @@ -19,8 +20,11 @@ import java.util.concurrent.atomic.AtomicReference; public class StateHandler { + @Value("${c3.pzff.host}") + private String c3_pzff; private final WebClient client = WebClient.builder() - .baseUrl("http://192.168.107.49:8088") +// .baseUrl("http://192.168.107.49:8088") + .baseUrl("http://"+c3_pzff) .build(); protected Boolean handleStart(TaskService taskService, CommandService commandService, Long taskId) { diff --git a/src/main/java/com/realtime/protection/server/user/login/LoginService.java b/src/main/java/com/realtime/protection/server/user/login/LoginService.java index 0567b53..08e881c 100644 --- a/src/main/java/com/realtime/protection/server/user/login/LoginService.java +++ b/src/main/java/com/realtime/protection/server/user/login/LoginService.java @@ -4,6 +4,7 @@ import org.apache.logging.log4j.util.Strings; import javax.security.auth.login.LoginException; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.ObjectMapper; @@ -27,6 +28,9 @@ public class LoginService { private final LoginMapper loginMapper; + @Value("${sso.host}") + private String HostSSO; + public LoginService(LoginMapper loginMapper) { this.loginMapper = loginMapper; } @@ -50,7 +54,7 @@ public class LoginService { ObjectMapper objectMapper = new ObjectMapper(); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() - .url("http://114.243.134.122:9217/passport/accessToken?grant_type=client_credentials") + .url("http://" + HostSSO + "/passport/accessToken?grant_type=client_credentials") .header("Authorization", "Basic TlNBRERAWlguT1JHOk14a1hHZ1ltOUNROUE3TCRSOCNLRW02R1pSeEhwd1c2") .post(okhttp3.internal.Util.EMPTY_REQUEST) .build(); @@ -74,7 +78,7 @@ public class LoginService { RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("sessionData", sessionData).build(); request = new Request.Builder() - .url("http://114.243.134.122:9217/passport/accessApplication") + .url("http://" + HostSSO + "/passport/accessApplication") .header("Authorization", "Bearer " + accessToken) .header("Content-Type", "application/x-www-form-urlencoded") .post(body)