From 5bcbd4935f88b03a4f7b8ab8a88178f9733d594b Mon Sep 17 00:00:00 2001 From: scossa Date: Mon, 18 Aug 2025 16:34:51 +0200 Subject: [PATCH] up --- ffproxy.sh | 53 ++++++++++++++++++++++++++++------------------------- firetunn.sh | 24 ++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/ffproxy.sh b/ffproxy.sh index a9ca01f..9ca547d 100644 --- a/ffproxy.sh +++ b/ffproxy.sh @@ -1,46 +1,49 @@ #!/bin/bash +set -xeu function istruzioni() { - echo "[Utility per tunnel SOCKS5 su Chromium]" + echo -e "\n[Utility per tunnel SOCKS5 su Chromium]" echo - echo "utilizzo: ffproxy [-i] [-p]" + echo "utilizzo: ffproxy <1025-65535> [-i] [-p]" echo echo "esempio:" echo "Su una finestra del terminale: ssh user@server.mio -D 1234" echo "Su un'altra finestra del terminale: ffproxy 1234" echo "Argomenti" echo "-i attiva incognito mode" - echo "-p uBlock Origin preinstallato" + echo -e "-p uBlock Origin preinstallato\n" } # Funzione scarica e installa ublock origin function ublock() { - # Se la cartella del profilo sock5$PORT nonn esiste - if [ ! -d "/home/$USER/.mozilla/firefox/ffproxy/socks5-$PORT/extensions" ]; then - # Trova la vers attuale e crea la cartella con il nome della porta + # Se la cartella del profilo socks-$PORT non esiste + if [ ! -d "/home/$USER/.mozilla/firefox/socks5-$PORT/extensions" ]; then + # Trova la versione attuale e crea la cartella con il nome della porta VERS=$(curl -s "https://api.github.com/repos/gorhill/uBlock/releases/latest" | jq -r .tag_name | sed 's/..$//') - mkdir -p /home/$USER/.mozilla/firefox/ffproxy/socks5-$PORT/extensions - cd /home/$USER/.mozilla/firefox/ffproxy/socks5-$PORT/extensions + mkdir -p /home/$USER/.mozilla/firefox/socks5-$PORT/extensions + cd /home/$USER/.mozilla/firefox/socks5-$PORT/extensions # Scarica ublock Origin wget -q https://github.com/gorhill/uBlock/releases/download/$VERS.1b7/uBlock0_$VERS.1b7.firefox.signed.xpi + # Compila il manifest.json - cat < ~/.mozilla/firefox/ffproxy/socks5-$PORT/extensions/manifest.json - { - "manifest_version": 2, - "name": "uBlock Origin", - "version": "$VERS.1b7", - "applications": { - "gecko": { - "id": "uBlock0@raymondhill.net" - } - } - } +cat < ~/.mozilla/firefox/socks5-1234/extensions/manifest.json +{ + "manifest_version": 2, + "name": "uBlock Origin", + "version": "$VERS.1b7", + "applications": { + "gecko": { + "id": "uBlock0@raymondhill.net" + } + } +} EOL fi } + # Mostra Help if [ "$1" = "-h" -o "$1" = "--help" ] then @@ -50,13 +53,13 @@ fi # Variabili PORT=$1 -PROFILE_DIR="$HOME/.mozilla/firefox/ffproxy/socks5-$PORT" +PROFILE_DIR="$HOME/.mozilla/firefox/socks5-$PORT" VERS="" incognito_option="" plugin_option="" # Crea un nuovo profilo Firefox se non esiste -if [ ! -d "PROFILE_DIR" ]; then +if [ ! -d "$PROFILE_DIR" ]; then mkdir -p "$PROFILE_DIR" firefox -no-remote -CreateProfile "socks5-$PORT" "$PROFILE_DIR" @@ -73,25 +76,25 @@ fi for arg in "$@"; do case $arg in -i) - incognito_option="--private-window" + incognito_option=" --private-window " ;; -p) ublock ;; -ip) - incognito_option="--private-window" + incognito_option=" --private-window " ublock ;; -pi) ublock - incognito_option="--private-window" + incognito_option=" --private-window " ;; esac done # Mostra comando da avviare -echo -e '\nfirefox '$incognito_option $plugin_option' -no-remote -P "socks5-'$PORT'"\n' +echo -e '\nfirefox'$incognito_option'-no-remote -P "socks5-'$PORT'"\n' # Avvia Firefox con quel profilo firefox $incognito_option -no-remote -P "socks5-$PORT" > /dev/null 2>&1 & diff --git a/firetunn.sh b/firetunn.sh index fc0a9a5..44ed5b7 100644 --- a/firetunn.sh +++ b/firetunn.sh @@ -18,7 +18,7 @@ then fi PORT=$1 -PROFILE_DIR="$HOME/.mozilla/firefox/ffproxy/socks5-$PORT" +PROFILE_DIR="$HOME/.mozilla/firefox/socks5-$PORT" # Crea un nuovo profilo Firefox se non esiste if [ ! -d "$PROFILE_DIR" ]; then @@ -34,8 +34,28 @@ if [ ! -d "$PROFILE_DIR" ]; then fi -echo -e '\nfirefox -no-remote -P "socks5-'$PORT'"\n' +# PORCODIO +VERS=$(curl -s "https://api.github.com/repos/gorhill/uBlock/releases/latest" | jq -r .tag_name | sed 's/..$//') +mkdir -p $PROFILE_DIR/extensions +cd /$PROFILE_DIR/extensions +# Scarica ublock Origin +wget -q https://github.com/gorhill/uBlock/releases/download/$VERS.1b7/uBlock0_$VERS.1b7.firefox.signed.xpi +# Compila il manifest.json +cat < $PROFILE_DIR/extensions/manifest.json +{ + "manifest_version": 2, + "name": "uBlock Origin", + "version": "$VERS.1b7", + "applications": { + "gecko": { + "id": "uBlock0@raymondhill.net" + } + } +} +EOL +echo -e '\nfirefox -no-remote -P "socks5-'$PORT'"\n' + # Avvia Firefox con quel profilo firefox -no-remote -P "socks5-$PORT" > /dev/null 2>&1 &