Skip to content

Instantly share code, notes, and snippets.

@irsdl
Created November 27, 2023 21:54
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save irsdl/d9078390cb844d538f75a2fe4831cadf to your computer and use it in GitHub Desktop.
Save irsdl/d9078390cb844d538f75a2fe4831cadf to your computer and use it in GitHub Desktop.
Highlighting case using Burp Suite Bambda
// by @irsdl
boolean manualColorHighlightEnabled = true; // e.g. BurpRed anywhere in the request
boolean pwnFoxColorHighlightEnabled = true; // to support PwnFox Firefox extension containers
// BEGIN HIGHLIGHT LOGIC {
boolean hasAlreadyBeenColoured = false;
/* Manual highlight logic to see something like BurpRed */
if(manualColorHighlightEnabled){
Pattern manualHighlightPattern = Pattern.compile("burp([a-z]{3,7}+)", Pattern.CASE_INSENSITIVE); // like burpRed or burpYellow
Matcher manualHighlightMatcher = manualHighlightPattern.matcher(requestResponse.request().toString());
if (manualHighlightMatcher.find()) {
String color = manualHighlightMatcher.group(1);
if (!color.isEmpty() && HighlightColor.highlightColor(color.toLowerCase()) != HighlightColor.NONE) {
// Highlighting color
requestResponse.annotations().setHighlightColor(HighlightColor.highlightColor(color));
hasAlreadyBeenColoured = true;
}
}
}
/* PwnFox logic */
if (pwnFoxColorHighlightEnabled && !hasAlreadyBeenColoured) {
var headerList = requestResponse.request().headers();
if (headerList != null) {
for (var item : headerList) {
if (item.name().equalsIgnoreCase("x-pwnfox-color")) {
var pwnFoxColor = item.value();
if (!pwnFoxColor.isEmpty()) {
requestResponse.annotations().setHighlightColor(HighlightColor.highlightColor(pwnFoxColor));
}
}
}
}
}
// } END HIGHLIGHT LOGIC
// YOUR ACTUAL FILTER LOGIC HERE:
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment