Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credit card #63

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Proxy/HTTP/Detect101SwitchingProtocols.bambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Bambda Script to Detect "101 Switching Protocols" in HTTP Response
@author Tur24Tur / BugBountyzip (https://github.com/BugBountyzip)
It identifies if the HTTP response status line contains "101 Switching Protocols".
* Upon detection, responses are highlighted in red and notes are appended, if enabled.
**/

boolean enableManualAnnotations = true;

// Ensure there is a response
if (!requestResponse.hasResponse()) {
return false;
}

boolean foundSwitchingProtocols = false;

// Get the entire response as a string
String response = requestResponse.response().toString();

// Get the first line of the response
String firstLine = response.split("\n")[0];

// Check if the first line contains "101 Switching Protocols"
if (firstLine.contains("101 Switching Protocols")) {
foundSwitchingProtocols = true;
if (enableManualAnnotations) {
requestResponse.annotations().setHighlightColor(HighlightColor.RED);
requestResponse.annotations().setNotes("Detected '101 Switching Protocols' in response");
}
}

return foundSwitchingProtocols;
56 changes: 56 additions & 0 deletions Proxy/HTTP/DetectCreditCardInfo.bambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Bambda Script to Detect and Highlight Potential Credit Card Information
* @author Tur24Tur / BugBountyzip (https://github.com/BugBountyzip)
* It identifies potential credit card information in HTTP responses.
* Upon detection, responses are highlighted in red and notes are appended, if enabled.
**/

boolean enableManualAnnotations = true;

// Ensure there is a response
if (!requestResponse.hasResponse()) {
return false;
}

String responseBody = requestResponse.response().bodyToString();
boolean foundCreditCardInfo = false;
StringBuilder notesBuilder = new StringBuilder();

// Regular expressions to match common credit card formats
String visaRegex = "\\b4[0-9]{12}(?:[0-9]{3})?\\b";
String masterCardRegex = "\\b5[1-5][0-9]{14}\\b";
String discoverRegex = "\\b6(?:011|5[0-9]{2})[0-9]{12}\\b";
String amexRegex = "\\b3[47][0-9]{13}\\b";
String dinersClubRegex = "\\b3(?:0[0-5]|[68][0-9])[0-9]{11}\\b";
String jcbRegex = "\\b(?:2131|1800|35\\d{3})\\d{11}\\b";

Map<String, String> cardTypes = new HashMap<>();
cardTypes.put("Visa", visaRegex);
cardTypes.put("MasterCard", masterCardRegex);
cardTypes.put("Discover", discoverRegex);
cardTypes.put("American Express", amexRegex);
cardTypes.put("Diners Club", dinersClubRegex);
cardTypes.put("JCB", jcbRegex);

for (Map.Entry<String, String> entry : cardTypes.entrySet()) {
Pattern pattern = Pattern.compile(entry.getValue());
Matcher matcher = pattern.matcher(responseBody);
if (matcher.find()) {
foundCreditCardInfo = true;
if (enableManualAnnotations) {
if (notesBuilder.length() > 0) {
notesBuilder.append(", ");
}
notesBuilder.append("Potential ").append(entry.getKey()).append(": ").append(matcher.group());
}
}
}

if (foundCreditCardInfo && enableManualAnnotations) {
requestResponse.annotations().setHighlightColor(HighlightColor.RED);
if (notesBuilder.length() > 0) {
requestResponse.annotations().setNotes(notesBuilder.toString());
}
}

return foundCreditCardInfo;
52 changes: 52 additions & 0 deletions Proxy/HTTP/DetectServerNames.bambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Bambda Script to Detect Specific Server Names in HTTP Response
@author Tur24Tur / BugBountyzip (https://github.com/BugBountyzip)
It identifies if the 'Server' header of the HTTP response contains any of the specified server names.
* Upon detection, responses are highlighted in red and notes are appended, if enabled.
**/

boolean enableManualAnnotations = true;

// My list of server names to detect
List<String> serverNames = Arrays.asList(
"awselb", "Kestrel", "Apache", "Nginx", "Microsoft-IIS", "LiteSpeed", "Google Frontend",
"GWS", "openresty", "IBM_HTTP_Server", "AmazonS3", "CloudFront", "AkamaiGHost", "Jetty",
"Tengine", "lighttpd", "AOLserver", "ATS", "Boa", "Caddy", "Cherokee", "Caudium", "Hiawatha",
"GlassFish", "H2O", "httpd", "Jigsaw", "LiteSpeed", "Mongrel", "NCSA HTTPd", "Netscape Enterprise",
"Oracle iPlanet", "Pound", "Resin", "thttpd", "Tornado", "Varnish", "WebObjects", "Xitami",
"Zope", "Werkzeug", "WebSTAR", "WebSEAL", "WebServerX", "WebtoB", "Squid", "Sun Java System Web Server",
"Sun ONE Web Server", "Stronghold", "Zeus Web Server", "Zope", "Roxen", "RapidLogic", "Pramati",
"Phusion Passenger", "Oracle Containers for J2EE", "Oracle-Application-Server-10g", "Oracle-Application-Server-11g",
"Nostromo", "Novell-HTTP-Server", "NaviServer", "MochiWeb", "Microsoft-HTTPAPI", "Mbedthis-Appweb",
"Lotus-Domino", "LiteSpeed", "Kangle", "Joost", "Jino", "IceWarp", "IBM_HTTP_Server", "GoAhead",
"Flywheel", "EdgePrism", "DMS", "Cowboy", "CommuniGatePro", "CompaqHTTPServer", "CERN", "CauchoResin",
"Caddy", "BarracudaHTTP", "BaseHTTP", "AllegroServe", "Abyss", "4D_WebSTAR_S", "4D_WebSTAR_D",
"Yaws", "WDaemon", "Virtuoso", "UserLand", "TUX", "TwistedWeb", "TwistedWeb", "Thin",
"Thttpd", "Tengine", "Swiki", "SurgeLDAP", "Sun-ONE-Web-Server", "Sun-ONE-Application-Server",
"Sucuri/Cloudproxy", "SSWS", "SWS", "SW", "srv", "squid", "Spamfire", "SOMA",
"Snap", "SmugMug", "SME Server", "Smart-4-Hosting", "Sioux", "SilverStream", "Silk", "Siemens Gigaset WLAN Camera"
);

// Ensure there is a response
if (!requestResponse.hasResponse()) {
return false;
}

boolean foundServerName = false;

// Get the entire response as a string
String response = requestResponse.response().toString();

// Check if the 'Server' header contains any of the specified server names
for (String serverName : serverNames) {
if (response.contains("Server: " + serverName)) {
foundServerName = true;
if (enableManualAnnotations) {
requestResponse.annotations().setHighlightColor(HighlightColor.RED);
requestResponse.annotations().setNotes("Detected '" + serverName + "' in 'Server' header");
}
break;
}
}

return foundServerName;
Loading