Skip to content

Commit

Permalink
Fix the update/reset of TorBox config files
Browse files Browse the repository at this point in the history
  • Loading branch information
radio24 committed Oct 6, 2024
1 parent 2ca887f commit f700676
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bin/restore
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ if (whiptail --title "TorBox - INFO (scroll down!)" --scrolltext --yesno "$INPUT
sudo sed -E -i "s/## This will configure the Onion Services.*/$NEW_STRING/g" "${TORRC}"
# Konvertieren alle \n zu echten Zeilenumbrüchen
sudo sed -i 's/\\n/\n/g' "${TORRC}"
sleep 30
sleep 1
fi

# Restoring server access authorization
Expand Down
15 changes: 9 additions & 6 deletions menu-update
Original file line number Diff line number Diff line change
Expand Up @@ -529,20 +529,23 @@ update_torcfg()
REPLACE_STRING="$REPLACE_STRING\n$SNOW_BRIDGE"
sudo sed -E -i "s/^## Snowflake .*/$REPLACE_STRING/g" "${TORRC}"
fi

if [ -z $OBFS4_BRIDGE ] ; then (sudo sed -i "s/^Bridge obfs4/#Bridge obfs4" ${TORRC}) 2>/dev/null ; else (printf %s"$OBFS4_BRIDGE\n" | sudo tee -a $TORRC) 2>/dev/null ; fi
if [ -z $CLIENTONIONAUTHDIR ] ; then (sudo sed -i "s/^ClientOnionAuthDir/#ClientOnionAuthDir/" ${TORRC}) 2>/dev/null ; else (sudo sed -i "s/^#ClientOnionAuthDir/ClientOnionAuthDir/" ${TORRC}) 2>/dev/null ; fi
sudo sed -i "s/^$TOR_INCLUDE_EX_SLOW/#$TOR_INCLUDE_EX_SLOW/" ${TORRC}

echo -e "${RED}[+] Restoring Onion Service data...${NOCOLOR}"
sudo sed -i "/HiddenServiceDir/d" ${TORRC}
sudo sed -i "/HiddenServicePort/d" ${TORRC}
# Using the Anchor in torrc
REPLACE_STRING=$(grep -m 1 "This will configure the Onion Services" ${TORRC})
#This is necessary to work with special characters in sed
HIDDENSERVICES="$(<<< "$HIDDENSERVICES" sed -e 's`[][\\/.*^$]`\\&`g')"
REPLACE_STRING="$(<<< "$REPLACE_STRING" sed -e 's`[][\\/.*^$]`\\&`g')"
HIDDENSERVICE="$(<<< "$HIDDENSERVICE" sed -e 's`[][\\/.*^$]`\\&`g')"
HIDDENSERVICE="\n$HIDDENSERVICE"
NEW_STRING="$REPLACE_STRING\n$HIDDENSERVICES"
#Writing the necessary entries on the right place in torrc (not at the end, because there are already the bridges)
sudo sed -E -i "s/## This will configure the Onion Services.*/$REPLACE_STRING$NEW_STRING/g" "${TORRC}"

sudo sed -E -i "s/## This will configure the Onion Services.*/$NEW_STRING/g" "${TORRC}"
# Konvertieren alle \n zu echten Zeilenumbrüchen
sudo sed -i 's/\\n/\n/g' "${TORRC}"
sleep 1
echo -e "${RED}[+]${NOCOLOR} Activating IP forwarding"
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
echo -e "${RED}[+]${NOCOLOR} Changing .profile if necessary"
Expand Down

0 comments on commit f700676

Please sign in to comment.