Skip to content

Commit

Permalink
Merge branch 'refs/heads/python-check' into tfs-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
zotil committed Aug 6, 2024
2 parents 6c31774 + 427194e commit 4219175
Show file tree
Hide file tree
Showing 86 changed files with 5,999 additions and 2,944 deletions.
26 changes: 26 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
click = "*"
numpy = "*"
pytesseract = "*"
flask = "*"
flask-socketio = "*"
flask-restful = "*"
flask-cors = "*"
peewee = "*"
pgpy = "*"
urwid = "*"
tornado = "*"
paramiko = "*"

[dev-packages]
opencv-python-headless = "*"
pytest = "*"

[requires]
python_version = "3.11"
801 changes: 801 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TorBox is ideal for providing additional protection for the entire data stream a
2. Transfer the downloaded image file on an [SD Card](https://en.wikipedia.org/wiki/Secure_Digital), for example, with [Etcher](https://www.balena.io/etcher/). TorBox needs at least an 8 GB SD Card.
3. Put the SD Card into your Raspberry Pi, link it with an Internet router using an Ethernet cable, or place an USB WiFi adapter in one of the USB ports to use an existing WiFi. Afterwards, start the Raspberry Pi. During the start, the system on the SD card automatically expands over the entire free partition – user interaction, screen, and peripherals are not required yet.
4. After 2-3 minutes, when the green LED stops to flicker, connect your client to the new WiFi “**TorBox053**” (password: **CHANGE-IT**).
5. Login to the TorBox by using a [SSH client](https://www.torbox.ch/?page_id=112#how-can-i-access-the-torbox-menu) (**192.168.42.1** on a WiFi client, **192.168.43.1** on a cable client or **192.168.44.1** when connected via VPN) or a web browser (http://192.168.42.1 on a WiFi client, http://192.168.43.1 on a cable client or http://192.168.44.1 when connected via VPN; username: **torbox** / password: **CHANGE-IT**).
5. Login to the TorBox by using a [SSH client](https://www.torbox.ch/?page_id=112#how-can-i-access-the-torbox-menu) (**192.168.42.1** on a WiFi client, **192.168.43.1** on a cable client or **192.168.44.1** when connected via VPN or if you use a Raspberry Pi Zero 2 W as a RNDIS/Ethernet Gadget) or a web browser (http://192.168.42.1 on a WiFi client, http://192.168.43.1 on a cable client or http://192.168.44.1 when connected via VPN; username: **torbox** / password: **CHANGE-IT**).
6. After [seeing a welcome screen and answering some initial questions during the first start-up](https://www.torbox.ch/?page_id=2637), you should see the [TorBox Main Menu](https://www.torbox.ch/?page_id=775). Immediately, you should **change the default passwords** (the associated entries are placed in the [configuration sub-menu](https://www.torbox.ch/?page_id=875).

At least a **Raspberry Pi 3 [Model B+](https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/)** or a **[Raspberry Pi 4 Model B](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/)** is recommended. TorBox should also work on a new **[Raspberry Pi 5](https://www.raspberrypi.com/news/introducing-raspberry-pi-5/)**, but we couldn't verify this yet. However, we offer also [installation script for other systems](https://www.torbox.ch/?page_id=1168), which might run on older (32bit) or other hardware platforms.
Expand Down
10 changes: 5 additions & 5 deletions bin/backup
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MENU_HEIGHT_20=20

#Colors
RED='\033[1;31m'
WHITE='\033[1;37m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

#Generating the filename for the backup
Expand Down Expand Up @@ -177,15 +177,15 @@ if (whiptail --title "TorBox - INFO (scroll down!)" --scrolltext --no-button "NO
(sudo ln -sf "${WEBSITE_DIR}" "${BACKUP_DIR}/shared_folders") 2>/dev/null
fi
echo ""
echo -e "${WHITE}[+] Backup is done!${NOCOLOR}"
echo -e "${RED}[+] You will find it here: ${WHITE}${OS_BK_TAR}"
echo -e "${YELLOW}[+] Backup is done!${NOCOLOR}"
echo -e "${RED}[+] You will find it here: ${YELLOW}${OS_BK_TAR}"
echo " "
read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m'
clear
else
clear
echo -e "${WHITE}[!] ABORT! NOT ENOUGH SPACE!${NOCOLOR}"
echo -e "${WHITE}[+] Did you include shared folders? Please, try again without them!${NOCOLOR}"
echo -e "${YELLOW}[!] ABORT! NOT ENOUGH SPACE!${NOCOLOR}"
echo -e "${YELLOW}[+] Did you include shared folders? Please, try again without them!${NOCOLOR}"
echo " "
read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m'
clear
Expand Down
18 changes: 9 additions & 9 deletions bin/bridges_activate_obfs4
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ MENU_LIST_HEIGHT=$((NO_ITEMS+NO_SPACER))

#Colors
RED='\033[1;31m'
WHITE='\033[1;37m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

#Other variables
Expand Down Expand Up @@ -85,7 +85,7 @@ fi

if [ $number_configured_bridges_deactivated = 0 ]; then
clear
echo -e "${WHITE}[!] There are no deactivated OBFS4 bridges. ${NOCOLOR}"
echo -e "${YELLOW}[!] There are no deactivated OBFS4 bridges. ${NOCOLOR}"
echo -e "${RED}[+] You may use the menu entry \"Deactivate OBFS4...\". ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
Expand Down Expand Up @@ -119,7 +119,7 @@ case "$CHOICE" in
clear
online_check $BRIDGE_DB_URL 0 1
if [ $OCHECK == 1 ]; then
echo -e "${WHITE}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo -e "${YELLOW}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo " "
echo -e "${RED}[+] Checking for bridges to activate - please wait...${NOCOLOR}"
trap break SIGINT
Expand Down Expand Up @@ -158,7 +158,7 @@ case "$CHOICE" in
exit 0
else
echo ""
echo -e "${WHITE}[!] There are no usable OBFS4 bridges :( ${NOCOLOR}"
echo -e "${YELLOW}[!] There are no usable OBFS4 bridges :( ${NOCOLOR}"
echo -e "${RED}[+] Please add some new OBFS4 bridges first! ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
Expand All @@ -167,8 +167,8 @@ case "$CHOICE" in
fi
else
echo ""
echo -e "${WHITE}[!] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${WHITE}[!] Can't fetch the status of the bridges - ABORTING :( ${NOCOLOR}"
echo -e "${YELLOW}[!] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${YELLOW}[!] Can't fetch the status of the bridges - ABORTING :( ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand All @@ -182,23 +182,23 @@ case "$CHOICE" in
clear
if [ $OCHECK == 1 ]; then
if (whiptail --title "TorBox - BRIDGE ACTIVATION" --yesno "Do you want to see the ONLINE/OFFLINE status of the bridges?" $MENU_HEIGHT_10 $MENU_WIDTH_REDUX); then
echo -e "${WHITE}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo -e "${YELLOW}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo " "
sleep 2
STATUS=1
else
STATUS=0
fi
else
echo -e "${WHITE}[!] SORRY! - no connection with the bridge database${NOCOLOR}"
echo -e "${YELLOW}[!] SORRY! - no connection with the bridge database${NOCOLOR}"
echo -e "${RED}[!] We'll go ahead anyway.${NOCOLOR}"
echo " "
sleep 3
fi
number_of_obfs4_bridges
if [ "$number_configured_bridges_deactivated" == "0" ]; then
echo ""
echo -e "${WHITE}[!] There is no deactivated bridge, which can be activated!${NOCOLOR}"
echo -e "${YELLOW}[!] There is no deactivated bridge, which can be activated!${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand Down
8 changes: 4 additions & 4 deletions bin/bridges_activate_snowflake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MENU_HEIGHT_10=10

#Colors
RED='\033[1;31m'
WHITE='\033[1;37m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

#Other variables
Expand Down Expand Up @@ -78,7 +78,7 @@ fi

if [ "$number_configured_snowflake_bridges_deactivated" == "0" ]; then
echo ""
echo -e "${WHITE}[!] There is no deactivated bridge, which can be activated!${NOCOLOR}"
echo -e "${YELLOW}[!] There is no deactivated bridge, which can be activated!${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand All @@ -94,15 +94,15 @@ OCHECK=0
# IMORTANT: the support to show the ONLINE/OFFLINE status of Snowflake bridges is currently disabled because it is not reliable.
#if [ $OCHECK == 1 ]; then
# if (whiptail --title "TorBox - BRIDGE ACTIVATION" --yesno "Do you want to see the ONLINE/OFFLINE status of the bridges?" $MENU_HEIGHT_10 $MENU_WIDTH_REDUX); then
# echo -e "${WHITE}[+] OK - we are connected with the bridge database${NOCOLOR}"
# echo -e "${YELLOW}[+] OK - we are connected with the bridge database${NOCOLOR}"
# echo " "
# sleep 2
# STATUS=1
# else
STATUS=0
# fi
#else
# echo -e "${WHITE}[!] SORRY! - no connection with the bridge database${NOCOLOR}"
# echo -e "${YELLOW}[!] SORRY! - no connection with the bridge database${NOCOLOR}"
# echo -e "${RED}[!] We'll go ahead anyway.${NOCOLOR}"
# echo " "
# sleep 3
Expand Down
14 changes: 7 additions & 7 deletions bin/bridges_add_obfs4
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MENU_LIST_HEIGHT=$((NO_ITEMS+NO_SPACER))

#Colors
RED='\033[1;31m'
WHITE='\033[1;37m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

#Other variables
Expand Down Expand Up @@ -137,7 +137,7 @@ case "$CHOICE" in
fi
if [ "$bridge_address" = "-1" ]; then
echo " "
echo -e "${WHITE}[!] NETWORK ERROR!${NOCOLOR}"
echo -e "${YELLOW}[!] NETWORK ERROR!${NOCOLOR}"
echo -e "${RED}[+] Sorry, I couldn't fetch a bridge! Please, try again later or add bridges manually!${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
Expand All @@ -162,7 +162,7 @@ case "$CHOICE" in
n=0
for (( i=0; i<number_bridges; i++ ))
do
[ "$i" == "0" ] && echo -e "${WHITE}[!] Success! We fetched $number_bridges bridge(s)${NOCOLOR}"
[ "$i" == "0" ] && echo -e "${YELLOW}[!] Success! We fetched $number_bridges bridge(s)${NOCOLOR}"
n=$((n+1))
if grep -q "${bridge_address[$i]}" $TORRC ; then
echo -e "${RED}[+] Sorry, bridge number $n is already added!${NOCOLOR}"
Expand Down Expand Up @@ -190,8 +190,8 @@ case "$CHOICE" in
fi
else
echo ""
echo -e "${WHITE}[!] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${WHITE}[!] Can't fetch a bridge - ABORTING :( ${NOCOLOR}"
echo -e "${YELLOW}[!] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${YELLOW}[!] Can't fetch a bridge - ABORTING :( ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand All @@ -209,7 +209,7 @@ case "$CHOICE" in
# exitstatus == 1 means that $number_bridges is not an integer
if [ "$exitstatus" == "1" ]; then
clear
echo -e "${WHITE}[!] WRONG INPUT - THIS IS NOT AN INTEGER!${NOCOLOR}"
echo -e "${YELLOW}[!] WRONG INPUT - THIS IS NOT AN INTEGER!${NOCOLOR}"
echo -e "${RED}[+] I asked you for a number and you gave me... what??? ${NOCOLOR}"
sleep 5
clear
Expand All @@ -226,7 +226,7 @@ case "$CHOICE" in
exit 0
fi
if grep -q "$bridge_address" $TORRC ; then
echo -e "${WHITE}[!] Bridge number $i is already added!${NOCOLOR}"
echo -e "${YELLOW}[!] Bridge number $i is already added!${NOCOLOR}"
sleep 3
i=$((i+1))
else
Expand Down
14 changes: 7 additions & 7 deletions bin/bridges_add_snowflake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MENU_LIST_HEIGHT=$((NO_ITEMS+NO_SPACER))

#Colors
RED='\033[1;31m'
WHITE='\033[1;37m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

#Other variables
Expand Down Expand Up @@ -125,7 +125,7 @@ case "$CHOICE" in
fi
if [ "$bridge_address" = "-1" ]; then
echo " "
echo -e "${WHITE}[!] NETWORK ERROR!${NOCOLOR}"
echo -e "${YELLOW}[!] NETWORK ERROR!${NOCOLOR}"
echo -e "${RED}[+] Sorry, I couldn't fetch a bridge! Please, try again later or add bridges manually!${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
Expand Down Expand Up @@ -157,7 +157,7 @@ case "$CHOICE" in
n=0
for (( i=0; i<number_bridges; i++ ))
do
[ "$i" == "0" ] && echo -e "${WHITE}[!] Success! We fetched $number_bridges bridge(s)${NOCOLOR}"
[ "$i" == "0" ] && echo -e "${YELLOW}[!] Success! We fetched $number_bridges bridge(s)${NOCOLOR}"
n=$((n+1))
if grep -q "${bridge_address[$i]}" $TORRC ; then
echo -e "${RED}[+] Sorry, bridge number $n is already added!${NOCOLOR}"
Expand Down Expand Up @@ -199,8 +199,8 @@ case "$CHOICE" in
fi
else
echo ""
echo -e "${WHITE}[!] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${WHITE}[!] Can't fetch a bridge - ABORTING :( ${NOCOLOR}"
echo -e "${YELLOW}[!] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${YELLOW}[!] Can't fetch a bridge - ABORTING :( ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand All @@ -218,7 +218,7 @@ case "$CHOICE" in
# exitstatus == 1 means that $number_bridges is not an integer
if [ "$exitstatus" == "1" ]; then
clear
echo -e "${WHITE}[!] WRONG INPUT - THIS IS NOT AN INTEGER!${NOCOLOR}"
echo -e "${YELLOW}[!] WRONG INPUT - THIS IS NOT AN INTEGER!${NOCOLOR}"
echo -e "${RED}[+] I asked you for a number and you gave me... what??? ${NOCOLOR}"
sleep 5
clear
Expand All @@ -235,7 +235,7 @@ case "$CHOICE" in
exit 0
fi
if grep -q "$bridge_address" $TORRC ; then
echo -e "${WHITE}[!] Bridge number $i is already added!${NOCOLOR}"
echo -e "${YELLOW}[!] Bridge number $i is already added!${NOCOLOR}"
sleep 3
i=$((i+1))
else
Expand Down
18 changes: 9 additions & 9 deletions bin/bridges_deactivate_obfs4
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ MENU_LIST_HEIGHT=$((NO_ITEMS+NO_SPACER))

#Colors
RED='\033[1;31m'
WHITE='\033[1;37m'
YELLOW='\033[1;93m'
NOCOLOR='\033[0m'

#Other variables
Expand Down Expand Up @@ -85,7 +85,7 @@ fi

if [ $number_configured_bridges_activated = 0 ]; then
clear
echo -e "${WHITE}[!] There are no activated OBFS4 bridges. ${NOCOLOR}"
echo -e "${YELLOW}[!] There are no activated OBFS4 bridges. ${NOCOLOR}"
echo -e "${RED}[+] You may use the menu entry \"Activate configured OBFS4 bridges...\". ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
Expand Down Expand Up @@ -118,7 +118,7 @@ case "$CHOICE" in
clear
online_check $BRIDGE_DB_URL 0 1
if [ $OCHECK == 1 ]; then
echo -e "${WHITE}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo -e "${YELLOW}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo " "
echo -e "${RED}[+] Checking for bridges to deactivate - please wait...${NOCOLOR}"
trap break SIGINT
Expand Down Expand Up @@ -149,7 +149,7 @@ case "$CHOICE" in
trap "bash bridges_deactivate_obfs4; exit 0" SIGINT
if [ $j = 0 ]; then
echo " "
echo -e "${WHITE}[!] All checked OBFS4 do exist and are online -> nothing to deactivate!${NOCOLOR}"
echo -e "${YELLOW}[!] All checked OBFS4 do exist and are online -> nothing to deactivate!${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand All @@ -172,8 +172,8 @@ case "$CHOICE" in
fi
fi
else
echo -e "${WHITE}[+] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${WHITE}[+] Can't fetch the status of the bridges - ABORTING :( ${NOCOLOR}"
echo -e "${YELLOW}[+] OH NO! - no connection to the bridge database :( ${NOCOLOR}"
echo -e "${YELLOW}[+] Can't fetch the status of the bridges - ABORTING :( ${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand All @@ -188,23 +188,23 @@ case "$CHOICE" in
clear
if [ $OCHECK == 1 ]; then
if (whiptail --title "TorBox - BRIDGE DEACTIVATION" --yesno "Do you want to see the ONLINE/OFFLINE status of the bridges?" $MENU_HEIGHT_10 $MENU_WIDTH_REDUX); then
echo -e "${WHITE}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo -e "${YELLOW}[+] OK - we are connected with the bridge database${NOCOLOR}"
echo " "
sleep 2
STATUS=1
else
STATUS=0
fi
else
echo -e "${WHITE}[!] SORRY! - no connection with the bridge database${NOCOLOR}"
echo -e "${YELLOW}[!] SORRY! - no connection with the bridge database${NOCOLOR}"
echo -e "${RED}[!] We'll go ahead anyway.${NOCOLOR}"
echo " "
sleep 3
fi
number_of_obfs4_bridges
if [ "$number_configured_bridges_activated" == "0" ]; then
echo ""
echo -e "${WHITE}[!] There is no activated bridge, which can be deactivated!${NOCOLOR}"
echo -e "${YELLOW}[!] There is no activated bridge, which can be deactivated!${NOCOLOR}"
echo " "
read -n 1 -s -r -p "Press any key to continue"
clear
Expand Down
Loading

0 comments on commit 4219175

Please sign in to comment.