diff --git a/README.md b/README.md index 84869a2..f1fce62 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # NetSet -Operational Security utility and automator. +Operational Security utility and automator. ( Version 1.1.0 ) + NetSet is designed to automate a number of operations that will help the user with securing their network traffic. It also provides an easy way to gather proxies and run utilities through Tor. @@ -17,6 +18,16 @@ Easy access to online OPSEC resources, the web resources in question can be open And more. +### DNSCrypt-Proxy Config + +Recently i've noticed that certain distros, even though they're Debian or Ubuntu derivatives don't seem to be able to +process the configuration file that gets downloaded through `apt` or is written out by means of NetSet's `debconf.sh` +script. + +Therefore i did some testing and managed to put together a `DNSCrypt-proxy.toml` file, based on original examples by +the DNSCrypt dev that appears to work on most systems. If you're interested find it [here](https://gist.github.com/NullArray/28958795b16f8eda7a5b0a69f8ce57fe). If you're still facing some trouble, please don't hesitate to open up a ticket. And i'll get back to you as soon as i am able to, to help you troubleshoot. Thanks! + + ## Usage After cloning the repo navigate to the `NetSet` directory and run the following: @@ -30,6 +41,9 @@ This will install and configure everything you'll need for NetSet to function pr ### Update +From now on NetSet will install `veracrypt` and `pwgen` and provide automated operations related to those utilities on top of all the +features Version 1.0.0 provides. + Using `sudo` to start the script will execute every operation within the script as root, this means you won't be prompted for your `sudo` password when an operation requires elevated privileges. However all items written by NetSet will consequently be owned by root as well, including backup directories. Last but not least; when considering security implications, it is not recommended to run everything with super user privileges. Starting the main script with `sudo` will be optional from now on to reflect the above considerations. @@ -65,6 +79,8 @@ Menu Options 'Tor Wall' - Configures iptables to force all connections through Tor. + 'Veracrypt' - Start encryption and + password gen menu 'OPSEC Resources'- Display NetSet's included list of web resources. Select an entry to open @@ -74,6 +90,10 @@ Menu Options ### Note Tested on Ubuntu 19.04 +The Python invocations to launch the web resources provided with NetSet are in 2.7 Syntax. If your OS doesn't +have Python2.7 changing the invocation from `python -m webbrowser URL` to `python3 -m webbrowser URL` should +remedy any compatibility issues, should you come across them in this particular regard. + I plan on expanding this tool in the future with even more OPSEC related resources and/or operations. Should you happen to come across a bug or have any questions regarding this tool. diff --git a/depconf.sh b/depconf.sh index 5897254..c55046b 100644 --- a/depconf.sh +++ b/depconf.sh @@ -196,7 +196,7 @@ Pin-Priority: 100 " > pinning.pref read -p 'Enter any button to to continue: ' null && clear notification "Preparations complete. Installing." sudo apt update && sudo apt install -y testing dnscrypt-proxy - sudo apt install -y unstable dnscrypt-proxy + sudo apt install -y unstable dnscrypt-proxy notification "Operations Completed" else os=$(uname -a) @@ -230,8 +230,45 @@ Pin-Priority: 100 " > pinning.pref fi notification "Task Completed" + } +# Install VeraCrypt and pwgen +function vera(){ + logo + echo -e "\n +Welcome to the config and dependency manager for NetSet. + +The latest release adds VeraCrypt. This provides the user +with the means to create encrypted volumes and keep data +safe. This version also installs 'pwgen' in order to +generate secure passwords conveniently.\n" + read -p 'Start installation? [Y]es/[N]o: ' choice + if [[ $choice == 'y' || $choice == 'Y' ]]; then + notification "Installing VeraCrypt" && sleep 2 + # Create dir to extract tar to + mkdir veracrypt && cd veracrypt + wget -O veracrypt.tar.bz2 https://launchpad.net/veracrypt/trunk/1.23/+download/veracrypt-1.23-setup.tar.bz2 + tar -xvjf veracrypt.tar.bz2 || warning "Something went wrong" && exit 1 + + MACHINE_TYPE=`uname -m` + if [[ ${MACHINE_TYPE} == 'x86_64' ]]; then + chmod +x veracrypt-1.23-setup-gui-x64 + ./veracrypt-1.23-setup-gui-x64 && notification "Installed VeraCrypt" + else + chmod +x veracrypt-1.23-setup-gui-x86 + ./veracrypt-1.23-setup-gui-x86 && notification "Installed VeraCrypt" + fi + # Back to depconf dir + cd .. + + # Install pwgen for secure password generation + if [[ -z $(which pwgen) ]]; then + notification "Installing 'pwgen' for secure password generation." && sleep 2 + sudo apt-get -y pwgen || warning "Something went wrong" && exit 1 + fi + fi + } function start(){ # Print banner @@ -245,14 +282,12 @@ Before making changes all relevant config files will be backed up in a directory labeled: 'backup- $(date) '\n" read -p 'Start installation? [Y]es/[N]o: ' choice if [[ $choice == 'y' || $choice == 'Y' ]]; then - - - # Install utilities + # Install utilities notification "Checking system utilities." && sleep 2 if [[ -z $(which pymux) ]]; then pip install pymux; fi if [[ -z $(which tor) ]]; then sudo apt-get -y install tor; fi if [[ -z $(which nmcli) ]]; then sudo apt-get -y install nmcli; fi - if [[ -z $(which torsocks) ]]; then sudo apt-get -y install torsocks; fi + if [[ -z $(which torsocks) ]]; then sudo apt-get -y install torsocks; fi if [[ -z $(which openvpn) ]]; then sudo apt-get -y install openvpn; fi if [[ -z $(which iptables) ]]; then sudo apt-get -y install iptables; fi if [[ -z $(which macchanger) ]]; then sudo apt-get -y install macchanger; fi @@ -260,7 +295,7 @@ be backed up in a directory labeled: 'backup- $(date) '\n" sudo apt-get -y install proxychains notification_b "Proxychains has been installed, run 'man proxychains' for details." - fi + fi notification "Packages checked." @@ -271,7 +306,7 @@ be backed up in a directory labeled: 'backup- $(date) '\n" # Install proxy fetcher wget -O proxies/fetch.py https://raw.githubusercontent.com/stamparm/fetch-some-proxies/master/fetch.py && echo "Proxy Fetcher installed" >> installed.log - if [[ -z $(which protonvpn-cli) ]]; then + if [[ -z $(which protonvpn) ]]; then echo -e "Would you like to install ProtonVPN?" read -p '[Y]es/[N]o ' choice if [[ $choice == 'y' || $choice == 'Y' ]]; then @@ -284,9 +319,9 @@ be backed up in a directory labeled: 'backup- $(date) '\n" warning "Skipping Account Creation" if [[ -z $(which dialog) ]]; then sudo apt-get install -y dialog; fi - wget -O protonvpn-cli.sh https://gist.githubusercontent.com/NullArray/eec1d89a3171fc188f25cd633e26fba0/raw/1e359e2dca579aca2ad68b59111ef9bc58f593d2/protonvpn-cli.sh - chmod +x protonvpn-cli.sh - sudo ./protonvpn-cli.sh --install + pip3 install protonvpn-cli || sudo pip3 install protonvpn-cli + protonvpn init + fi fi fi @@ -295,6 +330,18 @@ be backed up in a directory labeled: 'backup- $(date) '\n" warning "Installation Aborted" fi + # Install VeraCrypt + vera + } -# Start -start + +# Check to see if we only need to install VeraCrypt +if [[ "$1" != "" ]]; then + case $1 in + '--crypto' ) + vera + esac +else + # Install all + start +fi diff --git a/netset-main.sh b/netset-main.sh index f45496e..1ff0bc0 100644 --- a/netset-main.sh +++ b/netset-main.sh @@ -19,21 +19,36 @@ GREEN=$ESC"32;01m" # Working dir CWD=$(pwd) # Date -NOW=$(date) +NOW=$(date +"%d_%m_%Y") # Active connected interface IFACES=$(ip link | awk -F: '$0 !~ "lo|vir|wl|^[^0-9]"{print $2;getline}') + +# Default value for this var should be 0 +# When started with the --status arg set +# value to 1 in order to print logo and +# exit after one operation +stus=0 + # Declare associative array for tip of the day feature declare -A TotD -TotD[0]="\n Tip: Starting the script with '-t' or '--terminal' starts a terminal\n multiplexer where all sessions are routed through Tor \n" -TotD[1]="\n Tip: Starting the script with '-s' or '--status' shows the operational\n status of NetSet security utilities\n" -TotD[2]="\n Tip: Starting the script with '-i' or '--install' will run installation\n and auto-config procedures for NetSet\n" -TotD[3]="\n Tip: Choosing option 1 in the main menu loop will print\n extended usage information\n" -TotD[4]="\n Tip: For other offensive and defensive security utilities\n visit github.com/NullArray\n" -TotD[5]="\n Tip: Operational Security isn't just a matter of having the\n right utilities.\n It's also about discipline in thought, action,\n and careful information consideration and management.\n" -TotD[6]="\n Tip: If you want to know more about how you can improve your\n OPSEC beyond what NetSet offers\n select the 'OPSEC Resources'\n option from the main menu and start learning! \n" -TotD[7]="\n Tip: You can change the resolvers that DNSCrypt-proxy uses\n by adding them to the 'server_names' array which can be \nfound in /etc/dnscrypt-proxy/dnscrypt-proxy.toml\n" -TotD[8]="\n Tip: Looking for more resolvers? Select 'OPSEC Resources'\n in the main menu Then from the next menu select \n'DNSCrypt Resolvers' to open a list in your browser\n" +TotD[0]="\nTip: Starting the script with '-t' or '--terminal' starts a terminal\nmultiplexer where all sessions are routed through Tor\n" +TotD[1]="\nTip: Starting the script with '-s' or '--status' shows the operational\nstatus of NetSet security utilities\n" +TotD[2]="\nTip: Starting the script with '-i' or '--install' will run installation\nand auto-config procedures for NetSet\n" +TotD[3]="\nTip: Choosing option 1 in the main menu loop will print\nextended usage information\n" +TotD[4]="\nTip: For other offensive and defensive security utilities\nvisit github.com/NullArray\n" +TotD[5]="\nTip: Operational Security isn't just a matter of having the\nright utilities.\n It's also about discipline in thought, action,\nand careful information consideration and management.\n" +TotD[6]="\nTip: If you want to know more about how you can improve your\nOPSEC beyond what NetSet offers\n select the 'OPSEC Resources'\noption from the main menu and start learning!\n" +TotD[7]="\nTip: You can change the resolvers that DNSCrypt-proxy uses\nby adding them to the 'server_names' array which can be\nfound in /etc/dnscrypt-proxy/dnscrypt-proxy.toml\n" +TotD[8]="\nTip: Looking for more resolvers? Select 'OPSEC Resources'\nin the main menu Then from the next menu select\n'DNSCrypt Resolvers' to open a list in your browser\n" +TotD[9]="\nTip: The 'depconf.sh' script has installed 'proxychains' as well\nRun 'man proxychains' for details and usage." + +# Declare associative array for Version Display +declare -A VeR + +VeR[0]="Version 1.1.0" # Official Version is 1.1.0 but for fun we have; +VeR[1]="The Crypto Drome Edition." # Some catchy catchphrases, +VeR[2]="More Secure, Less Hassle" # And pseudo serious slogans # Warning function warning(){ @@ -51,6 +66,7 @@ function notification_b() { } function logo(){ + rng=$[ $RANDOM % 3 ] clear echo -e "\n $CYAN @@ -60,6 +76,7 @@ function logo(){ ██║╚██╗██║██╔══╝ ██║ ╚════██║██╔══╝ ██║ ██║ ╚████║███████╗ ██║ ███████║███████╗ ██║ ╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝ + # ${VeR[$rng]} ################################################### $CYAN #$GREEN--|Operational Security Utility $CYAN #$GREEN--|Authored by Vector/NullArray @@ -88,7 +105,7 @@ $CYAN|$RESET $CYAN|$RESET In a lot of ways, OPSEC is a state of mind. $CYAN|$RESET $CYAN|$RESET To get started select 'Usage' in the main menu. -$CYAN+----------------------------> +$CYAN+---------------------------->$RESET " } @@ -96,19 +113,19 @@ function usage(){ echo -e "$CYAN +------------------------------------------------------> | $RESET Options Overview $RESET $CYAN -+------------------------------------------> + $RESET -$CYAN|$RESET CLI Arguments $CYAN | $RESET -$CYAN|$RESET '-t' or '--terminal' Starts $CYAN | $RESET -$CYAN|$RESET terminal multiplexer with all $CYAN | $RESET -$CYAN|$RESET connections routed through Tor $CYAN | $RESET -$CYAN|$RESE $CYAN | $RESET -$CYAN|$RESET '-s' or '--status' prints a status $CYAN | $RESET -$CYAN|$RESET overview of NetSet related network $CYAN + $RESET -$CYAN|$RESET utilities and their current state. ++------------------------------------------> +$CYAN|$RESET CLI Arguments +$CYAN|$RESET '-t' or '--terminal' Starts +$CYAN|$RESET terminal multiplexer with all +$CYAN|$RESET connections routed through Tor $CYAN|$RESET -$CYAN|$RESET '-i' or '--install' runs a script -$CYAN|$RESET designed to install all of NetSet's -$CYAN|$RESET dependencies and configures them +$CYAN|$RESET '-s' or '--status' prints a status +$CYAN|$RESET overview of NetSet related network +$CYAN|$RESET utilities and their current state. +$CYAN|$RESET +$CYAN|$RESET '-i' or '--install' runs a script +$CYAN|$RESET designed to install all of NetSet's +$CYAN|$RESET dependencies and configures them $CYAN|$RESET $CYAN|$RESET Menu Options $CYAN|$RESET @@ -124,19 +141,21 @@ $CYAN|$RESET routed through Tor $CYAN|$RESET 'Tor Wall' - Configures iptables to $CYAN|$RESET force all connections $CYAN|$RESET through Tor. +$CYAN|$RESET 'Veracrypt' - Start encryption and +$CYAN|$RESET password gen menu $CYAN|$RESET 'OPSEC Resources'- Display NetSet's included $CYAN|$RESET list of web resources. $CYAN|$RESET Select an entry to open $CYAN|$RESET it in your default browser $CYAN|$RESET -$CYAN+----------------------------> +$CYAN+----------------------------> $RESET " } function vpn_ops(){ # Run VPN notification_b "Starting ProtonVPN menu" - sudo protonvpn-cli -m || warning "Something went wrong" + sudo protonvpn connect || warning "Something went wrong" notification "Done" && sleep 2 menu } @@ -154,23 +173,25 @@ function chmac(){ notification_b "Use a random MAC Address or custom?" read -p '[R]andom/[C]ustom ' choice if [[ $choice == 'r' || $choice == 'R' ]]; then - for x in $IFACES; do sudo macchanger --random $x; done - notification "Done" && sleep 4 + for x in $IFACES; do sudo macchanger --random $x; done + notification "Done" && sleep 4 else - if [[ $choice == 'c' || $choice == 'C' ]]; then - read -p 'Enter Custom MAC: ' value - for x in $IFACES; do sudo macchanger --mac=$value $x; done - notification "Done" && sleep 4 - else - warning "Unhandled Option" - fi + if [[ $choice == 'c' || $choice == 'C' ]]; then + read -p 'Enter Custom MAC: ' value + for x in $IFACES; do sudo macchanger --mac=$value $x; done + notification "Done" && sleep 4 + else + warning "Unhandled Option" + fi fi menu } function status(){ - # This function provides a quick status overview + # This function provides a quick overview of the network status + if [[ stus == 1 ]]; then logo; fi + notification "Loading status information..." && sleep 2 echo -e "Status on $NOW \n\n" @@ -179,59 +200,57 @@ function status(){ echo -e "\n$CYAN Current External IP $RESET\n" curl https://api.myip.com && sleep 3.5 echo -e "\n\n$CYAN Current VPN Status$RESET\n" - sudo protonvpn-cli --status && sleep 3.5 || warning "ProtonVPN not configured" + protonvpn status && sleep 3.5 || warning "ProtonVPN not configured" notification "Loading relevant services status..." && sleep 2 sudo systemctl status tor.service tr=$(sudo systemctl status tor.service) - case $tr in - # Does the var contain the string below? - *"Active: inactive (dead)"*) - t=1 - ;; + # Does the var contain the string below? + *"Active: inactive (dead)"*) + t=1 + ;; esac sudo systemctl status openvpn.service ovpn=$(sudo systemctl status openvpn.service) - case $ovpn in - # Does the var contain the string below? - *"Active: inactive (dead)"*) - o=1 - ;; + # Does the var contain the string below? + *"Active: inactive (dead)"*) + o=1 + ;; esac sudo systemctl status dnscrypt-proxy.service dnsc=$(sudo systemctl status dnscrypt-proxy.service) - case $dnsc in - # Does the var contain the string below? - *"Active: inactive (dead)"*) - d=1 - ;; + # Does the var contain the string below? + *"Active: inactive (dead)"*) + d=1 + ;; esac # Report and activate inactive services if [[ $d == 1 ]]; then - warning "DNS Crypt Service is inactive" - sudo systemctl restart dnscrypt-proxy && notification "Service Restarted" || warning "An error was encountered while trying to start the DNS Crypt Service" + warning "DNS Crypt Service is inactive" + sudo systemctl restart dnscrypt-proxy && notification "Service Restarted" || warning "An error was encountered while trying to start the DNS Crypt Service" fi if [[ $o == 1 ]]; then - warning "OpenVPN Service is inactive" - sudo systemctl restart openvpn && notification "Service Restarted" || warning "An error was encountered while trying to start the OpenVPN Service" + warning "OpenVPN Service is inactive" + sudo systemctl restart openvpn && notification "Service Restarted" || warning "An error was encountered while trying to start the OpenVPN Service" fi if [[ $t == 1 ]]; then - warning "Tor Service is inactive" - sudo systemctl restart tor && notification "Service Restarted" || warning "An error was encountered while trying to start the Tor Service" + warning "Tor Service is inactive" + sudo systemctl restart tor && notification "Service Restarted" || warning "An error was encountered while trying to start the Tor Service" fi + # CLI arg status operation ends here + if [[ $stus == 1 ]]; then notification_b "Status check completed" && exit 0; fi + notification "Done." - if [[ $check == 1 ]]; then check=0 && exit 0; fi - read -p 'Enter any button to continue: ' null clear && menu @@ -240,16 +259,13 @@ function status(){ function proxy_ops(){ notification_b "Select Area" - # Australia and NZ are included in the 'N. America' option, since they are part of the five eyes countries - # The GeoSorting process is has a little less to do with the actual locations of the countries in general - # But with GeoPolitical zones of influence and/or control echo -e "\n - [1] North America - [2] South America - [3] Europe - [4] Eastern Europe - [5] Asia - [Q] Quit\n" +[1] North America +[2] South America +[3] Europe +[4] Eastern Europe +[5] Asia +[Q] Quit to Main Menu\n" read -p 'Enter Choice: ' choice if [[ $choice == '1' ]]; then python proxies/fetch.py --country='canada|united states|greenland|australia|new zealand' --max-latency=3 --anonymity='elite|anonymous' --output=North-American.log; fi if [[ $choice == '2' ]]; then python proxies/fetch.py --country='mexico|argentina|venezuela|colombia|brazil|cuba|ecuador' --max-latency=3 --anonymity='elite|anonymous' --output=South-American.log; fi @@ -258,12 +274,12 @@ function proxy_ops(){ if [[ $choice == '5' ]]; then python proxies/fetch.py --country='china|japan|korea|thailand|india|bangladesh|hong kong' --max-latency=3 --anonymity='elite|anonymous' --output=Asia.log; fi if [[ $choice == 'Q' || $choice == 'q' ]]; then - echo -e "Returning to main menu..." - sleep 2 && menu + echo -e "Returning to main menu..." + sleep 2 && menu else - warning "Unhandled Option" - echo -e "Returning to main menu..." - sleep 2 && menu + warning "Unhandled Option" + echo -e "Returning to main menu..." + sleep 2 && menu fi } @@ -342,22 +358,96 @@ function ip_tabs(){ sudo iptables-save > ip_table_backup/my.active.firewall.rules torwall else - if [[ $choice == 'Stop' || $choice == 'stop' ]]; then - # Reverse changes - sudo iptables -F - sudo iptables -X - sudo iptables -Z - sudo iptables -t nat -F - sudo iptables -t nat -X - sudo iptables -t nat -Z - sudo iptables-restore ip_table_backup/my.active.firewall.rules - notification "Done" && sleep 2 - - menu - else - warning "Unhandled Option" - fi + if [[ $choice == 'Stop' || $choice == 'stop' ]]; then + # Reverse changes + sudo iptables -F + sudo iptables -X + sudo iptables -Z + sudo iptables -t nat -F + sudo iptables -t nat -X + sudo iptables -t nat -Z + sudo iptables-restore ip_table_backup/my.active.firewall.rules + notification "Done" && sleep 2 + + menu + else + warning "Unhandled Option" + fi + fi + } + +# Password generation menu +function pw_ops(){ + logo + PS3='Please enter your choice: ' + options=("Generate 16char password" "Generate 32char password" "Generate 16char batch" "Generate 32char batch" "Quit") + select opt in "${options[@]}" + do + case $opt in + "Generate 16char password") + clear && pwgen --secure 16 1 + read -p "Enter any button to continue..." null && logo + echo -e " +1) Generate 16char password 3) Generate 16char batch 5) Quit +2) Generate 32char password 4) Generate 32char batch\n" + printf "%b \n" + ;; + "Generate 32char password") + clear && pwgen --secure 32 1 + read -p "Enter any button to continue..." null && logo + echo -e " +1) Generate 16char password 3) Generate 16char batch 5) Quit +2) Generate 32char password 4) Generate 32char batch\n" + printf "%b \n" + ;; + "Generate 16char batch") + clear && pwgen --secure 16 28 + read -p "Enter any button to continue..." null && logo + echo -e " +1) Generate 16char password 3) Generate 16char batch 5) Quit +2) Generate 32char password 4) Generate 32char batch\n" + printf "%b \n" + ;; + "Generate 32char batch") + clear && pwgen --secure 32 14 + read -p "Enter any button to continue..." null && logo + echo -e " +1) Generate 16char password 3) Generate 16char batch 5) Quit +2) Generate 32char password 4) Generate 32char batch\n" + printf "%b \n" + ;; + "Quit") + break + ;; + *) echo invalid option;; + esac + done + + menu + + } + +# Launch and manage all disk encryption and password ops +function cryptodrome(){ + logo + echo -e "Please select an action\n +[1] Password Generation +[2] Invoke online VeraCrypt documentation +[3] Invoke VeraCrypt Graphical User Interface +[Q] Quit to Main Menu\n" + read -p "Enter Choice " choice + if [[ $choice == '1' ]]; then pw_ops; fi + if [[ $choice == '2' ]]; then python -m webbrowser https://www.veracrypt.fr/en/Documentation.html; fi + if [[ $choice == '3' ]]; then veracrypt; fi + if [[ $choice == 'Q' || $choice == 'q' ]]; then + echo -e "Returning to main menu..." + sleep 2 && menu + fi + + echo -e "Returning to main menu..." + sleep 2 && menu + } function resources(){ @@ -411,10 +501,10 @@ function resources(){ *) echo invalid option;; esac done - - menu - - } + + menu + + } # Main menu function menu(){ @@ -424,104 +514,113 @@ function menu(){ rand=$[ $RANDOM % 10 ] && echo -e ${TotD[$rand]} PS3='Please enter your choice: ' - options=("Help" "Status" "Spoof MAC" "Random Proxies" "GeoSort Proxies" "ProtonVPN" "Tor Terminal" "Tor Wall" "OPSEC Resources" "Quit") + options=("Help" "Status" "Spoof MAC" "Random Proxies" "GeoSort Proxies" "ProtonVPN" "Tor Terminal" "Tor Wall" "Veracrypt" "OPSEC Resources" "Quit") select opt in "${options[@]}" do case $opt in "Help") usage printf "%b \n" - ;; + ;; "Status") status printf "%b \n" - ;; + ;; "Spoof MAC") chmac printf "%b \n" - ;; + ;; "Random Proxies") r_proxies printf "%b \n" - ;; + ;; "GeoSort Proxies") proxy_ops printf "%b \n" - ;; + ;; "ProtonVPN") vpn_ops printf "%b \n" - ;; + ;; "Tor Terminal") torsocks python -m pymux #|| . torsocks on printf "%b \n" - ;; + ;; "Tor Wall") ip_tabs printf "%b \n" - ;; + ;; + "Veracrypt") + cryptodrome + printf "%b \n" + ;; "OPSEC Resources") resources printf "%b \n" - ;; + ;; "Quit") exit 0 - ;; + ;; *) echo invalid option;; esac done } +# Do not make a backup dir each run +stat backup-* > /dev/null || dir=1 +if [[ $dir == 1 ]]; then + mkdir "backup-$(date)" 2&> /dev/null + mkdir ip_table_backup 2&> /dev/null + mkdir proxies 2&> /dev/null +fi + # Check for command line arguments if [[ "$1" != "" ]]; then - case $1 in - '-i' | '--install' ) - bash depconf.sh && menu - esac + case $1 in + '-i' | '--install' ) + bash depconf.sh && menu + esac fi if [[ "$1" != "" ]]; then - case $1 in - '-s' | '--status' ) - logo && check=1 - sleep 2 - status - esac + case $1 in + '-s' | '--status' ) + stus=1 && status + esac fi if [[ "$1" != "" ]]; then - case $1 in - '-t' | '--terminal' ) - torsocks python -m pymux #|| . torsocks on - esac + case $1 in + '-t' | '--terminal' ) + torsocks python -m pymux #|| . torsocks on + esac fi -function go(){ - # Print banner - logo - # print intro - intro - # menu - menu - } -# Creating dirs, we don't want them to have messed up perms -# if dir exists STDERR to /dev/null -mkdir "backup-$(date)" 2&> /dev/null -mkdir ip_table_backup 2&> /dev/null -mkdir proxies 2&> /dev/null +function init_x(){ + # Print banner + logo + # print intro + intro + # menu + menu + + } + +# Check to see if VeraCrypt is installed +if [[ -z $(which veracrypt) ]]; then stat installed.log > /dev/null && bash depconf.sh --crypto && menu; fi # Check for root if [[ "$EUID" -ne 0 ]]; then - warning "Some operations require Root to run." - read -p "Continue as normal user? [Y]es/[N]o " choice - if [[ $choice == 'Y' || $choice == 'y' ]]; then - stat installed.log > /dev/null && go || warning "Dependencies missing, restart the script with --install" && exit 1 - else - warning "User Aborted" - exit 1 - fi + warning "Some operations require Root to run." + read -p "Continue as normal user? [Y]es/[N]o " choice + if [[ $choice == 'Y' || $choice == 'y' ]]; then + stat installed.log > /dev/null && init_x || warning "Dependencies missing, restart the script with --install" && exit 1 + else + warning "User Aborted" + exit 1 + fi else - # Check to see if depconf.sh has been succesfully executed - stat installed.log > /dev/null && go || warning "Dependencies missing, restart the script with --install" && exit 1 + # Check to see if depconf.sh has been succesfully executed + stat installed.log > /dev/null && init_x || warning "Dependencies missing, restart the script with --install" && exit 1 fi