ora con -p aggiunge ublock ma non lo enabla

This commit is contained in:
scossa
2025-08-18 18:03:08 +02:00
parent 5bcbd4935f
commit 4ef76eac2b
2 changed files with 31 additions and 71 deletions

35
ffproxy.sh Normal file → Executable file
View File

@@ -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
wget -q $LINK_VERS
echo -e "\n$LINK_VERS\n"
# Compila il manifest.json
cat <<EOL > ~/.mozilla/firefox/socks5-1234/extensions/manifest.json
# Compila il manifest.json
cat <<EOL > $PROFILE_DIR/extensions/manifest.json
{
"manifest_version": 2,
"name": "uBlock Origin",
@@ -41,6 +43,11 @@ cat <<EOL > ~/.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=""
@@ -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

View File

@@ -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:<porta>
# - 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 <<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 &