From e5742011db21798d22579ce7baef35f05db8b74e Mon Sep 17 00:00:00 2001 From: Serhatcck Date: Thu, 5 Jun 2025 19:23:58 +0300 Subject: [PATCH] AddTargetToScope and GetProxyHttpHistoryScope tools were added --- .../kotlin/net/portswigger/mcp/tools/Tools.kt | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/net/portswigger/mcp/tools/Tools.kt b/src/main/kotlin/net/portswigger/mcp/tools/Tools.kt index aeb3c69..a153adb 100644 --- a/src/main/kotlin/net/portswigger/mcp/tools/Tools.kt +++ b/src/main/kotlin/net/portswigger/mcp/tools/Tools.kt @@ -163,6 +163,21 @@ fun Server.registerTools(api: MontoyaApi, config: McpConfig) { } } + mcpPaginatedTool("Displays all in-scope items within the proxy HTTP history") { + api.proxy().history { api.scope().isInScope(it.toString()) }.asSequence() + .map { + // Limit the size of serialized data to prevent overflow + val serialized = Json.encodeToString(it.toSerializableForm()) + if (serialized.length > 5000) { + // Truncate long responses to prevent chat overflow + val truncated = serialized.substring(0, 5000) + "... (truncated)" + truncated + } else { + serialized + } + } + } + mcpPaginatedTool("Displays items within the proxy WebSocket history") { api.proxy().webSocketHistory().asSequence() .map { @@ -226,6 +241,11 @@ fun Server.registerTools(api: MontoyaApi, config: McpConfig) { "Editor text has been set" } + + mcpTool("Adds the specified target to Burp Suite's scope") { + api.scope().includeInScope(target) + "Target has been added to scope" + } } fun getActiveEditor(api: MontoyaApi): JTextArea? { @@ -272,7 +292,7 @@ data class SendHttp2Request( @Serializable data class CreateRepeaterTab( - val tabName: String?, + val tabName: String = "", val content: String, override val targetHostname: String, override val targetPort: Int, @@ -281,7 +301,7 @@ data class CreateRepeaterTab( @Serializable data class SendToIntruder( - val tabName: String?, + val tabName: String = "", val content: String, override val targetHostname: String, override val targetPort: Int, @@ -318,6 +338,9 @@ data class SetProxyInterceptState(val intercepting: Boolean) @Serializable data class SetActiveEditorContents(val text: String) +@Serializable +data class AddTargetToScope(val target: String) + @Serializable data class GetScannerIssues(override val count: Int, override val offset: Int) : Paginated @@ -327,6 +350,9 @@ data class GetProxyHttpHistory(override val count: Int, override val offset: Int @Serializable data class GetProxyHttpHistoryRegex(val regex: String, override val count: Int, override val offset: Int) : Paginated +@Serializable +data class GetProxyHttpHistoryScope( override val count: Int, override val offset: Int) : Paginated + @Serializable data class GetProxyWebsocketHistory(override val count: Int, override val offset: Int) : Paginated