fix: support AES_BASE64 GodzillaWebSocket by default

This commit is contained in:
ReaJason
2025-05-28 01:22:54 +08:00
parent fc3ee3e33f
commit cb39b9f26b
2 changed files with 50 additions and 11 deletions
@@ -196,7 +196,9 @@ public class GodzillaManager implements Closeable {
}
if (isWs()) {
try {
BlockingJavaWebSocketClient.sendRequestWaitResponse(this.entrypoint, ByteBuffer.wrap(bytes));
byte[] aes = aes(this.key, bytes, true);
String base64String = Base64.encodeBase64String(aes);
BlockingJavaWebSocketClient.sendRequestWaitResponse(this.entrypoint, base64String);
return true;
} catch (Exception e) {
e.printStackTrace();
@@ -226,8 +228,10 @@ public class GodzillaManager implements Closeable {
}
if (isWs()) {
byte[] bytes1 = BlockingJavaWebSocketClient.sendRequestWaitResponse(this.entrypoint, ByteBuffer.wrap(bytes));
byte[] x = aes(key, bytes1, false);
byte[] aes = aes(this.key, bytes, true);
String base64String = Base64.encodeBase64String(aes);
String response = BlockingJavaWebSocketClient.sendRequestWaitResponse(this.entrypoint, base64String);
byte[] x = aes(key, Base64.decodeBase64(response), false);
GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(x));
return "ok".equals(IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8));
}