Created
November 27, 2023 21:54
-
-
Save irsdl/d9078390cb844d538f75a2fe4831cadf to your computer and use it in GitHub Desktop.
Highlighting case using Burp Suite Bambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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