Skip to content

Commit

Permalink
Merge branch 'main' into bapp/portswigger-feedback-for-bapp-store-sub…
Browse files Browse the repository at this point in the history
…mission
  • Loading branch information
GangGreenTemperTatum authored Dec 27, 2024
2 parents 17cc2df + 1ec89e9 commit 99bdc21
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ A Burp Suite extension written in Kotlin that allows you to create and manage "s
- Right-click selected text to create new stickies
- Quick access to update existing stickies
- Source tracking shows which HTTP request the stickies came from
- Works in Burp tools (Proxy, Repeater, etc.)
- Works in Burp tools for both HTTP Requests and Responses (Proxy, Repeater, Target (Site Map) etc.)

- **Dedicated UI Tab**
- Table view of all stored stickies
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "com.ganggreentempertatum"
version = "1.0.1"
version = "1.0.2"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import burp.api.montoya.core.ByteArray
import burp.api.montoya.ui.contextmenu.ContextMenuEvent
import burp.api.montoya.ui.contextmenu.ContextMenuItemsProvider
import burp.api.montoya.ui.contextmenu.InvocationType
import burp.api.montoya.core.ToolType
import burp.api.montoya.core.ToolSource
import burp.api.montoya.logging.Logging
import javax.swing.*
import burp.api.montoya.http.message.requests.HttpRequest
Expand Down Expand Up @@ -77,17 +79,24 @@ class StickyBurpContextMenu(private val tab: StickyBurpTab, private val logging:
val source = if (messageEditor.isPresent) {
val reqRes = messageEditor.get().requestResponse()
val tool = when (event.invocationType()) {
InvocationType.SITE_MAP_TREE,
InvocationType.SITE_MAP_TABLE -> "Target"
InvocationType.PROXY_HISTORY,
InvocationType.PROXY_INTERCEPT,
InvocationType.PROXY_INTERCEPT -> "Proxy"
InvocationType.MESSAGE_VIEWER_REQUEST,
InvocationType.MESSAGE_VIEWER_RESPONSE -> "Proxy"
InvocationType.MESSAGE_VIEWER_RESPONSE -> {
// Get tool type from the event using isFromTool
when {
event.isFromTool(ToolType.TARGET) -> "Target"
event.isFromTool(ToolType.LOGGER) -> "Logger"
else -> "Proxy" // Default to Proxy for backwards compatibility
}
}
InvocationType.INTRUDER_PAYLOAD_POSITIONS,
InvocationType.INTRUDER_ATTACK_RESULTS -> "Intruder"
InvocationType.SCANNER_RESULTS -> "Scanner"
InvocationType.MESSAGE_EDITOR_REQUEST,
InvocationType.MESSAGE_EDITOR_RESPONSE -> "Repeater"
InvocationType.SITE_MAP_TREE,
InvocationType.SITE_MAP_TABLE -> "Site Map"
InvocationType.SEARCH_RESULTS -> "Search"
else -> "Other"
}
Expand Down Expand Up @@ -174,17 +183,24 @@ class StickyBurpContextMenu(private val tab: StickyBurpTab, private val logging:
?: return@addActionListener

val tool = when (event.invocationType()) {
InvocationType.SITE_MAP_TREE,
InvocationType.SITE_MAP_TABLE -> "Target"
InvocationType.PROXY_HISTORY,
InvocationType.PROXY_INTERCEPT,
InvocationType.PROXY_INTERCEPT -> "Proxy"
InvocationType.MESSAGE_VIEWER_REQUEST,
InvocationType.MESSAGE_VIEWER_RESPONSE -> "Proxy"
InvocationType.MESSAGE_VIEWER_RESPONSE -> {
// Get tool type from the event using isFromTool
when {
event.isFromTool(ToolType.TARGET) -> "Target"
event.isFromTool(ToolType.LOGGER) -> "Logger"
else -> "Proxy" // Default to Proxy for backwards compatibility
}
}
InvocationType.INTRUDER_PAYLOAD_POSITIONS,
InvocationType.INTRUDER_ATTACK_RESULTS -> "Intruder"
InvocationType.SCANNER_RESULTS -> "Scanner"
InvocationType.MESSAGE_EDITOR_REQUEST,
InvocationType.MESSAGE_EDITOR_RESPONSE -> "Repeater"
InvocationType.SITE_MAP_TREE,
InvocationType.SITE_MAP_TABLE -> "Site Map"
InvocationType.SEARCH_RESULTS -> "Search"
else -> "Other"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,35 @@ package com.ganggreentempertatum.stickyburp

import burp.api.montoya.http.handler.*
import burp.api.montoya.http.message.requests.HttpRequest
import burp.api.montoya.core.ToolType

class StickyBurpHttpHandler(private val tab: StickyBurpTab) : HttpHandler {
override fun handleHttpRequestToBeSent(requestToBeSent: HttpRequestToBeSent): RequestToBeSentAction {
if (requestToBeSent.toolSource().toolType() !in listOf(
ToolType.PROXY,
ToolType.REPEATER,
ToolType.INTRUDER,
ToolType.TARGET,
ToolType.SCANNER,
ToolType.LOGGER
)
) {
return RequestToBeSentAction.continueWith(requestToBeSent)
}

var modifiedRequest = requestToBeSent.toString()

for (variable in tab.getVariables()) {
modifiedRequest = modifiedRequest.replace("\${${variable.name}}", variable.value)
}

return if (modifiedRequest != requestToBeSent.toString()) {
RequestToBeSentAction.continueWith(HttpRequest.httpRequest(
requestToBeSent.httpService(),
modifiedRequest
))
RequestToBeSentAction.continueWith(
HttpRequest.httpRequest(
requestToBeSent.httpService(),
modifiedRequest
)
)
} else {
RequestToBeSentAction.continueWith(requestToBeSent)
}
Expand Down

0 comments on commit 99bdc21

Please sign in to comment.