This commit is contained in:
scossa
2025-08-18 16:34:51 +02:00
parent 16050bc233
commit 5bcbd4935f
2 changed files with 50 additions and 27 deletions

View File

@@ -1,31 +1,33 @@
#!/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 <SOCKS5 PORT[1025-65535]> [-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 <<EOL > ~/.mozilla/firefox/ffproxy/socks5-$PORT/extensions/manifest.json
cat <<EOL > ~/.mozilla/firefox/socks5-1234/extensions/manifest.json
{
"manifest_version": 2,
"name": "uBlock Origin",
@@ -41,6 +43,7 @@ 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"
@@ -91,7 +94,7 @@ 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 &

View File

@@ -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 <<EOL > $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 &