From 7e74615ce62943d733f46d2309d3893650fbe213 Mon Sep 17 00:00:00 2001 From: Eric Westphal Date: Fri, 21 Jul 2017 16:00:37 -0400 Subject: [PATCH] Remove hostapd_manager_quiet.sh per @peepsnet. --- Makefile | 1 - __root__stratux-pre-start.sh | 5 +- image/hostapd_manager.sh | 10 +- image/hostapd_manager_quiet.sh | 244 --------------------------------- selfupdate/makeupdate.sh | 1 - selfupdate/update_footer.sh | 1 - 6 files changed, 8 insertions(+), 254 deletions(-) delete mode 100644 image/hostapd_manager_quiet.sh diff --git a/Makefile b/Makefile index be46007d..2ba09e93 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,6 @@ install: cp -f libdump978.so /usr/lib/libdump978.so cp -f dump1090/dump1090 /usr/bin/ cp -f image/hostapd_manager.sh /usr/sbin/ - cp -f image/hostapd_manager_quiet.sh /usr/sbin/ cp -f image/stratux-wifi.sh /usr/sbin/ clean: diff --git a/__root__stratux-pre-start.sh b/__root__stratux-pre-start.sh index 259c2317..7b309cd6 100755 --- a/__root__stratux-pre-start.sh +++ b/__root__stratux-pre-start.sh @@ -2,11 +2,12 @@ echo powersave >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor +#Logging Function +SCRIPT=`basename ${BASH_SOURCE[0]}` STX_LOG="/var/log/stratux.log" function wLog () { - echo "$(date +"%Y/%m/%d %H:%m:%S") - $1" >> ${STX_LOG} + echo "$(date +"%Y/%m/%d %H:%m:%S") - $SCRIPT - $1" >> ${STX_LOG} } - wLog "Running Stratux Updater Script." SCRIPT_MASK="update*stratux*v*.sh" diff --git a/image/hostapd_manager.sh b/image/hostapd_manager.sh index bc23253d..607bf48d 100644 --- a/image/hostapd_manager.sh +++ b/image/hostapd_manager.sh @@ -164,14 +164,14 @@ while getopts $options option; do OPT_E=$defaultPass echo "${GREEN} WiFi will be encrypted using ${BOLD}${UNDR}$OPT_E${NORMAL}${GREEN} as the passphrase!${WHITE}${NORMAL}" else - echo "${BOLD}${RED}$err Option -e does not require arguement.${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Option -e does not require argument.${WHITE}${NORMAL}" exit 1 fi ;; p) #set encryption with user specified passphrase if [[ -z "${OPTARG}" || "${OPTARG}" =~ ^[[:space:]]*$ || "${OPTARG}" == -* ]]; then echo "${BOLD}${RED}$err Encryption option(-p) used without passphrase!${WHITE}${NORMAL}" - echo "${BOLD}${RED}$err Encryption option(-p) required an arguement \"-p passphrase\" ${WHITE}${NORMAL}" + echo "${BOLD}${RED}$err Encryption option(-p) required an argument \"-p passphrase\" ${WHITE}${NORMAL}" else OPT_P=$OPTARG fi @@ -277,7 +277,7 @@ do if [ $OPT_E != false ]; then echo "${MAGENTA}Adding WPA encryption with passphrase: ${YELLOW}$OPT_E ${MAGENTA}to $i...${WHITE}" if grep -q "^#auth_algs=" ${i}; then - #echo "uncomenting wpa" + #echo "uncommenting wpa" sed -i "s/^#auth_algs=.*/auth_algs=1/" ${i} sed -i "s/^#wpa=.*/wpa=3/" ${i} sed -i "s/^#wpa_passphrase=.*/wpa_passphrase=$OPT_E/" ${i} @@ -306,7 +306,7 @@ do if [ $OPT_O != false ]; then echo "${MAGENTA}Removing WPA encryption in $i...${WHITE}" if grep -q "^auth_algs=" ${i}; then - #echo "comenting out wpa" + #echo "commenting out wpa" sed -i "s/^auth_algs=.*/#auth_algs=1/" ${i} sed -i "s/^wpa=.*/#wpa=3/" ${i} sed -i "s/^wpa_passphrase=.*/#wpa_passphrase=$defaultPass/" ${i} @@ -314,7 +314,7 @@ do sed -i "s/^wpa_pairwise=.*/#wpa_pairwise=TKIP/" ${i} sed -i "s/^rsn_pairwise=.*/#rsn_pairwise=CCMP/" ${i} elif grep -q "^#auth_algs=" ${i}; then - #echo "rewriting comentied out wpa" + #echo "rewriting commented out wpa" sed -i "s/^#auth_algs=.*/#auth_algs=1/" ${i} sed -i "s/^#wpa=.*/#wpa=3/" ${i} sed -i "s/^#wpa_passphrase=.*/#wpa_passphrase=$defaultPass/" ${i} diff --git a/image/hostapd_manager_quiet.sh b/image/hostapd_manager_quiet.sh deleted file mode 100644 index 6bea6473..00000000 --- a/image/hostapd_manager_quiet.sh +++ /dev/null @@ -1,244 +0,0 @@ -#!/bin/bash - -###################################################################### -# STRATUX QUIET HOSTAPD MANAGE # -###################################################################### -# This script is almost identical to hostapd_manager.sh except all the -# screen outputs are supplressed except for error messages. -# -# Usage: -# hostapd_manager_quiet.sh -s Stratux-N12345 -p SquawkDirty! -c 5 -# Command above sets the SSID to "Stratux-N12345, secures the network with the passphrase "SquawkDirty!, and changes the network channel to "5" -# -# hostapd_manager_quiet.sh -o -# Command above opens the network(removes any passphrase) -# -# hostapd_manager_quiet.sh -e -# Command above secures the WiFi network using the default passphrase "SquawkDirtyToMe!" - -# Options: -# -s --Sets the SSID to ${BOLD}ssid${NORM}. -s stratux -# -c --Sets the channel to chan. -c 1 -# -o --Turns off encryption and sets network to open. Cannot be used with -e or -p. -# -e --Turns on encryption with passphrase SquawkDirtyToMe!. Cannot be used with -o or -p -# -p --Turns on encryption with your chosen passphrase pass. 8-63 Printable Characters(ascii 32-126). Cannot be used with -o or -e. -p password! -# -# Important: -# After each call of this script the wifi network will disconnect and restart all associated services to apply the changes - -#Set Script Name variable -SCRIPT=`basename ${BASH_SOURCE[0]}` - -#Initialize variables to default values. -OPT_S=false -OPT_C=false -OPT_E=false -OPT_O=false -OPT_P=false -OPT_Q=false -OPT_R=false -defaultPass="SquawkDirtyToMe!" - -#apply settings and restart all processes -function APPLYSETTINGSQUIET { - sleep 2 - TEMP=:$(/usr/bin/killall -9 hostapd hostapd-edimax > /dev/null 2>&1) - sleep 1 - TEMP=:$(/usr/sbin/service isc-dhcp-server stop > /dev/null 2>&1) - sleep 0.5 - TEMP=:$(ifdown wlan0) - sleep 0.5 - TEMP=:$(ifup wlan0) - sleep 0.5 -} - -function error_exit { - echo "$1" >&2 ## Send message to stderr. Exclude >&2 if you don't want it that way. - exit "${2:-1}" ## Return a code specified by $2 or 1 by default. -} - -if [ $(whoami) != 'root' ]; then - echo "${BOLD}${RED}This script must be executed as root, exiting...${WHITE}${NORMAL}" - echo "${BOLD}${RED}USAGE${WHITE}${NORMAL}" - error_exit "Not Root" -fi - -#Check the number of arguments. If none are passed, print help and exit. -NUMARGS=$# -if [ $NUMARGS -eq 0 ]; then - error_exit "No Args Passed" -fi - -### Start getopts code ### - -#Parse command line flags -#If an option should be followed by an argument, it should be followed by a ":". -#Notice there is no ":" after "eoqh". The leading ":" suppresses error messages from -#getopts. This is required to get my unrecognized option code to work. -options=':s:c:p:eoh' -while getopts $options option; do - case $option in - s) #set option "s" - if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then - error_exit "No SSID for -s, exiting..." - else - OPT_S=$OPTARG - fi - ;; - c) #set option "c" - if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then - error_exit "Channel option(-c) used without value, exiting... " - else - OPT_C=$OPTARG - if [[ "$OPT_C" =~ ^[0-9]+$ ]] && [ "$OPT_C" -ge 1 -a "$OPT_C" -le 13 ]; then - OPT_C=$OPTARG - else - error_exit "Channel is not within acceptable values, exiting..." - fi - fi - ;; - e) #set option "e" with default passphrase - if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then - OPT_E=$defaultPass - else - error_exit "Option -e does not require arguement.${WHITE}${NORMAL}" - fi - ;; - p) #set encryption with user specified passphrase - if [[ -z "${OPTARG}" || "${OPTARG}" =~ ^[[:space:]]*$ || "${OPTARG}" == -* ]]; then - error_exit "Encryption option(-p) used without passphrase!" - else - OPT_P=$OPTARG - fi - echo "$parm Encryption option -p used:" - if [ -z `echo $OPT_P | tr -d "[:print:]"` ] && [ ${#OPT_P} -ge 8 ] && [ ${#OPT_P} -le 63 ]; then - echo "${GREEN} WiFi will be encrypted using ${BOLD}${UNDR}$OPT_P${NORMAL}${GREEN} as the passphrase!${WHITE}${NORMAL}" - else - error_exit "Invalid PASSWORD: 8 - 63 printable characters, exiting..." - fi - ;; - o) #set option "o" - if [[ -z "${OPTARG}" || "${OPTARG}" == *[[:space:]]* || "${OPTARG}" == -* ]]; then - OPT_O=true - else - error_exit "${BOLD}${RED}$err Option -o does not require arguement. Exiting..." - fi - ;; - \?) # invalid option - error_exit "Invalid option -$OPTARG" - ;; - :) # Missing Arg - error_exit "Missing option for argument -$OPTARG" - ;; - *) # Invalid - error_exit "Unimplemented option -$OPTARG ${WHITE}${NORMAL}" - ;; - esac -done - -shift $((OPTIND-1)) #This tells getopts to move on to the next argument. - -### End getopts code ### - - -### Main loop to process files ### - -#This is where your main file processing will take place. This example is just -#printing the files and extensions to the terminal. You should place any other -#file processing tasks within the while-do loop. - -if [[ $OPT_O == true && ( $OPT_E != false || $OPT_P != false ) ]]; then - error_exit "Option -e , -p and -o cannot be used simultaneously" -fi - -if [ $OPT_P != false ] && [ $OPT_E != false ]; then - error_exit "Option -e and -p cannot be used simultaneously..." -fi - -# files to edit -HOSTAPD=('/etc/hostapd/hostapd.user') - -#### -#### File modification loop -#### -for i in "${HOSTAPD[@]}" -do - if [ -f ${i} ]; then - if [ $OPT_S != false ]; then - if grep -q "^ssid=" ${HOSTAPD[$x]}; then - sed -i "s/^ssid=.*/ssid=${OPT_S}/" ${i} - else - echo ${OPT_S} >> ${i} - fi - fi - - if [ $OPT_C != false ]; then - if grep -q "^channel=" ${i}; then - sed -i "s/^channel=.*/channel=${OPT_C}/" ${i} - else - echo ${OPT_C} >> ${i} - fi - fi - - if [ $OPT_E != false ]; then - if grep -q "^#auth_algs=" ${i}; then - sed -i "s/^#auth_algs=.*/auth_algs=1/" ${i} - sed -i "s/^#wpa=.*/wpa=3/" ${i} - sed -i "s/^#wpa_passphrase=.*/wpa_passphrase=$OPT_E/" ${i} - sed -i "s/^#wpa_key_mgmt=.*/wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^#wpa_pairwise=.*/wpa_pairwise=TKIP/" ${i} - sed -i "s/^#rsn_pairwise=.*/rsn_pairwise=CCMP/" ${i} - elif grep -q "^auth_algs=" ${i}; then - sed -i "s/^auth_algs=.*/auth_algs=1/" ${i} - sed -i "s/^wpa=.*/wpa=3/" ${i} - sed -i "s/^wpa_passphrase=.*/wpa_passphrase=$OPT_E/" ${i} - sed -i "s/^wpa_key_mgmt=.*/wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^wpa_pairwise=.*/wpa_pairwise=TKIP/" ${i} - sed -i "s/^rsn_pairwise=.*/rsn_pairwise=CCMP/" ${i} - else - echo "" >> ${i} - echo "auth_algs=1" >> ${i} - echo "wpa=3" >> ${i} - echo "wpa_passphrase=$OPT_E" >> ${i} - echo "wpa_key_mgmt=WPA-PSK" >> ${i} - echo "wpa_pairwise=TKIP" >> ${i} - echo "rsn_pairwise=CCMP" >> ${i} - fi - fi - if [ $OPT_O != false ]; then - if grep -q "^auth_algs=" ${i}; then - sed -i "s/^auth_algs=.*/#auth_algs=1/" ${i} - sed -i "s/^wpa=.*/#wpa=3/" ${i} - sed -i "s/^wpa_passphrase=.*/#wpa_passphrase=$defaultPass/" ${i} - sed -i "s/^wpa_key_mgmt=.*/#wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^wpa_pairwise=.*/#wpa_pairwise=TKIP/" ${i} - sed -i "s/^rsn_pairwise=.*/#rsn_pairwise=CCMP/" ${i} - elif grep -q "^#auth_algs=" ${i}; then - sed -i "s/^#auth_algs=.*/#auth_algs=1/" ${i} - sed -i "s/^#wpa=.*/#wpa=3/" ${i} - sed -i "s/^#wpa_passphrase=.*/#wpa_passphrase=$defaultPass/" ${i} - sed -i "s/^#wpa_key_mgmt=.*/#wpa_key_mgmt=WPA-PSK/" ${i} - sed -i "s/^#wpa_pairwise=.*/#wpa_pairwise=TKIP/" ${i} - sed -i "s/^#rsn_pairwise=.*/#rsn_pairwise=CCMP/" ${i} - else - echo "" >> ${i} - echo "#auth_algs=1" >> ${i} - echo "#wpa=3" >> ${i} - echo "#wpa_passphrase=$defaultPass" >> ${i} - echo "#wpa_key_mgmt=WPA-PSK" >> ${i} - echo "#wpa_pairwise=TKIP" >> ${i} - echo "#rsn_pairwise=CCMP" >> ${i} - fi - fi - else - error_exit "No ${i} file found..." - fi -done - -### End main loop ### - -### Apply Settings and restart all services - - APPLYSETTINGSQUIET - -exit 1 diff --git a/selfupdate/makeupdate.sh b/selfupdate/makeupdate.sh index 238cc66c..54ae511c 100755 --- a/selfupdate/makeupdate.sh +++ b/selfupdate/makeupdate.sh @@ -31,7 +31,6 @@ cp image/bashrc.txt work/bin/ cp image/modules.txt work/bin/ cp image/stxAliases.txt work/bin/ cp image/hostapd_manager.sh work/bin/ -cp image/hostapd_manager_quiet.sh work/bin/ cp image/sdr-tool.sh work/bin/ cp image/10-stratux.rules work/bin/ cp image/99-uavionix.rules work/bin/ diff --git a/selfupdate/update_footer.sh b/selfupdate/update_footer.sh index 1f1f4ea8..2a2f2018 100755 --- a/selfupdate/update_footer.sh +++ b/selfupdate/update_footer.sh @@ -28,7 +28,6 @@ cp -f stratux-wifi.sh /usr/sbin/ #WiFi Config Manager cp -f hostapd_manager.sh /usr/sbin/ -cp -f hostapd_manager_quiet.sh /usr/sbin/ #SDR Serial Script cp -f sdr-tool.sh /usr/sbin/