A free, open-source alternative to Burp Suite: an intercepting proxy and web app security testing suite with Repeater, Intruder, Collaborator and a built-in OWASP ZAP scanner. Linux, AGPL-3.0.
Java application-securityappsecbug-bountyburp-alternativeburp-suitedasthttp-proxyinfosecintercepting-proxyjavaowaspowasp-zappenetration-testingpentestingsecuritysecurity-toolsvulnerability-scannerweb-application-securityweb-security
package opensuite.core;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.io.File;
import java.nio.file.Files;
/** Traffic is written to the log file of each tick box that covers it. */
public final class TrafficLogTest {
private static String read(File f) throws Exception { return f.exists() ? Files.readString(f.toPath()) : ""; }
public void run() {
Harness.suite("traffic log");
Harness.test("each box logs its own tool and kind, and All tools logs everything", () -> {
try {
File dir = Files.createTempDirectory("ot-log").toFile();
File proxyReq = new File(dir, "proxy-req.log"), allResp = new File(dir, "all-resp.log"), off = new File(dir, "off.log");
Settings s = new Settings();
s.set(TrafficLog.key("proxy", false), "true");
s.set(TrafficLog.fileKey("proxy", false), proxyReq.getPath());
s.set(TrafficLog.key("all-tools", true), "true");
s.set(TrafficLog.fileKey("all-tools", true), allResp.getPath());
s.set(TrafficLog.fileKey("repeater", false), off.getPath()); // a file but no tick
TrafficLog log = new TrafficLog(s);
HttpService svc = new HttpService("example.test", 443, true);
LogEntry viaProxy = new LogEntry("proxy", svc, new HttpMessage(Bytes.bytes("GET /p HTTP/1.1\r\nHost: example.test\r\n\r\n")));
log.entryAdded(viaProxy); // the request arrives first
viaProxy.setResponse(new HttpMessage(Bytes.bytes("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\npp")));
log.entryUpdated(viaProxy); // then its response
log.entryUpdated(viaProxy); // a later update writes nothing more
LogEntry viaRepeater = new LogEntry("repeater", svc, new HttpMessage(Bytes.bytes("GET /r HTTP/1.1\r\nHost: example.test\r\n\r\n")));
viaRepeater.setResponse(new HttpMessage(Bytes.bytes("HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n\r\n")));
log.entryAdded(viaRepeater);
log.flush();
String pr = read(proxyReq), ar = read(allResp);
Expect.isTrue(pr.contains("GET /p HTTP/1.1") && pr.contains("https://example.test"), "the proxy request and its target are logged");
Expect.isTrue(!pr.contains("GET /r") && !pr.contains("200 OK"), "and nothing else is in that file");
Expect.isTrue(ar.contains("200 OK") && ar.contains("404 Not Found"), "All tools has both responses");
Expect.isTrue(ar.indexOf("200 OK") == ar.lastIndexOf("200 OK"), "each once");
Expect.isTrue(!off.exists(), "a box that is not ticked writes no file");
} catch (Exception e) { throw new RuntimeException(e); }
});
}
}