ora con -p aggiunge ublock ma non lo enabla
This commit is contained in:
41
ffproxy.sh
Normal file → Executable file
41
ffproxy.sh
Normal file → Executable 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
|
||||
|
||||
# Compila il manifest.json
|
||||
cat <<EOL > ~/.mozilla/firefox/socks5-1234/extensions/manifest.json
|
||||
wget -q $LINK_VERS
|
||||
echo -e "\n$LINK_VERS\n"
|
||||
|
||||
# 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=""
|
||||
@@ -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 &
|
||||
Reference in New Issue
Block a user