我正在开发一个打嗝扩展。我正在使用 callbacks.makeHttpRequest(host, port, bool, request) 方法。当 burp 可以到达服务器时,一切正常,但如果服务器无法向 stderr 抛出错误。
这是代码
protected static final String HOST = "127.0.0.1";
protected static final int PORT = 1337;
private IBurpExtenderCallbacks callbacks;
private class MyThread implements Runnable {
private IHttpRequestResponse request;
MyThread(IHttpRequestResponse inputRequest) {
request = inputRequest;
}
@Override
public void run() {
String host = "http://" + HOST + ":" + PORT + "/";
host = host + "?" + "host=" + request.getHttpService().getHost() + "&port=" +
request.getHttpService().getPort();
try {
URL url = new URL(host);
byte[] hostrequest = helpers.buildHttpRequest(url);
try {
byte[] response = callbacks.makeHttpRequest(HOST, PORT, false, hostrequest);
if (response != null) {
IResponseInfo responseinfo = helpers.analyzeResponse(response);
if (responseinfo.getStatusCode() == 200) {
callbacks.makeHttpRequest(HOST, PORT, false, request.getRequest());
}
}
} catch (Exception e) {
stdout.println("Server is unable");
}
} catch (MalformedURLException e) {
stdout.println("URL CREATING ERROR");
}
}
}
所以如果 HOST 不可用, byte[] response = callbacks.makeHttpRequest(HOST, PORT, false, hostrequest); 抛出错误:
java.lang.UnsupportedOperationException: Request has not yet been issued
at burp.cfc.makeHttpRequest(Unknown Source)
at burp.BurpExtender$MyThread.run(BurpExtender.java:77)
at java.lang.Thread.run(Thread.java:745)
我需要自己抓住它