#!/bin/bash
# shellcheck disable=SC2034,SC2062

# This file is part of TorBox, an easy to use anonymizing router based on Raspberry Pi.
# Copyright (C) 2026 radio_24
# Contact: anonym@torbox.ch
# Website: https://www.torbox.ch
# Github:  https://github.com/radio24/TorBox
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it is useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# DESCRIPTION
# This file displays the configuration menu and executes all relevant scripts.
#
# SYNTAX
# ./menu-config
#
#
###### SET VARIABLES ######
#
# SIZE OF THE MENU
#
# How many items do you have in the main menu?
NO_ITEMS=14
#
# How many lines are only for decoration and spaces?
NO_SPACER=4
#
#Set the the variables for the menu
MENU_WIDTH=80
MENU_WIDTH_REDUX=60
MENU_HEIGHT_10=10
MENU_HEIGHT_15=15
MENU_HEIGHT_20=20
MENU_HEIGHT_25=25
# MENU_HEIGHT should not exceed 26
MENU_HEIGHT=$((8+NO_ITEMS+NO_SPACER))
MENU_LIST_HEIGHT=$((NO_ITEMS+NO_SPACER))

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

# The minimum bandwidth a relay should have, in kilobytes. Relays with less
# than this amount of bandwidth will be added to the ExcludeNodes line and
# therefore not used by your Tor client. (default: 4000 KB/s)
DEFAULT_SPEED=4000

#Identifying the hardware (see also https://gist.github.com/jperkin/c37a574379ef71e339361954be96be12)
CHECK_HD1=""
if [ -f /proc/device-tree/model ]; then
	if grep -q --text 'Raspberry Pi 3 Model B Rev' /proc/device-tree/model ; then CHECK_HD1="Raspberry Pi 3 Model B Rev" ; fi
	clear
fi
if [ -f /proc/cpuinfo ]; then
	if grep -q "Raspberry Pi 3 Model B Rev" /proc/cpuinfo ; then CHECK_HD2="Raspberry Pi 3 Model B Rev" ; fi
	clear
fi

#Identifying the hardware (see also https://gist.github.com/jperkin/c37a574379ef71e339361954be96be12)
if grep -q --text 'Raspberry' /proc/device-tree/model ; then CHECK_HD3="Raspberry Pi" ; fi
clear
if grep -q "Raspberry" /proc/cpuinfo ; then CHECK_HD3="Raspberry Pi" ; fi
clear

# Identify the Operating System
CHECK_OS="$(lsb_release -si)"
CHECK_OS="$(echo "$CHECK_OS" | tail -n1)"
if [ "$CHECK_OS" == "Debian" ] && [ -f /etc/rpi-issue ] ; then CHECK_OS="Raspbian" ; fi

#Other variables
IPTABLES="/sbin/iptables"
CRDAFILE="/etc/default/crda"
HOSTAPD="/etc/hostapd/hostapd.conf"
HOSTAPD_SAV="/etc/hostapd/hostapd.conf.tbx"
TORRC="/etc/tor/torrc"
BAK="/etc/tor/torrc.bak"
SSHD_CONFIG="/etc/ssh/sshd_config"
RUNFILE="/home/torbox/torbox/run/torbox.run"
TOR_INCLUDE_EX_SLOW="%include /etc/tor/torrc.exclude-slow"
# This is necessary to work with special characters in sed
# shellcheck disable=SC2001,SC2016
TOR_INCLUDE_EX_SLOW="$(<<< "$TOR_INCLUDE_EX_SLOW" sed -e 's`[][\\/.*^$]`\\&`g')"

# Read configuration from run/torbox.run
ON_A_CLOUD=$(grep "^ON_A_CLOUD=.*" ${RUNFILE} | sed "s/.*=//g")
TORBOX_MINI=$(grep "^TORBOX_MINI=.*" ${RUNFILE} | sed "s/.*=//g")
TORBOX_MINI_DEFAULT=$(grep "^TORBOX_MINI_DEFAULT=.*" ${RUNFILE} | sed "s/.*=//g")

##############################
######## FUNCTIONS ########

# include lib
.  /home/torbox/torbox/lib/torbox.lib

# This function changes the WLAN regulatory domain.
change_crda()
{
  # The list below was created by following command: cat /usr/share/zoneinfo/iso3166.tab | tail -n +26 | tr '\t' '!' | sed 's/!/\" \"/' | sed 's/^/\"/' | sed 's/$/\"/' | tr '\n' ' '
  COUNTRY=$(whiptail --menu "Please, select the country in which the Pi is to be used" $MENU_HEIGHT_25 $MENU_WIDTH 17 "00" "Global" "AD" "Andorra" "AE" "United Arab Emirates" "AF" "Afghanistan" "AG" "Antigua & Barbuda" "AI" "Anguilla" "AL" "Albania" "AM" "Armenia" "AO" "Angola" "AQ" "Antarctica" "AR" "Argentina" "AS" "Samoa (American)" "AT" "Austria" "AU" "Australia" "AW" "Aruba" "AX" "Åland Islands" "AZ" "Azerbaijan" "BA" "Bosnia & Herzegovina" "BB" "Barbados" "BD" "Bangladesh" "BE" "Belgium" "BF" "Burkina Faso" "BG" "Bulgaria" "BH" "Bahrain" "BI" "Burundi" "BJ" "Benin" "BL" "St Barthelemy" "BM" "Bermuda" "BN" "Brunei" "BO" "Bolivia" "BQ" "Caribbean NL" "BR" "Brazil" "BS" "Bahamas" "BT" "Bhutan" "BV" "Bouvet Island" "BW" "Botswana" "BY" "Belarus" "BZ" "Belize" "CA" "Canada" "CC" "Cocos (Keeling) Islands" "CD" "Congo (Dem. Rep.)" "CF" "Central African Rep." "CG" "Congo (Rep.)" "CH" "Switzerland" "CI" "Côte d'Ivoire" "CK" "Cook Islands" "CL" "Chile" "CM" "Cameroon" "CN" "China" "CO" "Colombia" "CR" "Costa Rica" "CU" "Cuba" "CV" "Cape Verde" "CW" "Curaçao" "CX" "Christmas Island" "CY" "Cyprus" "CZ" "Czech Republic" "DE" "Germany" "DJ" "Djibouti" "DK" "Denmark" "DM" "Dominica" "DO" "Dominican Republic" "DZ" "Algeria" "EC" "Ecuador" "EE" "Estonia" "EG" "Egypt" "EH" "Western Sahara" "ER" "Eritrea" "ES" "Spain" "ET" "Ethiopia" "FI" "Finland" "FJ" "Fiji" "FK" "Falkland Islands" "FM" "Micronesia" "FO" "Faroe Islands" "FR" "France" "GA" "Gabon" "GB" "Britain (UK)" "GD" "Grenada" "GE" "Georgia" "GF" "French Guiana" "GG" "Guernsey" "GH" "Ghana" "GI" "Gibraltar" "GL" "Greenland" "GM" "Gambia" "GN" "Guinea" "GP" "Guadeloupe" "GQ" "Equatorial Guinea" "GR" "Greece" "GS" "South Georgia & the South Sandwich Islands" "GT" "Guatemala" "GU" "Guam" "GW" "Guinea-Bissau" "GY" "Guyana" "HK" "Hong Kong" "HM" "Heard Island & McDonald Islands" "HN" "Honduras" "HR" "Croatia" "HT" "Haiti" "HU" "Hungary" "ID" "Indonesia" "IE" "Ireland" "IL" "Israel" "IM" "Isle of Man" "IN" "India" "IO" "British Indian Ocean Territory" "IQ" "Iraq" "IR" "Iran" "IS" "Iceland" "IT" "Italy" "JE" "Jersey" "JM" "Jamaica" "JO" "Jordan" "JP" "Japan" "KE" "Kenya" "KG" "Kyrgyzstan" "KH" "Cambodia" "KI" "Kiribati" "KM" "Comoros" "KN" "St Kitts & Nevis" "KP" "Korea (North)" "KR" "Korea (South)" "KW" "Kuwait" "KY" "Cayman Islands" "KZ" "Kazakhstan" "LA" "Laos" "LB" "Lebanon" "LC" "St Lucia" "LI" "Liechtenstein" "LK" "Sri Lanka" "LR" "Liberia" "LS" "Lesotho" "LT" "Lithuania" "LU" "Luxembourg" "LV" "Latvia" "LY" "Libya" "MA" "Morocco" "MC" "Monaco" "MD" "Moldova" "ME" "Montenegro" "MF" "St Martin (French)" "MG" "Madagascar" "MH" "Marshall Islands" "MK" "North Macedonia" "ML" "Mali" "MM" "Myanmar (Burma)" "MN" "Mongolia" "MO" "Macau" "MP" "Northern Mariana Islands" "MQ" "Martinique" "MR" "Mauritania" "MS" "Montserrat" "MT" "Malta" "MU" "Mauritius" "MV" "Maldives" "MW" "Malawi" "MX" "Mexico" "MY" "Malaysia" "MZ" "Mozambique" "NA" "Namibia" "NC" "New Caledonia" "NE" "Niger" "NF" "Norfolk Island" "NG" "Nigeria" "NI" "Nicaragua" "NL" "Netherlands" "NO" "Norway" "NP" "Nepal" "NR" "Nauru" "NU" "Niue" "NZ" "New Zealand" "OM" "Oman" "PA" "Panama" "PE" "Peru" "PF" "French Polynesia" "PG" "Papua New Guinea" "PH" "Philippines" "PK" "Pakistan" "PL" "Poland" "PM" "St Pierre & Miquelon" "PN" "Pitcairn" "PR" "Puerto Rico" "PS" "Palestine" "PT" "Portugal" "PW" "Palau" "PY" "Paraguay" "QA" "Qatar" "RE" "Réunion" "RO" "Romania" "RS" "Serbia" "RU" "Russia" "RW" "Rwanda" "SA" "Saudi Arabia" "SB" "Solomon Islands" "SC" "Seychelles" "SD" "Sudan" "SE" "Sweden" "SG" "Singapore" "SH" "St Helena" "SI" "Slovenia" "SJ" "Svalbard & Jan Mayen" "SK" "Slovakia" "SL" "Sierra Leone" "SM" "San Marino" "SN" "Senegal" "SO" "Somalia" "SR" "Suriname" "SS" "South Sudan" "ST" "Sao Tome & Principe" "SV" "El Salvador" "SX" "St Maarten (Dutch)" "SY" "Syria" "SZ" "Eswatini (Swaziland)" "TC" "Turks & Caicos Is" "TD" "Chad" "TF" "French Southern & Antarctic Lands" "TG" "Togo" "TH" "Thailand" "TJ" "Tajikistan" "TK" "Tokelau" "TL" "East Timor" "TM" "Turkmenistan" "TN" "Tunisia" "TO" "Tonga" "TR" "Turkey" "TT" "Trinidad & Tobago" "TV" "Tuvalu" "TW" "Taiwan" "TZ" "Tanzania" "UA" "Ukraine" "UG" "Uganda" "UM" "US minor outlying islands" "US" "United States" "UY" "Uruguay" "UZ" "Uzbekistan" "VA" "Vatican City" "VC" "St Vincent" "VE" "Venezuela" "VG" "Virgin Islands (UK)" "VI" "Virgin Islands (US)" "VN" "Vietnam" "VU" "Vanuatu" "WF" "Wallis & Futuna" "WS" "Samoa (western)" "YE" "Yemen" "YT" "Mayotte" "ZA" "South Africa" "ZM" "Zambia" "ZW" "Zimbabwe" 3>&1 1>&2 2>&3)
  exitstatus=$?

  if [ $exitstatus = 0 ]; then
    sudo iw reg set $COUNTRY
		sudo sed -i "s/^sudo iw reg set*./sudo iw reg set $COUNTRY/g" bin/regset
    INPUT="REGDOMAIN=$COUNTRY"
    sudo sed -i "s/^REGDOMAIN=.*/${INPUT}/" ${CRDAFILE}
  fi

# Theoreticall the lines below should set the country_code value in /etc/hostapd/hostapd.conf . However, if country_code=US is changed to anything else, the 5 GHz 80 MHz setting will crash hostapd -> don't change country_code=US in /etc/hostapd/hostapd.conf until the bug is fixed.
#  if [ $COUNTRY = 00 ]; then
#    sudo sed -i "s/^country_code=.*/country_code=US/" ${HOSTAPD}
#  else
#    INPUT="country_code=$COUNTRY"
#    sudo sed -i "s/^country_code=.*/${INPUT}/" ${HOSTAPD}
#  fi
#  echo -e "${RED}[+] We have to restart the TorBox's WLAN!${NOCOLOR}"
#  echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to reboot TorBox.${NOCOLOR}"
#  (nohup bin/hostapd_fallback) 2>/dev/null
}

# This function imports the configuration and makes some preparations
read_config()
{
  # TOGGLE03 / TOGGLE04 represents the extent of logging
	LOG_STATUS_001=$(sudo systemctl is-active rsyslog)
	LOG_STATUS_002=$(sudo systemctl is-active systemd-journald.service)
  if [[ $LOG_STATUS_001 = inactive && $LOG_STATUS_002 = inactive ]]; then
      TOGGLE03="LOW✔︎]==="
      TOGGLE03b="LOW"
      TOGGLE04="HIGH]==="
      TOGGLE04b="HIGH"
  else
      TOGGLE03="HIGH]==="
      TOGGLE03b="HIGH"
      TOGGLE04="LOW✔︎]==="
      TOGGLE04b="LOW"
  fi

	# TOGGLE05 / TOGGLE06 / represents the 2.5 GHz and 5 GHz Band
  if grep -q "^hw_mode=g" ${HOSTAPD}; then
		clear
    TOGGLE05="2.5 GHz"
  else
		clear
    TOGGLE06="2.5 Ghz band"
  fi

	clear
  if grep -q "^hw_mode=a" ${HOSTAPD}; then
		clear
    TOGGLE05="5 GHz"
  else
		clear
    TOGGLE06="5 Ghz band"
  fi

  # TOGGLE07 represents the WLAN channel;
	clear
  TOGGLE07=$(grep "^channel=" ${HOSTAPD})
	clear
  TOGGLE07=$(echo "$TOGGLE07" | cut -c9-10 | sed 's/ //')

  # TOGGLE08 shows if the SSID is hidden or not
	clear
  if grep -q "ignore_broadcast_ssid=1" ${HOSTAPD}; then
		clear
    TOGGLE08="Unhide"
  else
		clear
    TOGGLE08="Hide"
  fi

  # TOGGLE09 shows if TorBox's WLAN is disabled or not
  AP_STATUS=$(sudo systemctl is-active hostapd)
  if [ $AP_STATUS = inactive ] || [ $AP_STATUS = failed ] ; then
    TOGGLE09="Enable"
  else
    TOGGLE09="Disable"
  fi

  # TOGGLE12 / TOGGLE13 shows if HTTP plain text traffic is blocked
  RULE_CHECK=0
  ($IPTABLES -t nat -C PREROUTING -p tcp --dport 80 -j DNAT --to-destination 0.0.0.0) 2>/dev/null
  RULE_CHECK=$?
  if [ $RULE_CHECK = 1 ]; then
    TOGGLE12="Enable"
    TOGGLE13="(not on SOCKS 5!)"
  else
    TOGGLE12="Disable"
    TOGGLE13=""
  fi

  # TOGGLE14 / TOGGLE15 shows if the Tor control port access is enabled/disabled for clients
	clear
  if grep -q "^TOR_CONTROL_PORT_ACCESS=0" ${RUNFILE} ; then
		clear
    TOGGLE14="Enable"
    TOGGLE15="(not recommended)"
  else
		clear
    TOGGLE14="Disable"
    TOGGLE15="(recommended!)"
  fi

	# TOGGLE18 shows if slow tor relays are excluded or not
	clear
	if grep -q "EX_SLOW=0" ${RUNFILE} ; then
		clear
		TOGGLE18="Start"
	else
		clear
		TOGGLE18="Stop"
	fi

	# TOGGLE10 shows if tor bandwidth limit is started or not
	clear
	if grep -q "^BandwidthRate" ${TORRC} ; then
		clear
		TOGGLE10="Stop"
	else
		clear
		TOGGLE10="Start"
	fi

	# TOGGLE22 shows if the OpenVPN server is configured
	clear
	if [[ -e /etc/openvpn/server.conf || -e /etc/openvpn/server/server.conf ]]; then
		TOGGLE22="Manage the OpenVPN server"
	else
		TOGGLE22="Install the OpenVPN server"
	fi

}

######## PREPARATIONS ########
read_config
clear

# Resetting
cd "$(dirname "$0")" || exit 1
shopt -s checkwinsize
[ -f nohup.out ] && (sudo rm nohup.out) 2>/dev/null
stty intr ^c
trap

###### DISPLAY THE MENU ######
clear

CHOICE=$(whiptail --cancel-button "Back" --title "TorBox v.0.5.5 - CONFIGURATION MENU" --menu "Choose an option (ESC -> back to the main menu)" $MENU_HEIGHT $MENU_WIDTH $MENU_LIST_HEIGHT \
"==" "================================================[Passwords]===" \
" 1" "Change admin (user torbox) password"  \
" 2" "Generate SSH key for TorBox login"  \
" 3" "Change the password of TorBox's WLAN (reboot required)"  \
" 4" "Change the password of your tor control port (restarts tor!)"  \
"==" "==================================================[Network]===" \
" 5" "Change the name of TorBox's WLAN (reboot required)"  \
" 6" "Set TorBox's WLAN regulatory domain for the 5 GHz band" \
" 7" "Change TorBox's WLAN from the $TOGGLE05 to the $TOGGLE06" \
" 8" "Change TorBox's WLAN channel and the MHz (currently: $TOGGLE07)"  \
" 9" "Change/randomize/list the MAC adresses of TorBox's interfaces" \
"10" "$TOGGLE08 TorBox's WLAN"  \
"11" "$TOGGLE09 TorBox's WLAN"  \
"12" "$TOGGLE12 HTTP plain text traffic block $TOGGLE13" \
"==" "======================================================[Tor]===" \
"13" "$TOGGLE18 excluding slow tor relays"  \
"14" "$TOGGLE10 Tor network bandwidth limitation" \
"15" "$TOGGLE14 Tor control port access for clients $TOGGLE15" \
"16" "Enter the advanced tor configuration editor"  \
"==" "=============================================[Logging "$TOGGLE03 \
"17" "Changing the extent of logging ($TOGGLE03b -> $TOGGLE04b)" \
"18" "Erase all log files" \
"==" "=============================================[Add Features]===" \
"19" "$TOGGLE22" \
"20" "Support for Adafruit's PiTFT displays (reboot required)" \
"21" "Support for 3.5\" no-name TFT displays (reboot required)" \
"22" "Support for Sixfab Shields/HATs for cellular connections" \
3>&1 1>&2 2>&3)
exitstatus=$?
# exitstatus == 255 means that the ESC key was pressed
[ "$exitstatus" == "255" ] && exit 0

CHOICE=$(echo "$CHOICE" | tr -d ' ')
case "$CHOICE" in

  #This changes the admin password
	1)
		INPUT=$(cat text/changepasswd-text)
		if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH); then
  		passwd
			echo " "
			read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m'
		fi
		clear
  ;;

	#This generates SSH keys
	2)
		INPUT=$(cat text/generate_ssh_keys-text)
		if (whiptail --title "TorBox - INFO (scroll down!)" --scrolltext --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
			cd
		 	(rm id_rsa*) &>/dev/null
			clear
			ssh-keygen -f id_rsa
			if [ -f .ssh/authorized_keys ]; then
				if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "KEEP" --yes-button "Replace" "OLD PUBLIC KEY FOUND\n\nShould we keep (default) or replace the old key?" $MENU_HEIGHT_10 $MENU_WIDTH_REDUX); then
					(rm .ssh/authorized_keys) &>/dev/null
				fi
			fi
			if [ ! -d ".ssh" ]; then
				mkdir .ssh
				chmod 700 .ssh
			fi
			cat id_rsa.pub >> .ssh/authorized_keys
			chmod 600 .ssh/authorized_keys
			cd torbox
			echo ""
			echo -e "${RED}[+] SSH KEYS SUCCESFULY GENERATED!${NOCOLOR}"
			echo -e "${RED}[+] Don't forget...${NOCOLOR}"
			echo "    The private key (id_rsa) must be downloaded on your client using"
			echo "    SFTP (it uses the same login and password as your SSH client)."
			echo "    To log into TorBox, you must use an SSH client that supports"
			echo "    SSH key handling (for example, Termius) or TorBox's webssh."
			echo "    The key should be kept secure so that no other users on your "
			echo "    computer can read the file."
			echo " "
			read -n 1 -s -r -p $'\e[1;31mPlease press any key to continue... \e[0m'
			clear
		fi
  ;;

  #This changes the password of the WLAN
  3)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		INPUT=$(whiptail --title "Changing the configuration of the WLAN" --inputbox "\n\nOnly letters (upper and lower case) and numbers are allowed. The length must be between 8 and 63 characters.\n\nEnter your new password:" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3)
    if [ ! -z "$INPUT" ]; then
      if [[ $INPUT != *[0123456789ABCDEFGHIJKLMNOPQRSTUVWXZYabcdefghijklmnopqrstuvwxzy-]* ]]; then
        clear
        echo " "
        echo -e "${YELLOW}[!] Only letters (upper and lower case) and numbers are allowed.${NOCOLOR}"
        echo -e "${YELLOW}[!] We didn't change anything - try again!${NOCOLOR}"
        sleep 5
			elif ${#INPUT} -lt 8 || ${#INPUT} -gt 63 ; then
				clear
				echo " "
				echo -e "${YELLOW}[!] The password has to be between 8 and 63 charcters.${NOCOLOR}"
				echo -e "${YELLOW}[!] We didn't change anything - try again!${NOCOLOR}"
				sleep 5
      else
        clear
        echo -e "${RED}[+] Changing password...${NOCOLOR}"
        SSID_PW=wpa_passphrase=$INPUT
        sudo sed -i "s/^wpa_passphrase=.*/${SSID_PW}/" ${HOSTAPD}
        sleep 2
        if (whiptail --yesno "The password of your WLAN is now changed to\n\n$INPUT.\n\nWould you like to reboot TorBox now to put the changes immediately into effect (this will reboot TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
          clear
          echo " "
          echo -e "${RED}[+] Activating the new password of TorBox's WLAN! Rebooting TorBox, now...${NOCOLOR}"
          echo -e "${YELLOW}[!] If you have activated Bridges or Bridge Relay, these services will be reactivated automatically after the restart.${NOCOLOR}"
					sync
					sleep 2
          sudo reboot
          exit 0
        fi
      fi
    fi
  ;;

  #This changes the password of the Tor control port
  4)
    INPUT=$(whiptail --title "Changing Tor's configuration" --inputbox "\n\nEnter you new password:" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3)
    if [ ! -z "$INPUT" ]; then
      INPUTHASH=HashedControlPassword\ $(tor --hash-password ${INPUT})
      INPUT=PASSWORD=\"${INPUT}\"
      if grep -q "^HashedControlPassword\ " ${TORRC}; then
				clear
        sudo sed -i "s/^HashedControlPassword\ .*/${INPUTHASH}/" ${TORRC}
      else
				clear
        (printf %s"${INPUTHASH}\n" | sudo tee -a $TORRC) 2>/dev/null
      fi
      restarting_tor menu-config
    fi
  ;;

  #This changes the name of the WLAN
  5)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		INPUT=$(whiptail --title "Changing the configuration of the WLAN" --inputbox "\n\nEnter the new name for TorBox's WLAN:" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3)
		if [ ! -z "$INPUT" ]; then
			clear
			sudo cp ${HOSTAPD} ${HOSTAPD_SAV}
			echo -e "${RED}[+] Changing SSID...${NOCOLOR}"
			SSID="ssid=$INPUT"
			sudo sed -i "s/^ssid=.*/${SSID}/" ${HOSTAPD}
			sleep 2
			if (whiptail --yesno "The name of TorBox's WLAN is now changed to\n\n$INPUT.\n\nWould you like to reboot TorBox now to put the changes immediately into effect (this will reboot TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				clear
				echo " "
				echo -e "${RED}[+] Activating the name of TorBox's WLAN! Rebooting TorBox, now...${NOCOLOR}"
        echo -e "${YELLOW}[!] If you have activated Bridges or Bridge Relay, these services will be reactivated automatically after the restart.${NOCOLOR}"
				sync
				sleep 2
				sudo reboot
				exit 0
			fi
		fi
  ;;

  #This sets the WLAN regulatory domain.
  6)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		REGDOMAIN=$(grep "^REGDOMAIN=" ${CRDAFILE})
		clear
		TLC=$(echo "$REGDOMAIN"|cut -c11-12)
		if [ "$TLC" != "00" ] && [ ! -z "$TLC" ]; then
			COUNTRY=$(grep ^$TLC /usr/share/zoneinfo/iso3166.tab | tr '\t' '!' | sed "s/^${TLC}!//")
			clear
			INPUT=$(cat text/wrd-text)
			if (whiptail --yesno "The WLAN regulatory domain is set to $COUNTRY.\n\n$INPUT" 16 $MENU_WIDTH); then change_crda; fi
		elif [ -z "$TLC" ]; then
			INPUT=$(cat text/wrd-text)
			if (whiptail --yesno "The WLAN regulatory domain is not set yet.\n\n$INPUT" 16 $MENU_WIDTH); then change_crda; fi
		elif [ "$TLC" != "00" ]; then
			INPUT=$(cat text/wrd-text)
			if (whiptail --yesno "The WLAN regulatory domain is set to GLOBAL.\n\n$INPUT" 16 $MENU_WIDTH); then change_crda; fi
		fi
  ;;

  #This changes the frequency band
  7)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		if [ "$TOGGLE05" = "2.5 GHz" ]; then
			if [ ! -z "$CHECK_HD1" ] || [ ! -z "$CHECK_HD2" ]; then
				clear
				echo " "
				echo -e "${YELLOW}[!] ATTENTION! The Raspberry Pi 3 Model B does NOT support the 5 GHz band!${NOCOLOR}"
				echo -e "${YELLOW}[!] We stay on the 2.5 GHz band!${NOCOLOR}"
				echo " "
				read -n 1 -s -r -p "Press any key to continue"
				echo " "
			else
				REGDOMAIN=$(grep "^REGDOMAIN=" ${CRDAFILE})
				clear
				TLC=$(echo "$REGDOMAIN"|cut -c11-12)
				if [ "$TLC" = "00" ]; then
					clear
					cho " "
					echo -e "${YELLOW}[!] To enable the 5 GHz band, you have to set the WLAN regulatory domain first (don't choose \"00 Global\"!).${NOCOLOR}"
					echo " "
					read -n 1 -s -r -p "Press any key to continue"
					echo " "
					change_crda
				fi
				INPUT=$(cat text/5ghz-text)
				if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
					sudo cp ${HOSTAPD} ${HOSTAPD_SAV}
					sudo sed -i "s/^hw_mode=g/hw_mode=a/" ${HOSTAPD}
					sudo sed -i "s/^channel.*/channel=36/" ${HOSTAPD}
					sudo sed -i "s/^#ht_capab=\[HT40-\]\[HT40+\]\[SHORT-GI-20\]\[SHORT-GI-40\]\[DSSS_CCK-40\]/ht_capab=\[HT40-\]\[HT40+\]\[SHORT-GI-20\]\[SHORT-GI-40\]\[DSSS_CCK-40\]/" ${HOSTAPD}
					if (whiptail --yesno "The frequency of TorBox's WLAN is now changed to 5 GHz.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
						clear
						echo " "
						echo -e "${RED}[+] Activating the 5 GHz band of TorBox's WLAN, now...${NOCOLOR}"
						echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
						(nohup bin/hostapd_fallback) 2>/dev/null
						(sudo rm nohup.out) &>/dev/null
					fi
				fi
			fi
		else
			sudo sed -i "s/^hw_mode=a/hw_mode=g/" ${HOSTAPD}
			sudo sed -i "s/^channel.*/channel=6/" ${HOSTAPD}
			sudo sed -i "s/^vht_oper_chwidth=1/#vht_oper_chwidth=1/" ${HOSTAPD}
			sudo sed -i "s/^vht_oper_centr_freq_seg0_idx=42/#vht_oper_centr_freq_seg0_idx=42/" ${HOSTAPD}
			if (whiptail --yesno "The frequency of TorBox's WLAN is now changed to 2.5 GHz.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				clear
				echo " "
				echo -e "${RED}[+] Activating the 2.5 GHz band of TorBox's WLAN, now...${NOCOLOR}"
				echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
				sudo systemctl restart hostapd
			fi
		fi
		read_config
  ;;

  #Change the WLAN channel
  8)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
    if [ "$TOGGLE05" = "2.5 GHz" ]; then
      if [ ! -z "$CHECK_HD1" ] || [ ! -z "$CHECK_HD2" ]; then
        CHOICE=$(whiptail --nocancel --title "Changing the configuration of the WLAN" --radiolist "\nATTENTION! The Raspberry Pi 3 Model B does NOT support 40 Mhz (we removed the affected entries)!\n\nChoose a channel (default is 6)" 18 60 8 \
        "A" "Channel  1 at 20 MHz" OFF \
        "C" "Channel  2 at 20 MHz" OFF \
        "E" "Channel  3 at 20 MHz" OFF \
        "G" "Channel  4 at 20 MHz" OFF \
        "I" "Channel  5 at 20 MHz" OFF \
        "K" "Channel  6 at 20 MHz  (default)          " ON \
        "M" "Channel  7 at 20 MHz" OFF \
        "O" "Channel  8 at 20 MHz" OFF \
        "Q" "Channel  9 at 20 MHz" OFF \
        "S" "Channel 10 at 20 MHz" OFF \
        "U" "Channel 11 at 20 MHz" OFF \
        3>&1 1>&2 2>&3)
        exitstatus=$?
      else
        CHOICE=$(whiptail --nocancel --title "Changing the configuration of the WLAN" --radiolist "\nChoose a channel (default is 6)" 18 60 8 \
        "A" "Channel  1 at 20 MHz" OFF \
        "B" "Channel  1 at 40 MHz" OFF \
        "C" "Channel  2 at 20 MHz" OFF \
        "D" "Channel  2 at 40 MHz" OFF \
        "E" "Channel  3 at 20 MHz" OFF \
        "F" "Channel  3 at 40 MHz" OFF \
        "G" "Channel  4 at 20 MHz" OFF \
        "H" "Channel  4 at 40 MHz" OFF \
        "I" "Channel  5 at 20 MHz" OFF \
        "J" "Channel  5 at 40 MHz" OFF \
        "K" "Channel  6 at 20 MHz  (default)          " ON \
        "L" "Channel  6 at 40 MHz" OFF \
        "M" "Channel  7 at 20 MHz" OFF \
        "N" "Channel  7 at 40 MHz" OFF \
        "O" "Channel  8 at 20 MHz" OFF \
        "P" "Channel  8 at 40 MHz" OFF \
        "Q" "Channel  9 at 20 MHz" OFF \
        "R" "Channel  9 at 40 MHz" OFF \
        "S" "Channel 10 at 20 MHz" OFF \
        "T" "Channel 10 at 40 MHz" OFF \
        "U" "Channel 11 at 20 MHz" OFF \
        "V" "Channel 11 at 40 MHz" OFF  \
        3>&1 1>&2 2>&3)
        exitstatus=$?
      fi
      if [ $exitstatus = 0 ]; then
        case $CHOICE in
          A)
              CHANNEL=1
              HF=0
              ;;
          B)
              CHANNEL=1
              HF=1
              ;;
          C)
              CHANNEL=2
              HF=0
              ;;
          D)
              CHANNEL=2
              HF=1
              ;;
          E)
              CHANNEL=3
              HF=0
              ;;
          F)
              CHANNEL=3
              HF=1
              ;;
          G)
              CHANNEL=4
              HF=0
              ;;
          H)
              CHANNEL=4
              HF=1
              ;;
          I)
              CHANNEL=5
              HF=0
              ;;
          J)
              CHANNEL=5
              HF=1
              ;;
          K)
              CHANNEL=6
              HF=0
              ;;
          L)
              CHANNEL=6
              HF=1
              ;;
          M)
              CHANNEL=7
              HF=0
              ;;
          N)
              CHANNEL=7
              HF=1
              ;;
          O)
              CHANNEL=8
              HF=0
              ;;
          P)
              CHANNEL=8
              HF=1
              ;;
          Q)
              CHANNEL=9
              HF=0
              ;;
          R)
              CHANNEL=9
              HF=1
              ;;
          S)
              CHANNEL=10
              HF=0
              ;;
          T)
              CHANNEL=10
              HF=1
              ;;
          U)
              CHANNEL=11
              HF=0
              ;;
          V)
              CHANNEL=11
              HF=1
              ;;
        esac
        sudo cp ${HOSTAPD} ${HOSTAPD_SAV}
        sudo sed -i "s/^channel.*/channel=$CHANNEL/" ${HOSTAPD}
        if [ $HF = 0 ]; then
          sudo sed -i "s/^ht_capab=\[HT40-\]\[HT40+\]\[SHORT-GI-20\]\[SHORT-GI-40\]\[DSSS_CCK-40\]/#ht_capab=\[HT40-\]\[HT40+\]\[SHORT-GI-20\]\[SHORT-GI-40\]\[DSSS_CCK-40\]/" ${HOSTAPD}
          if (whiptail --yesno "The WLAN channel is now changed to $CHANNEL at 20 MHz.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
            clear
            echo " "
            echo -e "${RED}[+] Activating the new WLAN channel, now...${NOCOLOR}"
            echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
            (nohup bin/hostapd_fallback) 2>/dev/null
            (sudo rm nohup.out) 2>/dev/null
          fi
        else
          sudo sed -i "s/^#ht_capab=\[HT40-\]\[HT40+\]\[SHORT-GI-20\]\[SHORT-GI-40\]\[DSSS_CCK-40\]/ht_capab=\[HT40-\]\[HT40+\]\[SHORT-GI-20\]\[SHORT-GI-40\]\[DSSS_CCK-40\]" ${HOSTAPD}
          if (whiptail --yesno "The WLAN channel is now changed to $CHANNEL at 40 MHz.\n\nHowever, the creation of a 40 MHz channel is maybe rejected based on overlapping BSSes.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
            clear
            echo " "
            echo -e "${RED}[+] Activating the new WLAN channel, now...${NOCOLOR}"
            echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
            (nohup bin/hostapd_fallback) 2>/dev/null
            (sudo rm nohup.out) 2>/dev/null
          fi
        fi
      fi
    else
      CHOICE=$(whiptail --nocancel --title "Changing the configuration of the WLAN" --radiolist "\nChoose a channel (default is 36)" 18 60 8 \
      "A" "Channel 36 at 40 MHz (default)         " ON \
      "B" "Channel 36 at 80 MHz" OFF \
      "C" "Channel 40 at 40 MHz" OFF \
      "D" "Channel 40 at 80 MHz" OFF \
      "E" "Channel 44 at 40 MHz" OFF \
      "F" "Channel 44 at 80 MHz" OFF \
      "G" "Channel 48 at 40 MHz" OFF \
      "H" "Channel 48 at 80 MHz" OFF \
      3>&1 1>&2 2>&3)
      exitstatus=$?

      if [ $exitstatus = 0 ]; then
        case $CHOICE in
          A)
              CHANNEL=36
              HF=0
              ;;
          B)
              CHANNEL=36
              HF=1
              ;;
          C)
              CHANNEL=40
              HF=0
              ;;
          D)
              CHANNEL=40
              HF=1
              ;;
          E)
              CHANNEL=44
              HF=0
              ;;
          F)
              CHANNEL=44
              HF=1
              ;;
          G)
              CHANNEL=48
              HF=0
              ;;
          H)
              CHANNEL=48
              HF=1
              ;;
        esac
        sudo cp ${HOSTAPD} ${HOSTAPD_SAV}
        sudo sed -i "s/^channel.*/channel=$CHANNEL/" ${HOSTAPD}
        if [ $HF = 0 ]; then
          sudo sed -i "s/^vht_oper_chwidth=1/#vht_oper_chwidth=1/" ${HOSTAPD}
          sudo sed -i "s/^vht_oper_centr_freq_seg0_idx=42/#vht_oper_centr_freq_seg0_idx=42/" ${HOSTAPD}
          if (whiptail --yesno "The WLAN channel is now changed to $CHANNEL at 40 MHz.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
            clear
            echo " "
            echo -e "${RED}[+] Activating the new WLAN channel, now...${NOCOLOR}"
            echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
            (nohup bin/hostapd_fallback) 2>/dev/null
            (sudo rm nohup.out) 2>/dev/null
          fi
        else
          sudo sed -i "s/^#vht_oper_chwidth=1/vht_oper_chwidth=1/" ${HOSTAPD}
          sudo sed -i "s/^#vht_oper_centr_freq_seg0_idx=42/vht_oper_centr_freq_seg0_idx=42/" ${HOSTAPD}
          if (whiptail --yesno "The WLAN channel is now changed to $CHANNEL at 80 MHz.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
            clear
            echo " "
            echo -e "${RED}[+] Activating the new WLAN channel, now...${NOCOLOR}"
            echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
            (nohup bin/hostapd_fallback) 2>/dev/null
            (sudo rm nohup.out) 2>/dev/null
          fi
        fi
      fi
    fi
    read_config
  ;;

	# Change / randomize the MAC adresses of TorBox's interfaces
  9)
		INPUT=$(cat text/help-change-MAC)
		if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
			clear
			if [ "$ON_A_CLOUD" -eq "1" ]; then
				INPUT=$(cat text/on_a_cloud_warning_mac-text)
				if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
					exitstatus=$?
					# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
					if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
				else
					trap "bash menu-config; exit 0" EXIT
					exit 0
				fi
			fi
			bash bin/change_MAC;
		fi
	;;

  #This hides / unhides the WLAN
  10)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
    if [ "$TOGGLE08" = "Hide" ]; then
      INPUT=$(cat text/hide_wlan-text)
      if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
        INPUT=ignore_broadcast_ssid=1
        TOGGLE08="hidden"
        CHANGE=1
      fi
    else
      INPUT=$(cat text/unhide_wlan-text)
      if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
        INPUT=ignore_broadcast_ssid=0
        TOGGLE08="visible"
        CHANGE=1
      fi
    fi
    if [ $CHANGE = 1 ]; then
      sudo cp ${HOSTAPD} ${HOSTAPD_SAV}
      if grep -q "^ignore_broadcast_ssid=" ${HOSTAPD}; then
				clear
        sudo sed -i "s/^ignore_broadcast_ssid=.*/${INPUT}/" ${HOSTAPD}
      else
        (printf %s"${INPUT}\n" | sudo tee -a ${HOSTAPD}) 2>/dev/null
      fi
      if (whiptail --yesno "TorBox's WLAN (SSID) is now $TOGGLE08.\n\nWould you like to put the changes immediately into effect (this will disconnect the current connection with the TorBox)?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
        clear
        echo " "
        echo -e "${RED}[+] Activating changes, now...${NOCOLOR}"
        echo -e "${YELLOW}[!] Please wait, usually the client reconnects automatically. However, you may have to disconnect and reconnect with TorBox's wireless network.${NOCOLOR}"
        (nohup bin/hostapd_fallback) 2>/dev/null
        (sudo rm nohup.out) 2>/dev/null
      fi
      read_config
    fi
  ;;

  #This disables / enables the WLAN
  11)
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		clear
    if [ "$TOGGLE09" = "Disable" ]; then
      CABLE=$(ip addr show eth0 | grep -w 192.168.43.1)
			USB0=$(ip addr show usb0 | grep -w 192.168.44.1)
			VPN=$(ip addr show tun1 | grep -w 192.168.44.1)
			clear
      if [ -z "$CABLE" ]; then
        CABLE=$(ip addr show eth1 | grep -w 192.168.43.1)
				clear
      fi
      clear
			if [ -n "$CABLE" ] || [ -n "$VPN" ] || [ -n "$USB0" ]; then
        INPUT=$(cat text/disable_wlan-text)
				DISABLED_CHOICE=$(whiptail --nocancel --title "TorBox - INFO" --radiolist "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH 2 \
        "1" "Temporary   - Disable TorBox's WLAN until next boot" OFF \
        "2" "Permanently - Disable TorBox's WLAN until enabled again" OFF 3>&1 1>&2 2>&3)
        exitstatus=$?
        if [ $exitstatus = 0 ]; then
          if [ ! -z "$DISABLED_CHOICE" ]; then
            if [ $DISABLED_CHOICE = 1 ]; then
              clear
              echo " "
              echo -e "${RED}[+] Temporary disabling TorBox's WLAN...${NOCOLOR}"
              sudo systemctl stop hostapd
              sudo systemctl daemon-reload
              sleep 2
            elif [ $DISABLED_CHOICE = 2 ]; then
              clear
              echo -e "${RED}[+] Permanently disabling TorBox's WLAN...${NOCOLOR}"
              sudo systemctl mask --now hostapd
              sudo systemctl daemon-reload
							if [ "$TORBOX_MINI" -eq "1" ]; then
								sudo cp etc/rc.local.mini /etc/rc.local
								sudo cp etc/network/interfaces.mini /etc/network/interfaces
							else
              	sudo cp etc/rc.local.disable_wlan /etc/rc.local
							fi
							sudo chmod a+x /etc/rc.local
            fi
						echo -e "${RED}[+] TorBox's WLAN is disabled!${NOCOLOR}"
						sleep 3
          fi
        else
          clear
        fi
      else
        INPUT=$(cat text/disable_wlan_error-text)
        whiptail --title "TorBox - INFO" --msgbox "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH
      fi
    else
			COUNT_WLAN=0
			COUNT_WLAN=$(sudo lshw | grep ethernet | grep -c wireless)
			clear
			if [ "$COUNT_WLAN" -gt "0" ]; then
				if [ "$TORBOX_MINI_DEFAULT" -eq "1" ]; then
					INPUT=$(cat text/torbox_mini_wifi_default_warning-text)
					whiptail --title "TorBox - INFO" --msgbox "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH
					exit 0
				fi
				EXECUTE=0
				if [ "$TORBOX_MINI" -eq "1" ]; then
					INPUT=$(cat text/torbox_mini_wifi_warning-text)
					if (whiptail --yesno "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH); then EXECUTE=1; fi
				else
					INPUT=$(cat text/enable_wlan-text)
      		if (whiptail --yesno "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH); then EXECUTE=1; fi
				fi
				if [ "$EXECUTE" -eq "1" ]; then
        	clear
        	echo -e "${RED}[+] Enabling TorBox's WLAN now...${NOCOLOR}"
        	sudo cp etc/rc.local /etc/rc.local
					sudo chmod a+x /etc/rc.local
					sudo cp etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf
        	sudo systemctl unmask hostapd
					sudo systemctl daemon-reload
					sudo systemctl enable --now hostapd
					# eth0 --> wlan0 / eth1 / usb0
					if ip link | grep usb0; then
						sudo cp etc/network/interfaces.wlan0eth1 /etc/network/interfaces
						sudo cp etc/iptables.ipv4-wlan0eth1.nat /etc/iptables.ipv4.nat
					else
						sudo cp etc/network/interfaces.wlan0eth1notusb0 /etc/network/interfaces
						sudo cp etc/iptables.ipv4-wlan0eth1notusb0.nat /etc/iptables.ipv4.nat
					fi
					if pgrep -f "dhclient.wlan0" ; then
						(sudo dhclient -r) 2>&1
						sudo ifdown wlan0 &>/dev/null
						sudo ifup wlan0 &>/dev/null
					fi
        	sudo systemctl start hostapd
					sudo sed -i "s/^INTERNET_IFACE=.*/INTERNET_IFACE=eth0/" ${RUNFILE}
					echo -e "${RED}[+] TorBox's WLAN is enabled!${NOCOLOR}"
					echo -e "${RED}[+] You can use it by selecting another connection setup with${NOCOLOR}"
					echo -e "${RED}[+] TorBox's Main Menu (entry 5-10) or after rebooting TorBox${NOCOLOR}"
					sleep 3
				fi
			else
				whiptail --title "TorBox - INFO" --textbox text/no_wireless_interface-text $MENU_HEIGHT_15 $MENU_WIDTH_REDUX
      fi
    fi
    read_config
  ;;

  #This disables / enables HTTP plain text traffic block
	12)
    if [ "$TOGGLE12" = "Enable" ]; then
      INPUT=$(cat text/block-limitation-txt)
      if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
        clear
        echo -e "${RED}[+] Block HTTP plain text traffic!${NOCOLOR}"
				($IPTABLES -t nat -I PREROUTING 4 -p tcp --syn -d 10.192.0.0/10 -j REDIRECT --to-ports 9040) 2>/dev/null
				# Not necessary, as all local connections to the box port 22 and 80 etc. are accepted.
				# All TCP connection requests from devices in the 192.168.0.0/16 network are redirected to the web server on port 80 (webssh).
				# ($IPTABLES -t nat -I PREROUTING 5 -p tcp --syn -d 192.168.0.0/16 -j REDIRECT --to-ports 80) 2>/dev/null
				# ($IPTABLES -t nat -I PREROUTING 5 -p tcp --dport 80 -j LOG --log-prefix "HTTP-REQUEST TCP " --log-ip-options --log-tcp-options) 2>/dev/null
				# ($IPTABLES -t nat -I PREROUTING 6 -p udp --dport 80 -j LOG --log-prefix "HTTP-REQUEST UDP " --log-ip-options) 2>/dev/null
				($IPTABLES -t nat -I PREROUTING 5 -p tcp --dport 80 -j DNAT --to-destination 0.0.0.0) 2>/dev/null
				($IPTABLES -t nat -I PREROUTING 6 -p udp --dport 80 -j DNAT --to-destination 0.0.0.0) 2>/dev/null
        (sudo sh -c "iptables-save > /etc/iptables.ipv4.nat") 2>/dev/null
        sudo sed -i "s/^BLOCK_HTTP=.*/BLOCK_HTTP=1/" ${RUNFILE}
        sleep 2
      fi
    fi
    if [ "$TOGGLE12" = "Disable" ]; then
      if (whiptail --title "TorBox - INFO" --defaultno --yesno "Would you like to allow HTTP plain text traffic?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
        clear
        echo -e "${RED}[+] Unblock HTTP plain text traffic!${NOCOLOR}"
				($IPTABLES -t nat -D PREROUTING -p tcp --syn -d 10.192.0.0/10 -j REDIRECT --to-ports 9040) 2>/dev/null
				# ($IPTABLES -t nat -D PREROUTING -p tcp --syn -d 192.168.0.0/16 -j REDIRECT --to-ports 80) 2>/dev/null
				# ($IPTABLES -t nat -D PREROUTING -p tcp --dport 80 -j LOG --log-prefix "HTTP-REQUEST TCP " --log-ip-options --log-tcp-options) 2>/dev/null
				# ($IPTABLES -t nat -D PREROUTING -p udp --dport 80 -j LOG --log-prefix "HTTP-REQUEST UDP " --log-ip-options) 2>/dev/null
				($IPTABLES -t nat -D PREROUTING -p tcp --dport 80 -j DNAT --to-destination 0.0.0.0) 2>/dev/null
				($IPTABLES -t nat -D PREROUTING -p udp --dport 80 -j DNAT --to-destination 0.0.0.0) 2>/dev/null
        (sudo sh -c "iptables-save > /etc/iptables.ipv4.nat") 2>/dev/null
        sudo sed -i "s/^BLOCK_HTTP=.*/BLOCK_HTTP=0/" ${RUNFILE}
        sleep 2
      fi
    fi
  ;;

	# Exclude slow tor relays
	13)
		if [ "$TOGGLE18" = "Start" ]; then
    	INPUT=$(cat text/exclude_slow_tor_relays-text)
			if (whiptail --title "TorBox v.0.5.5 - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
				SPEED=$(whiptail --title "TorBox v.0.5.5 - Speed threshold" --inputbox "\nEnter the speed threeshold in KB/s. All relays below that threshold will be excluded (default: 4000)" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3)
				exitstatus=$?
				if [ "$exitstatus" == "1" ] || [ "$exitstatus" == "255" ]; then
					clear
					trap "bash menu-config; exit 0" EXIT
					exit 1
				fi
				if [ "$SPEED" != "" ] ; then
					is_integer "${SPEED}"
					exitstatus=$?
					# exitstatus == 1 means that $SPEED is not an integer
					if [ "$exitstatus" = "1" ]; then
						clear
						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
						trap "bash menu-config; exit 0" EXIT
						exit 1
					fi
				else
					SPEED=$DEFAULT_SPEED
				fi
				clear
				echo -e "${RED}[+] Excluding slow tor relays (shouldn't be more then half of the total relays)...${NOCOLOR}"
				sudo bin/exclude-slow-tor-relays-ng -b $SPEED
				sleep 5
				clear
				sudo sed -i "s/^#$TOR_INCLUDE_EX_SLOW/$TOR_INCLUDE_EX_SLOW/" ${TORRC}
				sudo sed -i "s/^EX_SLOW=.*/EX_SLOW=$SPEED/" ${RUNFILE}
				restarting_tor menu-config
			fi
		fi
		if [ "$TOGGLE18" = "Stop" ]; then
			clear
			echo -e "${RED}[+] Stop excluding slow tor relays...${NOCOLOR}"
			(sudo rm /etc/tor/torrc.exclude-slow) 2>/dev/null
			sudo sed -i "s/^$TOR_INCLUDE_EX_SLOW/#$TOR_INCLUDE_EX_SLOW/" ${TORRC}
			sudo sed -i "s/^EX_SLOW=.*/EX_SLOW=0/" ${RUNFILE}
			sleep 1
			echo -e "${RED}[+] DONE!${NOCOLOR}"
			sleep 5
			restarting_tor menu-config
		fi
  ;;

	# Limit Bandwidth for tor network traffic
	14)
		if [ "$TOGGLE10" = "Start" ]; then
			OLD_LIMIT=$(grep "^BandwidthRate .*" "$TORRC" | sed "s/^BandwidthRate *//")
			if [ -z "$OLD_LIMIT" ] ; then OLD_LIMIT="1 GB"; fi
			INPUT=$(cat text/limit_tor_bandwidth-text)
			LIMIT=$(whiptail --title "TorBox v.0.5.5 - Bandwidth limit" --inputbox "$INPUT" $MENU_HEIGHT_20 $MENU_WIDTH $OLD_LIMIT 3>&1 1>&2 2>&3)
			exitstatus=$?
			if [ "$exitstatus" == "1" ] || [ "$exitstatus" == "255" ]; then
				clear
				trap "bash menu-config; exit 0" EXIT
				exit 1
			fi
			if [ "$LIMIT" != "" ] ; then
				NUMBER=$(cut -d ' ' -f1 <<< $LIMIT)
				UNIT=$(cut -d ' ' -f2 <<< $LIMIT)
				if [ -z "$UNIT" ]; then
					clear
					echo -e "${YELLOW}[!] WRONG INPUT - bytes, KB, MB or GB is missing!${NOCOLOR}"
					sleep 5
					clear
					trap "bash menu-config; exit 0" EXIT
					exit 1
				else
					if [[ "$UNIT" != "bytes" && "$UNIT" != "KB" && "$UNIT" != "MB" && "$UNIT" != "GB" ]]; then
						clear
						echo -e "${YELLOW}[!] WRONG INPUT - Unit has to be bytes, KB, MB or GB!${NOCOLOR}"
						sleep 5
						clear
						trap "bash menu-config; exit 0" EXIT
						exit 1
					fi
				fi
				is_integer "${NUMBER}"
				exitstatus=$?
				# exitstatus == 1 means that $NUMBER is not an integer
				if [ "$exitstatus" = "1" ]; then
					clear
					echo -e "${YELLOW}[!] WRONG INPUT - THE NUMBER IS NOT AN INTEGER!${NOCOLOR}"
					sleep 5
					clear
					trap "bash menu-config; exit 0" EXIT
					exit 1
				fi
				clear
				echo -e "${RED}[+] Setting a bandwidth limit for the Tor networ traffic...${NOCOLOR}"
				if grep "^#BandwidthRate" ${TORRC}; then sed -i "s/#BandwidthRate/BandwidthRate/" ${TORRC}; fi
				if grep "^BandwidthRate" ${TORRC}; then sudo sed -i "s/^BandwidthRate .*/BandwidthRate $NUMBER $UNIT/" ${TORRC}; fi
				if grep "^#BandwidthBurst" ${TORRC}; then sed -i "s/#BandwidthBurst/BandwidthBurst/" ${TORRC}; fi
				if grep "^BandwidthBurst" ${TORRC}; then sudo sed -i "s/^BandwidthBurst .*/BandwidthBurst $NUMBER $UNIT/" ${TORRC}; fi
				sleep 5
				restarting_tor menu-config
			fi
		fi
		if [ "$TOGGLE10" = "Stop" ]; then
			clear
			echo -e "${RED}[+] Removing the bandwidth limit for the Tor networ traffic...${NOCOLOR}"
			sudo sed -i "s/^BandwidthRate .*/#BandwidthRate 1 GB/" ${TORRC}
			sudo sed -i "s/^BandwidthBurst .*/#BandwidthBurst 1 GB/" ${TORRC}
			sleep 5
			restarting_tor menu-config
		fi
	;;

	#This disables / enables the access to the Tor control port from clients
	15)
    if [ "$TOGGLE14" = "Enable" ]; then
      INPUT=$(cat text/tor_control_port_enable-text)
      if (whiptail --title "TorBox - INFO" --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
        clear
        sudo sed -i "s/^TOR_CONTROL_PORT_ACCESS=0/TOR_CONTROL_PORT_ACCESS=1/" ${RUNFILE}
      fi
    fi
    if [ "$TOGGLE14" = "Disable" ]; then
      clear
      echo " "
      echo -e "${RED}[+] Disable access to the Tor control port from clients!${NOCOLOR}"
      sudo sed -i "s/^TOR_CONTROL_PORT_ACCESS=1/TOR_CONTROL_PORT_ACCESS=0/" ${RUNFILE}
      sudo sed -i "s/^ControlPort 192.168.42.1:9051/#ControlPort 192.168.42.1:9051/" ${TORRC}
      sudo sed -i "s/^ControlPort 192.168.43.1:9051/#ControlPort 192.168.43.1:9051/" ${TORRC}
      sudo sed -i "s/^ControlPort 192.168.44.1:9051/#ControlPort 192.168.44.1:9051/" ${TORRC}
      sleep 5
      echo -e "${RED}[+] Restart Tor...${NOCOLOR}"
      sudo systemctl stop tor
      sudo systemctl restart tor
      echo -e "${YELLOW}[+] DONE! The access to the Tor control port from clients is disabled!${NOCOLOR}"
      sleep 5
    fi
  ;;

	# Enter the advanced configuration editor
	16)
    INPUT=$(cat text/advanced-OS-text)
    if (whiptail --title "TorBox - INFO" --defaultno --no-button "DON'T CHANGE" --yes-button "CHANGE NOW" --yesno "$INPUT" $MENU_HEIGHT_20 $MENU_WIDTH); then
      sudo cp ${TORRC} ${BAK}
      bin/vitor
      INPUT=$(cat text/restart-tor-text)
      if (whiptail --title "TorBox - INFO" --defaultno --no-button "NO - DON'T (RE)START" --yes-button "YES - (RE)START" --yesno "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH); then
        clear
        restarting_tor menu-onion
      fi
    fi
  ;;

  #This changes the extent of the logging
	17)
    if (whiptail --title "Changing the extent of logging ($TOGGLE03b -> $TOGGLE04b)" --defaultno --yes-button "High" --no-button "LOW" --yesno "\nWould you like to change the extend of logging?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3); then
			LOG_STATUS_001=$(sudo systemctl is-active rsyslog)
			LOG_STATUS_002=$(sudo systemctl is-active systemd-journald.service)
			if [ "$LOG_STATUS_001" == "inactive" ] && [ "$LOG_STATUS_002" == "inactive" ]; then
				if test -f "/etc/rsyslog.conf"; then
					sudo systemctl unmask rsyslog
        	sudo systemctl enable rsyslog
        	sudo systemctl start rsyslog
				fi
				sudo systemctl unmask systemd-journald.service
				sudo systemctl start systemd-journald.service
				sudo systemctl start systemd-journald-dev-log.socket
				sudo systemctl start systemd-journald-audit.socket
				sudo systemctl start systemd-journald.socket
        if (whiptail --yesno "\n\nWould you like to reboot TorBox now to make sure all logging will be started?" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
          clear
          echo " "
          echo -e "${RED}[+] Rebooting TorBox...${NOCOLOR}"
          echo -e "${YELLOW}[!] If you have activated Bridges or Bridge Relay, these services will be reactivated automatically after the restart.${NOCOLOR}"
					sync
          sleep 2
          sudo reboot
          exit 0
        fi
      fi
    else
      clear
      echo " "
      echo -e "${RED}[+] Stopping logging now...${NOCOLOR}"
			if test -f "/etc/rsyslog.conf"; then sudo systemctl stop rsyslog; fi
			sudo systemctl stop systemd-journald-dev-log.socket
			sudo systemctl stop systemd-journald-audit.socket
			sudo systemctl stop systemd-journald.socket
			sudo systemctl stop systemd-journald.service
			sudo systemctl mask systemd-journald.service
      echo ""
      echo -e "${RED}[+] Making it permanent...${NOCOLOR}"
      #Siehe auch hier: https://stackoverflow.com/questions/17358499/linux-how-to-disable-all-log
      if test -f "/etc/rsyslog.conf"; then
				sudo systemctl disable rsyslog
				sudo systemctl mask rsyslog
			fi
      echo ""
      erase_logs
      sleep 2
    fi
    read_config
  ;;

  #This erases all log files
	18)
    clear
    erase_logs
    sleep 2
  ;;

	#This is for installing, managing or removing the OpenVPN server
	19)
		clear
		sudo bash install/openvpn-install.sh
		read_config
		clear
	;;

  #This is the support for Adafruit's PiTFT displays
	20)
		if [ -z "$CHECK_HD3" ]; then
			whiptail --title "TorBox - INFO" --textbox text/no_raspi-text $MENU_HEIGHT_15 $MENU_WIDTH_REDUX
			trap "bash menu-config; exit 0" EXIT
			exit 0
		fi
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		INPUT=$(cat text/pitft-text)
		if (whiptail --defaultno --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
			clear
			online_check
			if [ $OCHECK == 1 ]; then
				sudo pip3 install Click adafruit-python-shell
				sudo python3 install/adafruit-pitft.py -u /home/torbox
			else
				echo -e "${YELLOW}[!] SORRY! - TorBox is not connected with the Internet!${NOCOLOR}"
				echo -e "${RED}[+] For that reason, we cannot execute this function :(${NOCOLOR}"
				echo " "
				read -n 1 -s -r -p "Press any key to continue"
			fi
		fi
  ;;

  #This is the support for 3.5" no-name TFT displays
	21)
		if [ -z "$CHECK_HD3" ]; then
			whiptail --title "TorBox - INFO" --textbox text/no_raspi-text $MENU_HEIGHT_15 $MENU_WIDTH_REDUX
			trap "bash menu-config; exit 0" EXIT
			exit 0
		fi
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
		clear
    online_check
    if [ $OCHECK == 1 ]; then
      INPUT=$(cat text/nonametft-text)
      if (whiptail --defaultno --yesno "$INPUT" $MENU_HEIGHT_20 $MENU_WIDTH); then
        INPUT=$(whiptail --title "Degree of Rotation" --inputbox "\nEnter the degree of rotation (0 / 90 / 180 / 270 / default is 0):" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX 3>&1 1>&2 2>&3)
        cd
        sudo rm -rf LCD-show
        git clone https://github.com/goodtft/LCD-show.git
        cp torbox/install/LCD-show/LCD35-show LCD-show/
        sudo chmod -R 755 LCD-show/
        cd LCD-show/
        if [ ! -z "$INPUT" ]; then
          if [ $INPUT == 0 ] || [ $INPUT == 90 ] || [ $INPUT == 180 ] || [ $INPUT == 270 ] ; then
            sudo ./LCD35-show $INPUT
          else
            sudo ./LCD35-show 0
          fi
        else
          sudo ./LCD35-show 0
        fi
        cd
        if (whiptail --defaultno --yesno "Do you want to activate the auto login feature on the TFT display?" $MENU_HEIGHT_10 $MENU_WIDTH_REDUX); then
					sudo mkdir -p /etc/systemd/system/getty@tty1.service.d
          if ! grep -q "# Added by TorBox  LCD35-show script" /etc/systemd/system/getty@tty1.service.d/override.conf 2>/dev/null ; then
            sudo printf "# Added by TorBox LCD35-show script\n[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin torbox --noclear %%I linux\n" | sudo tee -a /etc/systemd/system/getty@tty1.service.d/override.conf
            sudo systemctl daemon-reexec
            sudo systemctl daemon-reload
            sudo systemctl restart getty@tty1.service
          fi
        else
          sudo rm -f /etc/systemd/system/getty@tty1.service.d/override.conf
          sudo systemctl daemon-reexec
          sudo systemctl daemon-reload
        fi
        if (whiptail --defaultno --yesno "Would you like to use the TorBox menu on the TFT display without an additional keyboard and activate \"screen accessibility\"?\n\nFor more information see here: https://www.torbox.ch/?page_id=982" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
          sudo sed -i "s/^.\/menu/screen .\/menu/g" .profile
        else
          sudo sed -i "s/^screen .\/menu/.\/menu/g" .profile
        fi
        sudo rm -rf LCD-show
        if (whiptail --yesno "Would you like to reboot TorBox now to use the TFT display?" $MENU_HEIGHT_10 $MENU_WIDTH_REDUX); then
          clear
          echo -e "${RED}[+] Rebooting TorBox...${NOCOLOR}"
          echo -e "${YELLOW}[!] If you have activated Bridges or Bridge Relay, these services will be reactivated automatically after the restart.${NOCOLOR}"
					sync
          sleep 2
          sudo reboot
          exit 0
        fi
      fi
    else
      echo -e "${YELLOW}[!] SORRY! - TorBox is not connected with the Internet!${NOCOLOR}"
      echo -e "${RED}[+] For that reason, we cannot execute this function :(${NOCOLOR}"
      echo " "
      read -n 1 -s -r -p "Press any key to continue"
    fi
  ;;

  #This is the support for Sixfab Shields/HATs for cellular connections
  #Remark for TorBox v.0.5.5 - we try to do it without an online connection.
  #Preinstalled packages needed: ppp
	22)
		if [ -z "$CHECK_HD3" ]; then
			whiptail --title "TorBox - INFO" --textbox text/no_raspi-text $MENU_HEIGHT_15 $MENU_WIDTH_REDUX
			trap "bash menu-config; exit 0" EXIT
			exit 0
		fi
		clear
		if [ "$ON_A_CLOUD" -eq "1" ]; then
			INPUT=$(cat text/on_a_cloud_warning-text)
			if (whiptail --title "TorBox - INFO" --yesno --defaultno --no-button "BACK!" --yes-button "DO IT!" "$INPUT" $MENU_HEIGHT_15 $MENU_WIDTH_REDUX); then
				exitstatus=$?
				# exitstatus = 255 means that the ESC key was pressed / exitstatus = 1 is cancelled
				if [ "$exitstatus" = "1" ] || [ "$exitstatus" = "255" ] ; then exit 0 ; fi
			else
				trap "bash menu-config; exit 0" EXIT
				exit 0
			fi
		fi
    INPUT=$(cat text/sixfab-text)
    if (whiptail --defaultno --yesno "$INPUT" $MENU_HEIGHT_25 $MENU_WIDTH); then
      #Original file: https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_installer/install.sh
      cd install/Sixfab_PPP_Installer-master/ppp_installer
      chmod +x install.sh
      sudo ./install.sh
    fi
  ;;

  *)
    clear
    exit 0
esac
cd
cd torbox
bash menu-config
exit 0
