Skip to content

Commit 8c9a06d

Browse files
authored
Create Detect101SwitchingProtocols.bambda
1 parent 0019771 commit 8c9a06d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Bambda Script to Detect "101 Switching Protocols" in HTTP Response
3+
@author Tur24Tur / BugBountyzip (https://github.com/BugBountyzip)
4+
It identifies if the HTTP response status line contains "101 Switching Protocols".
5+
* Upon detection, responses are highlighted in red and notes are appended, if enabled.
6+
**/
7+
8+
boolean enableManualAnnotations = true;
9+
10+
// Ensure there is a response
11+
if (!requestResponse.hasResponse()) {
12+
return false;
13+
}
14+
15+
boolean foundSwitchingProtocols = false;
16+
17+
// Get the entire response as a string
18+
String response = requestResponse.response().toString();
19+
20+
// Get the first line of the response
21+
String firstLine = response.split("\n")[0];
22+
23+
// Check if the first line contains "101 Switching Protocols"
24+
if (firstLine.contains("101 Switching Protocols")) {
25+
foundSwitchingProtocols = true;
26+
if (enableManualAnnotations) {
27+
requestResponse.annotations().setHighlightColor(HighlightColor.RED);
28+
requestResponse.annotations().setNotes("Detected '101 Switching Protocols' in response");
29+
}
30+
}
31+
32+
return foundSwitchingProtocols;

0 commit comments

Comments
 (0)