diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 7626265..8c45108 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -15,7 +15,7 @@
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 980588c..2e1bf07 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -1,6 +1,11 @@
+
+
+
+
+
diff --git a/src/main/java/com/drops/ui/MainController.java b/src/main/java/com/drops/ui/MainController.java
index fed9766..00c27cd 100644
--- a/src/main/java/com/drops/ui/MainController.java
+++ b/src/main/java/com/drops/ui/MainController.java
@@ -46,6 +46,10 @@ public class MainController {
// 设置超时
@FXML
private TextField httpTimeout;
+ //设置请求头 cookie
+ @FXML
+ private TextField globalHeader;
+ public static HashMap myHead = new HashMap();
@FXML
private TextField vps;
@FXML
@@ -363,6 +367,11 @@ public boolean connect() {
public void check(ActionEvent actionEvent) {
try {
+ //检测时取请求头
+ if(!this.globalHeader.getText().equals("")) {
+ String header[] = this.globalHeader.getText().split(":",2);
+ this.myHead.put(header[0], header[1].trim());
+ }
SpringBootInfo info = new SpringBootInfo();
info.doCheck(this.targetAddress.getText());
}catch (Exception e){
diff --git a/src/main/java/com/drops/utils/HTTPUtils.java b/src/main/java/com/drops/utils/HTTPUtils.java
index e2bed3c..6a2b3c3 100644
--- a/src/main/java/com/drops/utils/HTTPUtils.java
+++ b/src/main/java/com/drops/utils/HTTPUtils.java
@@ -1,7 +1,7 @@
package com.drops.utils;
import cn.hutool.http.HttpGlobalConfig;
-import cn.hutool.http.HttpRequest;
+//import cn.hutool.http.ReqHook;
import cn.hutool.http.HttpResponse;
import com.drops.ui.MainController;
import sun.applet.Main;
@@ -38,9 +38,9 @@ public static HttpResponse deleteRequest(String target, String s) {
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
HttpResponse result = null;
if (proxy == null){
- result = HttpRequest.delete(url).execute();
+ result = ReqHook.delete(url).execute();
}else {
- result = HttpRequest.delete(url).setProxy(proxy).execute();
+ result = ReqHook.delete(url).setProxy(proxy).execute();
}
return result;
@@ -64,9 +64,9 @@ public static HttpResponse getRequest(String target){
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
HttpResponse result = null;
if (proxy == null){
- result = HttpRequest.get(url).execute();
+ result = ReqHook.get(url).execute();
}else {
- result = HttpRequest.get(url).setProxy(proxy).execute();
+ result = ReqHook.get(url).setProxy(proxy).execute();
}
return result;
@@ -78,9 +78,9 @@ public static HttpResponse getRequest(String target, String point){
HttpResponse result = null;
System.out.println(url);
if (proxy == null){
- result = HttpRequest.get(url).execute();
+ result = ReqHook.get(url).execute();
}else {
- result = HttpRequest.get(url).setProxy(proxy).execute();
+ result = ReqHook.get(url).setProxy(proxy).execute();
}
return result;
@@ -94,7 +94,7 @@ public static HttpResponse getRequest(String target, String point){
public static HttpResponse getRequestProxy(String target){
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
String url = URLUtil.normalizeURL(target);
- HttpResponse result = HttpRequest.get(target)
+ HttpResponse result = ReqHook.get(target)
.setProxy(proxy).execute();
return result;
}
@@ -111,11 +111,11 @@ public static HttpResponse postRequestV1(String target, String Point){
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
HttpResponse result = null;
if (proxy != null){
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type","application/x-www-form-urlencoded")
.setProxy(proxy).execute();
}else {
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type","application/x-www-form-urlencoded")
.execute();
}
@@ -127,12 +127,12 @@ public static HttpResponse postRequestV1(String target, String Point, String bob
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
HttpResponse result = null;
if (proxy != null){
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type","application/x-www-form-urlencoded")
.body(boby)
.setProxy(proxy).execute();
}else {
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.body(boby)
.header("Content-Type","application/x-www-form-urlencoded")
.execute();
@@ -144,7 +144,7 @@ public static HttpResponse postRequestV1(String target, String Point, String bob
public static HttpResponse postRequestV1Proxy(String target, String Point){
String url = URLUtil.normalizeURL(target) + Point;
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
- HttpResponse result = HttpRequest.post(url)
+ HttpResponse result = ReqHook.post(url)
.header("Content-Type","application/x-www-form-urlencoded")
.setProxy(proxy).execute();
return result;
@@ -158,13 +158,13 @@ public static HttpResponse H2PostRequest(String target, String boby){
HttpResponse result;
if (proxy != null){
- result = HttpRequest.post(target)
+ result = ReqHook.post(target)
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Referer", target)
.body(boby)
.setProxy(proxy).execute();
}else {
- result = HttpRequest.post(target)
+ result = ReqHook.post(target)
.header("Content-Type", "application/x-www-form-urlencoded")
.header("Referer", target)
.body(boby)
@@ -181,13 +181,13 @@ public static HttpResponse postRequestjson(String target, String point ,String j
HttpResponse result;
if (proxy != null){
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type", "application/json")
.header("Referer", target)
.body(json)
.setProxy(proxy).execute();
}else {
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type", "application/json")
.header("Referer", target)
.body(json)
@@ -200,7 +200,7 @@ public static HttpResponse postRequestjson(String target, String point ,String j
public static HttpResponse postRequestV1Proxy(String target, String Point, String boby){
String url = URLUtil.normalizeURL(target) + Point;
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
- HttpResponse result = HttpRequest.post(url)
+ HttpResponse result = ReqHook.post(url)
.header("Content-Type","application/x-www-form-urlencoded")
.body(boby)
.setProxy(proxy).execute();
@@ -221,12 +221,12 @@ public static HttpResponse postRequestV2(String target, String Point){
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
HttpResponse result = null;
if (proxy != null){
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type","application/json")
.header("Cache-Control", "max-age=0")
.setProxy(proxy).execute();
}else {
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Cache-Control", "max-age=0")
.header("Content-Type","application/json")
.execute();
@@ -240,13 +240,13 @@ public static HttpResponse postRequestV2(String target, String Point, String bob
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
HttpResponse result = null;
if (proxy != null){
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Content-Type","application/json")
.header("Cache-Control", "max-age=0")
.body(boby)
.setProxy(proxy).execute();
}else {
- result = HttpRequest.post(url)
+ result = ReqHook.post(url)
.header("Cache-Control", "max-age=0")
.header("Content-Type","application/json")
.body(boby)
@@ -261,7 +261,7 @@ public static HttpResponse postRequestV2Proxy(String target, String Point){
String url = URLUtil.normalizeURL(target) + Point;
Proxy proxy = (Proxy) MainController.currentProxy.get("proxy");
- HttpResponse result = HttpRequest.post(url)
+ HttpResponse result = ReqHook.post(url)
.header("Content-Type","application/json")
.setProxy(proxy).execute();
return result;
diff --git a/src/main/java/com/drops/utils/ReqHook.java b/src/main/java/com/drops/utils/ReqHook.java
new file mode 100644
index 0000000..181090f
--- /dev/null
+++ b/src/main/java/com/drops/utils/ReqHook.java
@@ -0,0 +1,28 @@
+package com.drops.utils;
+
+import cn.hutool.http.Method;
+import com.drops.ui.MainController;
+import cn.hutool.http.HttpRequest;
+import com.drops.ui.MainController;
+
+//继承HttpRequest,添加请求头。当前仅修改get,post,delete
+public class ReqHook extends HttpRequest {
+ public ReqHook(String url) {
+ super(url);
+ if(!MainController.myHead.isEmpty()) {
+ this.addHeaders(MainController.myHead);
+ }
+ }
+ public static HttpRequest get(String url) {
+ return (new ReqHook(url)).method(Method.GET);
+ }
+
+ public static HttpRequest post(String url) {
+ return (new ReqHook(url)).method(Method.POST);
+ }
+
+ public static HttpRequest delete(String url) {
+ return (new ReqHook(url)).method(Method.DELETE);
+ }
+
+}
diff --git a/src/main/resources/a.fxml b/src/main/resources/a.fxml
index f9846a5..8bbd086 100644
--- a/src/main/resources/a.fxml
+++ b/src/main/resources/a.fxml
@@ -39,15 +39,31 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
@@ -133,7 +149,6 @@
-