Skip to content

Instantly share code, notes, and snippets.

@dcondrey
Forked from nytr0gen/update_burp.sh
Created September 6, 2023 04:22
Show Gist options
  • Save dcondrey/0af09634b4f264608b29660c92dc5708 to your computer and use it in GitHub Desktop.
Save dcondrey/0af09634b4f264608b29660c92dc5708 to your computer and use it in GitHub Desktop.
Create an MacOS App from Burp Jar File
#!/bin/bash
version=$(curl -s https://portswigger.net/burp/releases | grep "Professional / Community" | head -n1 | grep -E "[0-9\.]+" -o)
if [[ -d ~/Applications/BurpSuite.app ]]; then
local_version=$(cat ~/Applications/BurpSuite.app/Contents/Resources/version.txt)
if [[ "$version" == "$local_version" ]]; then
echo "Latest version is $version - which is the same as the local"
exit 1
fi
fi
tmpdir=$(mktemp -d)
mkdir -p $tmpdir/Contents/MacOS
mkdir -p $tmpdir/Contents/Resources
echo $version > $tmpdir/Contents/Resources/version.txt
cp $(cd "$(dirname "$0")"; pwd)/update_burp_icon.icns $tmpdir/Contents/Resources/app.icns
wget "https://portswigger.net/burp/releases/download?product=pro&version=$version&type=Jar" \
-O $tmpdir/Contents/MacOS/burpsuite.jar
cat <<\EOF > $tmpdir/Contents/MacOS/launcher
#!/bin/sh
# Set the working directory
DIR=$(cd "$(dirname "$0")"; pwd)
# Run the application
exec "$DIR/burpRunner" $DIR
EOF
chmod +x $tmpdir/Contents/MacOS/launcher
cat <<\EOF > $tmpdir/Contents/MacOS/burpRunner
#!/bin/sh
DIR=$1
APP_JAR="burpsuite.jar"
APP_NAME="Burp Suite Professional"
cd "$DIR"
java -Xdock:name="$APP_NAME" \
-Xdock:icon="$DIR/../Resources/app.icns"\
-cp "$DIR;.;" \
-jar --illegal-access=permit "$DIR/$APP_JAR"
EOF
chmod +x $tmpdir/Contents/MacOS/burpRunner
cat <<EOF > $tmpdir/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>launcher</string>
<key>CFBundleIconFile</key>
<string>app.icns</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$version</string>
<key>CFBundleSignature</key>
<string>xmmd</string>
<key>CFBundleVersion</key>
<string>$version</string>
<key>NSAppleScriptEnabled</key>
<string>NO</string>
</dict>
</plist>
EOF
if [[ -d ~/Applications/BurpSuite.app ]]; then
rm -rf ~/Applications/BurpSuite.app
fi
mv $tmpdir ~/Applications/BurpSuite.app
echo "Updated Burp to $version at ~/Applications/BurpSuite.app"
open ~/Applications/BurpSuite.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment