diff --git a/bin/chrome-3pcd-ps.bat b/bin/chrome-3pcd-ps.bat new file mode 100644 index 000000000..bd79917d0 --- /dev/null +++ b/bin/chrome-3pcd-ps.bat @@ -0,0 +1,15 @@ +:: Chrome 3pcd with PS Extension + +:: Download PS Extension +set "ps_analysis_tool_version=v0.4.1" +cd /d %TEMP% +if not exist %TEMP%\ps-analysis-tool-%ps_analysis_tool_version% ( + mkdir %TEMP%\ps-analysis-tool-%ps_analysis_tool_version% + curl -L -O -s https://github.com/GoogleChromeLabs/ps-analysis-tool/releases/download/%ps_analysis_tool_version%/extension-%ps_analysis_tool_version%.zip + tar -xf extension-%ps_analysis_tool_version%.zip -C %TEMP%\ps-analysis-tool-%ps_analysis_tool_version% +) + +set "CHROME_PATH=C:\Program Files\Google\Chrome\Application\chrome.exe" +set "DATA_DIR=%TEMP%\chrome_data_dir-%RANDOM%" +"%CHROME_PATH%" --disable-sync --no-default-browser-check --no-first-run --user-data-dir="%DATA_DIR%" --install-autogenerated-theme="255,51,51" --silent-debugger-extension-api --test-third-party-cookie-phaseout --enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI" --load-extension="%TEMP%\ps-analysis-tool-%ps_analysis_tool_version%\extension" https://example.com >nul 2>&1 +rmdir /s /q "%DATA_DIR%" >nul diff --git a/bin/chrome-3pcd.bat b/bin/chrome-3pcd.bat new file mode 100644 index 000000000..db0ea20be --- /dev/null +++ b/bin/chrome-3pcd.bat @@ -0,0 +1,6 @@ +:: Chrome 3pcd + +set "CHROME_PATH=C:\Program Files\Google\Chrome\Application\chrome.exe" +set "DATA_DIR=%TEMP%\chrome_data_dir-%RANDOM%" +"%CHROME_PATH%" --disable-sync --no-default-browser-check --no-first-run --user-data-dir="%DATA_DIR%" --install-autogenerated-theme="255,51,51" --silent-debugger-extension-api --test-third-party-cookie-phaseout --enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI" https://example.com >nul 2>&1 +rmdir /s /q "%DATA_DIR%" >nul diff --git a/bin/chrome-chip.bat b/bin/chrome-chip.bat new file mode 100644 index 000000000..661a9ba54 --- /dev/null +++ b/bin/chrome-chip.bat @@ -0,0 +1,6 @@ +:: Chrome Chip + +set "CHROME_PATH=C:\Program Files\Google\Chrome\Application\chrome.exe" +set "DATA_DIR=%TEMP%\chrome_data_dir-%RANDOM%" +"%CHROME_PATH%" --disable-sync --no-default-browser-check --no-first-run --user-data-dir="%DATA_DIR%" --install-autogenerated-theme="150,220,150" --silent-debugger-extension-api --partitioned-cookies=true https://example.com >nul 2>&1 +rmdir /s /q "%DATA_DIR%" >nul \ No newline at end of file diff --git a/bin/chrome-default-ps.bat b/bin/chrome-default-ps.bat new file mode 100644 index 000000000..ac65f2fbf --- /dev/null +++ b/bin/chrome-default-ps.bat @@ -0,0 +1,15 @@ +:: Default Chrome with PS Extension + +:: Download PS Extension +set "ps_analysis_tool_version=v0.4.1" +cd /d %TEMP% +if not exist %TEMP%\ps-analysis-tool-%ps_analysis_tool_version% ( + mkdir %TEMP%\ps-analysis-tool-%ps_analysis_tool_version% + curl -L -O -s https://github.com/GoogleChromeLabs/ps-analysis-tool/releases/download/%ps_analysis_tool_version%/extension-%ps_analysis_tool_version%.zip + tar -xf extension-%ps_analysis_tool_version%.zip -C %TEMP%\ps-analysis-tool-%ps_analysis_tool_version% +) + +set "CHROME_PATH=C:\Program Files\Google\Chrome\Application\chrome.exe" +set "DATA_DIR=%TEMP%\chrome_data_dir-%RANDOM%" +"%CHROME_PATH%" --disable-sync --no-default-browser-check --no-first-run --user-data-dir="%DATA_DIR%" --install-autogenerated-theme="150,220,150" --silent-debugger-extension-api --load-extension="%TEMP%\ps-analysis-tool-%ps_analysis_tool_version%\extension" https://example.com >nul 2>&1 +rmdir /s /q "%DATA_DIR%" >nul diff --git a/bin/chrome-default.bat b/bin/chrome-default.bat new file mode 100644 index 000000000..502c41fbe --- /dev/null +++ b/bin/chrome-default.bat @@ -0,0 +1,6 @@ +:: Default Chrome + +set "CHROME_PATH=C:\Program Files\Google\Chrome\Application\chrome.exe" +set "DATA_DIR=%TEMP%\chrome_data_dir-%RANDOM%" +"%CHROME_PATH%" --disable-sync --no-default-browser-check --no-first-run --user-data-dir="%DATA_DIR%" --install-autogenerated-theme="150,220,150" --silent-debugger-extension-api https://example.com >nul 2>&1 +rmdir /s /q "%DATA_DIR%" >nul diff --git a/bin/chrome-psat.bat b/bin/chrome-psat.bat new file mode 100644 index 000000000..4092a6eec --- /dev/null +++ b/bin/chrome-psat.bat @@ -0,0 +1,5 @@ +curl -s https://raw.githubusercontent.com/GoogleChromeLabs/ps-analysis-tool/Setup-Different-Chrome-For-Demo/bin/chrome-default.bat -o chrome-default.bat +curl -s https://raw.githubusercontent.com/GoogleChromeLabs/ps-analysis-tool/Setup-Different-Chrome-For-Demo/bin/chrome-3pcd.bat -o chrome-3pcd.bat +curl -s https://raw.githubusercontent.com/GoogleChromeLabs/ps-analysis-tool/Setup-Different-Chrome-For-Demo/bin/chrome-default-ps.bat -o chrome-default-ps.bat +curl -s https://raw.githubusercontent.com/GoogleChromeLabs/ps-analysis-tool/Setup-Different-Chrome-For-Demo/bin/chrome-3pcd-ps.bat -o chrome-3pcd-ps.bat +curl -s https://raw.githubusercontent.com/GoogleChromeLabs/ps-analysis-tool/Setup-Different-Chrome-For-Demo/bin/chrome-chip.bat -o chrome-chip.bat \ No newline at end of file diff --git a/bin/chrome_launcher.sh b/bin/chrome_launcher.sh new file mode 100644 index 000000000..b31094925 --- /dev/null +++ b/bin/chrome_launcher.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Download Extension +extension_setup() { + ps_analysis_tool_version=v0.4.1 + extension_dir="/var/tmp" + cd $extension_dir + if [ ! -d $extension_dir/ps-analysis-tool-$ps_analysis_tool_version ]; then + mkdir -p $extension_dir/ps-analysis-tool-$ps_analysis_tool_version + curl -L -O -s https://github.com/GoogleChromeLabs/ps-analysis-tool/releases/download/$ps_analysis_tool_version/extension-$ps_analysis_tool_version.zip + unzip -qo extension-$ps_analysis_tool_version.zip -d $extension_dir/ps-analysis-tool-$ps_analysis_tool_version + fi + cd - +} + +# Detect OS +if [[ "$(uname)" == "Darwin" ]]; then + # Loads Chrome with a temporary profile that is deleted after Chrome is closed + launch_chrome() { + local CHROME_PATH="/Applications/Google Chrome.app" + local DATA_DIR="$(mktemp -d '/tmp/chrome_data_dir.XXXXXXXXXX')" + open -W -na "${CHROME_PATH}" --args \ + --disable-sync \ + --no-default-browser-check \ + --no-first-run \ + --start-maximized \ + --auto-open-devtools-for-tabs \ + --user-data-dir="${DATA_DIR}" \ + --silent-debugger-extension-api \ + "$@" https://example.com >/dev/null 2>&1 && rm -rf "${DATA_DIR}" & + } +elif [[ "$(uname)" == "Linux" ]]; then + # Loads Chrome with a temporary profile that is deleted after Chrome is closed + launch_chrome() { + local CHROME="google-chrome" + local DATA_DIR="$(mktemp -d '/tmp/chrome_data_dir.XXXXXXXXXX')" + "${CHROME}" \ + --disable-sync \ + --no-default-browser-check \ + --no-first-run \ + --start-maximized \ + --auto-open-devtools-for-tabs \ + --user-data-dir="${DATA_DIR}" \ + --silent-debugger-extension-api \ + "$@" https://example.com >/dev/null 2>&1 && rm -rf "${DATA_DIR}" & + } +fi + +# Launch default chrome +chrome-default() { + launch_chrome \ + --install-autogenerated-theme='150,220,150' +} + +# Launch default chrome with 3rd Party Cookie Phaseout +chrome-3pcd() { + launch_chrome \ + --install-autogenerated-theme='255,51,51' \ + --test-third-party-cookie-phaseout \ + --enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI" +} + +# Launch default chrome with Privacy Sandbox extension +chrome-default-ps() { + extension_setup + launch_chrome \ + --install-autogenerated-theme='150,220,150' \ + --load-extension="$extension_dir/ps-analysis-tool-$ps_analysis_tool_version/extension/" +} + +# Launch default chrome with 3rd Party Cookie Phaseout with Privacy Sandbox extension +chrome-3pcd-ps() { + extension_setup + launch_chrome \ + --install-autogenerated-theme='255,51,51' \ + --test-third-party-cookie-phaseout \ + --load-extension="$extension_dir/ps-analysis-tool-$ps_analysis_tool_version/extension" \ + --enable-features="FirstPartySets,StorageAccessAPI,StorageAccessAPIForOriginExtension,PageInfoCookiesSubpage,PrivacySandboxFirstPartySetsUI" +} + +# Launch default chrome with Partitioned Cookies +chrome-chip() { + launch_chrome \ + --partitioned-cookies=true +} diff --git a/bin/install.sh b/bin/install.sh new file mode 100644 index 000000000..2910975dc --- /dev/null +++ b/bin/install.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# create bin directory inside user home +mkdir -p ~/bin/ + +# Download Chrome Launcher Script and save to ~/bin/chrome_launcher.sh +curl -s https://raw.githubusercontent.com/GoogleChromeLabs/ps-analysis-tool/Setup-Different-Chrome-For-Demo/bin/chrome_launcher.sh -o ~/bin/chrome_launcher.sh + +chmod 755 ~/bin/chrome_launcher.sh + +# Check Shell and auto source chrome_launcher.sh +case $SHELL in +*/zsh) + grep "chrome_launcher.sh" ~/.zshrc > /dev/null + if [ $? -ne 0 ]; then + { + echo "if [ -f ~/bin/chrome_launcher.sh ]; then" + echo -e "\tsource ~/bin/chrome_launcher.sh" + echo "fi" + } >> ~/.zshrc + fi + echo -e "Script added to ~/.zshrc, please restart your terminal session or run: \n\tsource ~/.zshrc" + ;; +*/bash) + grep "chrome_launcher.sh" ~/.bashrc > /dev/null + if [ $? -ne 0 ]; then + { + echo "if [ -f ~/bin/chrome_launcher.sh ]; then" + echo -e "\tsource ~/bin/chrome_launcher.sh" + echo "fi" + } >> ~/.bashrc + fi + echo -e "Script added to ~/.bashrc, please restart your terminal session or run: \n\tsource ~/.bashrc" + ;; +esac + +echo -e "New commands that will be available in new terminal session: \n\tchrome-default \n\tchrome-3pcd \n\tchrome-default-ps \n\tchrome-3pcd-ps" + +# Source into current terminal session as well +source ~/bin/chrome_launcher.sh