From 39ca4cdc074c4c5171500775353ca0ddda10c4a1 Mon Sep 17 00:00:00 2001 From: phorcys420 <57866459+phorcys420@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:28:14 +0000 Subject: [PATCH 1/2] fix: fix burp tests and add `$BURP_HOME` --- .github/workflows/test.yaml | 3 ++- src/burp-suite/devcontainer-feature.json | 5 +++++ src/burp-suite/install.sh | 9 ++++++--- test/burp-suite/desktop.sh | 3 --- test/burp-suite/scenarios.json | 11 +---------- test/burp-suite/test.sh | 3 ++- 6 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 test/burp-suite/desktop.sh diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ff39acc..8a59ca5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,6 +13,7 @@ jobs: strategy: matrix: features: + - burp-suite - coder - cutter - ghidra @@ -37,8 +38,8 @@ jobs: strategy: matrix: features: - - coder - burp-suite + - coder - cutter - ghidra - lib-common diff --git a/src/burp-suite/devcontainer-feature.json b/src/burp-suite/devcontainer-feature.json index 1230da9..1a2e405 100644 --- a/src/burp-suite/devcontainer-feature.json +++ b/src/burp-suite/devcontainer-feature.json @@ -26,6 +26,11 @@ } }, + "containerEnv": { + "BURP_HOME": "/opt/burp", + "PATH": "${PATH}:${BURP_HOME}" + }, + "installsAfter": [ "ghcr.io/devcontainers/features/common-utils", "ghcr.io/devcontainers/features/desktop-lite" diff --git a/src/burp-suite/install.sh b/src/burp-suite/install.sh index 17b4ed9..fdea50d 100755 --- a/src/burp-suite/install.sh +++ b/src/burp-suite/install.sh @@ -8,13 +8,16 @@ echo "Activating feature '$FEATURE_NAME'" # Source lib-common feature source "/usr/share/phorcys-devcontainer-libraries/common/1/main.sh" -# Check for dependencies -checkPackages curl ca-certificates jq sudo +# Check for dependencies (libfreetype6 is only really needed to run in CI, otherwise you would always have this library if you have the desktop-lite feature) +checkPackages curl ca-certificates jq sudo libfreetype6 # Load options EDITION=${EDITION:-community} VERSION=${VERSION:-latest} +# CUTTER_HOME is defined in the containerEnv value of the feature's manifest +BURP_HOME=${BURP_HOME:-/opt/burp} + if [ $VERSION = "latest" ]; then echo "[$FEATURE_NAME] [+] Grabbing the latest Burp version" @@ -40,6 +43,6 @@ curl --get --location --silent --show-error --fail \ chmod +rx "$TMP" -R echo "[$FEATURE_NAME] [+] Installing Burp $EDITION" -sudo -u "$_REMOTE_USER" "$DESTINATION_FILE" -q # $_REMOTE_USER_HOME +"$DESTINATION_FILE" -q -dir "$BURP_HOME" -overwrite rm -rf "$TMP" \ No newline at end of file diff --git a/test/burp-suite/desktop.sh b/test/burp-suite/desktop.sh deleted file mode 100644 index b5de05b..0000000 --- a/test/burp-suite/desktop.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -# Do nothing \ No newline at end of file diff --git a/test/burp-suite/scenarios.json b/test/burp-suite/scenarios.json index e0c6b06..9e26dfe 100644 --- a/test/burp-suite/scenarios.json +++ b/test/burp-suite/scenarios.json @@ -1,10 +1 @@ -{ - "desktop": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - "features": { - "ghcr.io/devcontainers/features/desktop-lite:1": {}, - - "burp-suite": {} - } - } -} \ No newline at end of file +{} \ No newline at end of file diff --git a/test/burp-suite/test.sh b/test/burp-suite/test.sh index 4378ccd..b747390 100644 --- a/test/burp-suite/test.sh +++ b/test/burp-suite/test.sh @@ -5,7 +5,8 @@ set -euo pipefail # Optional: Import test library bundled with the devcontainer CLI source dev-container-features-test-lib -# Do nothing +check "Burp folder exists" test -d "$BURP_HOME" +check "Burp binary is in the PATH" which BurpSuiteCommunity # Report results # If any of the checks above exited with a non-zero exit code, the test will fail. From bd52e1a41a7fb0d335dd4cb54088e0b11b8915b2 Mon Sep 17 00:00:00 2001 From: phorcys420 <57866459+phorcys420@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:31:40 +0000 Subject: [PATCH 2/2] chore: "Burp" -> "Burp Suite" --- src/burp-suite/devcontainer-feature.json | 2 +- src/burp-suite/install.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/burp-suite/devcontainer-feature.json b/src/burp-suite/devcontainer-feature.json index 1a2e405..bfbe8a4 100644 --- a/src/burp-suite/devcontainer-feature.json +++ b/src/burp-suite/devcontainer-feature.json @@ -27,7 +27,7 @@ }, "containerEnv": { - "BURP_HOME": "/opt/burp", + "BURP_HOME": "/opt/burp-suite", "PATH": "${PATH}:${BURP_HOME}" }, diff --git a/src/burp-suite/install.sh b/src/burp-suite/install.sh index fdea50d..4f27690 100755 --- a/src/burp-suite/install.sh +++ b/src/burp-suite/install.sh @@ -16,10 +16,10 @@ EDITION=${EDITION:-community} VERSION=${VERSION:-latest} # CUTTER_HOME is defined in the containerEnv value of the feature's manifest -BURP_HOME=${BURP_HOME:-/opt/burp} +BURP_HOME=${BURP_HOME:-/opt/burp-suite} if [ $VERSION = "latest" ]; then - echo "[$FEATURE_NAME] [+] Grabbing the latest Burp version" + echo "[$FEATURE_NAME] [+] Grabbing the latest Burp Suite version" RELEASE_DATA=$(curl 'https://portswigger.net/burp/releases/data?previousLastId=-1&lastId=-1&pageSize=5' --silent --show-error --fail) @@ -42,7 +42,7 @@ curl --get --location --silent --show-error --fail \ # Make temporary directory accessible to all users chmod +rx "$TMP" -R -echo "[$FEATURE_NAME] [+] Installing Burp $EDITION" +echo "[$FEATURE_NAME] [+] Installing Burp Suite $EDITION edition" "$DESTINATION_FILE" -q -dir "$BURP_HOME" -overwrite rm -rf "$TMP" \ No newline at end of file