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.extensions;
import opensuite.core.Debug;
import opensuite.core.ToolModule;
import java.io.File;
/**
* One extension in the Installed table: its file, what is known about it, and,
* while it is loaded, its class loader, its thread and the module the suite
* sees. Its fields are read from the event thread and written from the thread
* that loaded it or the extension's own thread, so they are volatile.
*/
final class LoadedExtension {
/** A short bounded log of an extension's lines, written from any thread and read on the event thread. */
static final class Log {
private static final int LIMIT = 256 * 1024;
private final StringBuilder text = new StringBuilder();
synchronized void line(String line) {
if (text.length() + line.length() + 1 > LIMIT) text.delete(0, LIMIT / 2);
text.append(line).append('\n');
}
@Override public synchronized String toString() { return text.toString(); }
}
final String type;
final File file;
/** The file's own name until the extension is loaded, then the name it gave. */
volatile String name;
/** What the Details tab says: Loading..., Loaded, Unresponsive, Unloading..., Not loaded, Disabled: ..., Failed: ..., No entry point, File not found, Won't unload until restart. */
volatile String status = "Loading...";
/** Why, when the status alone does not say. */
volatile String note = "";
/** Whether the suite is running it, which is what the Loaded box shows. */
volatile boolean loaded;
/** Set by the watchdog: a call has run for too long, and events are paused until it is resumed or removed. */
volatile boolean unresponsive;
/** Remove was asked for; the row goes once the extension's thread has ended. */
volatile boolean removeWanted;
volatile boolean autoReload = true;
volatile int impact;
volatile String entryClass;
volatile ExtensionClassLoader loader;
volatile ExtensionThread thread;
volatile ToolModule target;
volatile GuardedModule module;
/** The name its declared sink was registered under, to take it down again. */
volatile String sinkUnder;
volatile boolean initialised;
volatile boolean loaderClosed;
/** Set once the attempt to load it is over, one way or the other. */
volatile boolean done;
final Log output = new Log();
final Log errors = new Log();
private int failures;
LoadedExtension(String type, File file) {
this.type = type;
this.file = file;
this.name = baseName(file);
}
/** The file's name without its extension. */
static String baseName(File file) {
String n = file.getName();
int dot = n.lastIndexOf('.');
return dot > 0 ? n.substring(0, dot) : n;
}
/** A line for the Errors tab. The first few of an extension's failures are traced as well, since one on every event would flood the console. */
synchronized void error(String what, Throwable t) {
errors.line(what + (t == null ? "" : ": " + t));
if (failures < 5) Debug.error("extension '" + name + "' " + what, t);
failures++;
}
/** A line for the Output tab. */
void say(String line) { output.line(line); }
}