From 4ef76eac2b8bca903aa3a21fe01f2d2a39398dbf Mon Sep 17 00:00:00 2001 From: scossa Date: Mon, 18 Aug 2025 18:03:08 +0200 Subject: [PATCH] ora con -p aggiunge ublock ma non lo enabla --- ffproxy.sh | 41 ++++++++++++++++++++++++++--------- firetunn.sh | 61 ----------------------------------------------------- 2 files changed, 31 insertions(+), 71 deletions(-) mode change 100644 => 100755 ffproxy.sh delete mode 100644 firetunn.sh diff --git a/ffproxy.sh b/ffproxy.sh old mode 100644 new mode 100755 index 9ca547d..aceb896 --- a/ffproxy.sh +++ b/ffproxy.sh @@ -1,6 +1,5 @@ #!/bin/bash -set -xeu function istruzioni() { echo -e "\n[Utility per tunnel SOCKS5 su Chromium]" echo @@ -16,18 +15,21 @@ function istruzioni() { # Funzione scarica e installa ublock origin function ublock() { + # 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/socks5-$PORT/extensions - cd /home/$USER/.mozilla/firefox/socks5-$PORT/extensions + VERS=$(curl -s "https://api.github.com/repos/gorhill/uBlock/releases/latest" | jq -r .tag_name ) + LINK_VERS=$(curl -s https://api.github.com/repos/gorhill/uBlock/releases/latest | jq -r '.assets[] | select(.name | test("firefox")) | .browser_download_url') + 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 < ~/.mozilla/firefox/socks5-1234/extensions/manifest.json + wget -q $LINK_VERS + echo -e "\n$LINK_VERS\n" + +# Compila il manifest.json +cat < $PROFILE_DIR/extensions/manifest.json { "manifest_version": 2, "name": "uBlock Origin", @@ -41,6 +43,11 @@ cat < ~/.mozilla/firefox/socks5-1234/extensions/manifest.json EOL fi + +aaa=$(ls $PROFILE_DIR/extensions/uBlock*) +echo $aaa +echo 'mv $aaa $PROFILE_DIR/extensions/uBlock0@raymondhill.net.xpi' +mv "$aaa" "$PROFILE_DIR/extensions/uBlock0@raymondhill.net.xpi" } @@ -54,6 +61,7 @@ fi # Variabili PORT=$1 PROFILE_DIR="$HOME/.mozilla/firefox/socks5-$PORT" +LINK_VERS="" VERS="" incognito_option="" plugin_option="" @@ -63,7 +71,7 @@ if [ ! -d "$PROFILE_DIR" ]; then mkdir -p "$PROFILE_DIR" firefox -no-remote -CreateProfile "socks5-$PORT" "$PROFILE_DIR" - + # Modifica prefs.js con configurazione proxy PREFS_FILE="$PROFILE_DIR/prefs.js" echo 'user_pref("network.proxy.type", 1);' >> "$PREFS_FILE" @@ -72,6 +80,19 @@ if [ ! -d "$PROFILE_DIR" ]; then echo 'user_pref("network.proxy.socks_remote_dns", true);' >> "$PREFS_FILE" fi + +# mette nella var il path sbagliato +schifo=$(awk '/socks5-'$PORT'/ && /Path/ {print; exit}' $HOME/.mozilla/firefox/profiles.ini) ; echo "$schifo" + +dio=$(echo $schifo | sed 's/Path=//g') +#echo $dio +#echo "$HOME/.mozilla/firefox/$dio" +rm -rf "$HOME/.mozilla/firefox/$dio" + +# sotituisce il testo sbagliato con quello giusto +sed -i '/socks5-'$PORT'/ { /Path/ s/'$schifo'/Path=socks5-'$PORT'/; }' $HOME/.mozilla/firefox/profiles.ini + + # Check argomenti for arg in "$@"; do case $arg in @@ -97,4 +118,4 @@ done 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 & +firefox $incognito_option -no-remote -P "socks5-$PORT" > /dev/null 2>&1 & \ No newline at end of file diff --git a/firetunn.sh b/firetunn.sh deleted file mode 100644 index 44ed5b7..0000000 --- a/firetunn.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Lo script: -# - prende in input una porta <1025-65535> -# - crea un nuovo profilo Firefox (se non esiste) dedicato alla porta -# - imposta proxy SOCKS5 su 127.0.0.1: -# - lancia Firefox con quel profilo in background - -if [ "$1" = "-h" -o "$1" = "--help" ] -then - echo "Utility per tunnel SOCKS5 su Firefox, prende in input una porta <1025-65535>" - exit 3 -fi -if [ $# -ne 1 ] -then - echo "ERR - Expected: ffproxy <1025-65535>" - exit 2 -fi - -PORT=$1 -PROFILE_DIR="$HOME/.mozilla/firefox/socks5-$PORT" - -# Crea un nuovo profilo Firefox se non esiste -if [ ! -d "$PROFILE_DIR" ]; then - mkdir -p "$PROFILE_DIR" - firefox -no-remote -CreateProfile "socks5-$PORT" "$PROFILE_DIR" - - # Modifica prefs.js con configurazione proxy - PREFS_FILE="$PROFILE_DIR/prefs.js" - echo 'user_pref("network.proxy.type", 1);' >> "$PREFS_FILE" - echo 'user_pref("network.proxy.socks", "127.0.0.1");' >> "$PREFS_FILE" - echo "user_pref(\"network.proxy.socks_port\", $PORT);" >> "$PREFS_FILE" - echo 'user_pref("network.proxy.socks_remote_dns", true);' >> "$PREFS_FILE" -fi - - -# 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 &