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.decoder;
import opensuite.core.Bytes;
import opensuite.testkit.Expect;
import opensuite.testkit.Harness;
import java.util.Arrays;
/**
* Tests the decoder transforms added for wider coverage: gzip/deflate round
* trips, gzip recognition by smart-decode, and the expanded set of named HTML
* entities. Assertions use byte values so the source stays ASCII-only.
*/
public final class DecoderTransformsTest {
private static byte[] dec(String name, String in) {
try { return Transforms.decode(name, Bytes.bytes(in)); } catch (Exception e) { throw new RuntimeException(e); }
}
private static byte[] dec(String name, byte[] in) {
try { return Transforms.decode(name, in); } catch (Exception e) { throw new RuntimeException(e); }
}
private static byte[] enc(String name, byte[] in) {
try { return Transforms.encode(name, in); } catch (Exception e) { throw new RuntimeException(e); }
}
public void run() {
Harness.suite("decoder transforms");
Harness.test("gzip and deflate round-trip", () -> {
byte[] data = Bytes.bytes("hello hello hello world world");
Expect.isTrue(Arrays.equals(data, dec("gzip", enc("gzip", data))), "gzip");
Expect.isTrue(Arrays.equals(data, dec("deflate", enc("deflate", data))), "deflate");
});
Harness.test("a transform tints its pane with a solid colour", () -> {
java.awt.Color white = new java.awt.Color(0xFF, 0xFF, 0xFF), dark = new java.awt.Color(0x2B, 0x2B, 0x2B);
for (java.awt.Color ground : new java.awt.Color[] { white, dark }) {
for (String op : new String[] { "URL", "HTML", "Base64", "ASCII hex", "Hex", "Octal", "Binary", "Gzip" }) {
java.awt.Color c = DecoderTool.paneColour(op, ground);
// A see-through background smears when the pane scrolls.
Expect.equal(c.getAlpha(), 255, op + " alpha");
Expect.isTrue(!c.equals(ground), op + " is tinted");
}
}
// The same shade the old see-through colour gave: base64 yellow at 60/255 over white.
Expect.equal(DecoderTool.paneColour("Base64", white), new java.awt.Color(0xF5, 0xF1, 0xC3), "base64 over white");
});
Harness.test("a transform with no colour leaves the pane on its own ground", () -> {
java.awt.Color ground = new java.awt.Color(0x2B, 0x2B, 0x2B);
Expect.equal(DecoderTool.paneColour("SHA-256", ground), ground, "hash");
Expect.equal(DecoderTool.paneColour(null, ground), ground, "none");
});
Harness.test("smart-decode recognises gzip by its magic number", () -> {
byte[] gz = enc("gzip", Bytes.bytes("some compressible text text text"));
Expect.equal(Transforms.guess(gz), " gzip", "guess gzip");
});
Harness.test("expanded named HTML entities decode to their code points", () -> {
byte[] copy = dec("html", "©");
Expect.equal(copy.length, 1, "copyright is one Latin-1 byte");
Expect.equal(copy[0] & 0xff, 169, "copyright code point");
byte[] guil = dec("html", "«x»");
Expect.equal(guil.length, 3, "two guillemets around x");
Expect.equal(guil[0] & 0xff, 171, "laquo");
Expect.equal(guil[2] & 0xff, 187, "raquo");
Expect.isTrue(dec("html", "€").length > 0, "euro decodes to something");
});
Harness.test("brotli encode is reported as unsupported", () -> {
boolean threw = false;
try { Transforms.encode("brotli", Bytes.bytes("x")); } catch (Exception e) { threw = true; }
Expect.isTrue(threw, "brotli encode refused");
});
}
}