forked from API-Security/APIKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpRequestResponse.java
More file actions
87 lines (71 loc) · 2.22 KB
/
HttpRequestResponse.java
File metadata and controls
87 lines (71 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package burp.utils;
import burp.BurpExtender;
import burp.CookieManager;
import burp.IHttpRequestResponse;
import burp.IHttpService;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CompletableFuture;
public class HttpRequestResponse implements IHttpRequestResponse {
byte[] request;
byte[] response;
String comment;
IHttpService httpService;
@Override
public byte[] getRequest() {
return this.request;
}
@Override
public void setRequest(byte[] request) {
this.request = request;
}
public void sendRequest() {
// 如果开启自动发送, 发出请求, 否则设置为空
if (BurpExtender.getConfigPanel().getAutoSendRequest()) {
this.setRequest(CookieManager.getRequest(httpService, request));
this.setResponse("Loading...".getBytes());
CompletableFuture.supplyAsync(() -> {
try {
IHttpRequestResponse newHttpRequestResponse = BurpExtender.getCallbacks().makeHttpRequest(httpService, request);
this.setResponse(newHttpRequestResponse.getResponse());
} catch (Exception e) {
BurpExtender.getStderr().println(CommonUtils.exceptionToString(e));
this.setResponse(CommonUtils.exceptionToString(e).getBytes());
}
return null;
}, Executor.getExecutor());
} else {
this.setResponse("Auto request sending disabled".getBytes());
}
}
@Override
public byte[] getResponse() {
return this.response;
}
@Override
public void setResponse(byte[] response) {
this.response = response;
}
@Override
public String getComment() {
return this.comment;
}
@Override
public void setComment(String comment) {
this.comment = comment;
}
@Override
public String getHighlight() {
return "";
}
@Override
public void setHighlight(String s) {
}
@Override
public IHttpService getHttpService() {
return this.httpService;
}
@Override
public void setHttpService(IHttpService httpService) {
this.httpService = httpService;
}
}