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.ui;
import javax.swing.Icon;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.RoundRectangle2D;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* Flat icons for the site map tree, drawn so they need no files: a padlock
* for a host, closed for https and open for http, a folder for a path and a
* page for a request. Cached per kind and colour.
*/
public final class SiteIcons {
private SiteIcons() {}
private static final Map<String, Icon> CACHE = new ConcurrentHashMap<>();
private interface Draw { void paint(Graphics2D g); }
/** An icon drawn in a box 16 units square as it is painted, so it stays sharp and grows with the font. */
private static Icon cached(String key, Draw d) {
return CACHE.computeIfAbsent(key, k -> new Icon() {
private double f() { return (16 + Ui.fontGrowth()) / 16.0; }
@Override public int getIconWidth() { return (int) Math.round(16 * f()); }
@Override public int getIconHeight() { return (int) Math.round(16 * f()); }
@Override public void paintIcon(java.awt.Component c, java.awt.Graphics gr, int x, int y) {
Graphics2D g = (Graphics2D) gr.create();
g.translate(x, y);
g.scale(f(), f());
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
g.setStroke(new BasicStroke(1.25f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
d.paint(g);
g.dispose();
}
});
}
/** The tone a muted (out-of-scope) icon takes. */
private static Color tone(Color c, boolean muted) {
if (!muted) return c;
return new Color(c.getRed(), c.getGreen(), c.getBlue(), 110);
}
/**
* A host: a padlock in outline, closed and dark for https, open and red
* for http so the plain-text site stands out. Muted when out of scope.
*/
public static Icon host(boolean secure, boolean muted) {
return cached("host:" + secure + ":" + muted, g -> {
g.setColor(tone(secure ? Theme.TEXT : new Color(0xD5, 0x1F, 0x3D), muted));
java.awt.geom.Path2D.Double shackle = new java.awt.geom.Path2D.Double();
if (secure) {
shackle.moveTo(5.0, 7.2); shackle.lineTo(5.0, 5.0);
shackle.curveTo(5.0, 1.2, 11.0, 1.2, 11.0, 5.0); shackle.lineTo(11.0, 7.2);
} else {
// Open: the shackle is lifted and its left end hangs free.
shackle.moveTo(11.0, 7.2); shackle.lineTo(11.0, 4.4);
shackle.curveTo(11.0, 0.6, 5.0, 0.6, 5.0, 4.4); shackle.lineTo(5.0, 5.2);
}
g.draw(shackle);
g.draw(new RoundRectangle2D.Double(2.6, 7.2, 10.8, 7.6, 2.6, 2.6));
g.fill(new java.awt.geom.Ellipse2D.Double(7.1, 9.6, 1.8, 1.8));
g.draw(new java.awt.geom.Line2D.Double(8.0, 10.8, 8.0, 12.4));
});
}
/** A path segment with pages under it: a folder in outline. */
public static Icon folder(boolean muted) {
return cached("folder:" + muted, g -> {
g.setColor(tone(Theme.TEXT, muted));
java.awt.geom.Path2D.Double f = new java.awt.geom.Path2D.Double();
f.moveTo(1.6, 4.4); f.quadTo(1.6, 2.8, 3.2, 2.8); f.lineTo(6.2, 2.8); f.lineTo(7.8, 4.6);
f.lineTo(12.8, 4.6); f.quadTo(14.4, 4.6, 14.4, 6.2); f.lineTo(14.4, 11.6); f.quadTo(14.4, 13.2, 12.8, 13.2);
f.lineTo(3.2, 13.2); f.quadTo(1.6, 13.2, 1.6, 11.6); f.closePath();
g.draw(f);
});
}
/** A request: a page in outline with a folded corner. */
public static Icon page(boolean muted) {
return cached("page:" + muted, g -> {
g.setColor(tone(Theme.TEXT, muted));
java.awt.geom.Path2D.Double pg = new java.awt.geom.Path2D.Double();
pg.moveTo(4.6, 1.6); pg.lineTo(9.4, 1.6); pg.lineTo(13.0, 5.2); pg.lineTo(13.0, 12.8);
pg.quadTo(13.0, 14.4, 11.4, 14.4); pg.lineTo(4.6, 14.4); pg.quadTo(3.0, 14.4, 3.0, 12.8);
pg.lineTo(3.0, 3.2); pg.quadTo(3.0, 1.6, 4.6, 1.6); pg.closePath();
g.draw(pg);
java.awt.geom.Path2D.Double fold = new java.awt.geom.Path2D.Double();
fold.moveTo(9.4, 1.8); fold.lineTo(9.4, 5.2); fold.lineTo(12.8, 5.2);
g.draw(fold);
});
}
/** A request that takes parameters: a cog. */
public static Icon parameters(boolean muted) {
return cached("params:" + muted, g -> {
g.setColor(tone(Theme.TEXT, muted));
java.awt.geom.Path2D.Double cog = new java.awt.geom.Path2D.Double();
double cx = 8, cy = 8;
for (int i = 0; i < 32; i++) {
// Eight teeth: two points out, two points in, round the wheel.
double a = Math.PI * 2 * i / 32 - Math.PI / 32;
double r = (i % 4 < 2) ? 6.6 : 5.0;
double x = cx + r * Math.cos(a), y = cy + r * Math.sin(a);
if (i == 0) cog.moveTo(x, y); else cog.lineTo(x, y);
}
cog.closePath();
g.draw(cog);
g.draw(new java.awt.geom.Ellipse2D.Double(5.8, 5.8, 4.4, 4.4));
});
}
}