Colorize output

This commit is contained in:
deltaxflux 2018-05-28 15:17:27 +02:00
parent 6e96e6b10a
commit 1ebbe20bd7
1 changed files with 9 additions and 18 deletions

View File

@ -31,37 +31,36 @@ FLUXIONWindowRatio=4
# ================= < Script Sanity Checks > ================= # # ================= < Script Sanity Checks > ================= #
# ============================================================ # # ============================================================ #
if [ $EUID -ne 0 ]; then # Super User Check if [ $EUID -ne 0 ]; then # Super User Check
echo -e "Aborted, please execute the script as root."; exit 1 echo -e "\033[31mAborted, please execute the script as root.\033[0m"; exit 1
fi fi
# ===================== < XTerm Checks > ===================== # # ===================== < XTerm Checks > ===================== #
# TODO: Run the checks below only if we're not using tmux. # TODO: Run the checks below only if we're not using tmux.
if [ ! "${DISPLAY:-}" ]; then # Assure display is available. if [ ! "${DISPLAY:-}" ]; then # Assure display is available.
echo -e "Aborted, X (graphical) session unavailable."; exit 2 echo -e "\033[31mAborted, X (graphical) session unavailable.\033[0m"; exit 2
fi fi
if ! hash xdpyinfo 2>/dev/null; then # Assure display probe. if ! hash xdpyinfo 2>/dev/null; then # Assure display probe.
echo -e "Aborted, xdpyinfo is unavailable."; exit 3 echo -e "\033[31mAborted, xdpyinfo is unavailable.\033[0m"; exit 3
fi fi
if ! xdpyinfo &>/dev/null; then # Assure display info available. if ! xdpyinfo &>/dev/null; then # Assure display info available.
echo -e "Aborted, xterm test session failed."; exit 3 echo -e "\033[31mAborted, xterm test session failed.\033[0m"; exit 3
fi fi
# ================ < Parameter Parser Check > ================ # # ================ < Parameter Parser Check > ================ #
getopt --test > /dev/null # Assure enhanced getopt (returns 4). getopt --test > /dev/null # Assure enhanced getopt (returns 4).
if [ $? -ne 4 ]; then if [ $? -ne 4 ]; then
echo "Aborted, enhanced getopt isn't available."; exit 4 echo "\033[31mAborted, enhanced getopt isn't available.\033[0m"; exit 4
fi fi
# =============== < Working Directory Check > ================ # # =============== < Working Directory Check > ================ #
if ! mkdir -p "$FLUXIONWorkspacePath" &> /dev/null; then if ! mkdir -p "$FLUXIONWorkspacePath" &> /dev/null; then
echo "Aborted, can't generate a workspace directory."; exit 5 echo "\033[31mAborted, can't generate a workspace directory.\033[0m"; exit 5
fi fi
# Once sanity check is passed, we can start to load everything. # Once sanity check is passed, we can start to load everything.
# ============================================================ # # ============================================================ #
# =================== < Library Includes > =================== # # =================== < Library Includes > =================== #
# ============================================================ # # ============================================================ #
@ -114,9 +113,7 @@ while [ "$1" != "" -a "$1" != "--" ]; do
-b|--bssid) FluxionTargetMAC=$2; shift;; -b|--bssid) FluxionTargetMAC=$2; shift;;
-e|--essid) FluxionTargetSSID=$2; -e|--essid) FluxionTargetSSID=$2;
# TODO: Rearrange declarations to have routines available for use here. # TODO: Rearrange declarations to have routines available for use here.
FluxionTargetSSIDClean=$( FluxionTargetSSIDClean=$(echo "$FluxionTargetSSID" | sed -r 's/( |\/|\.|\~|\\)+/_/g')
echo "$FluxionTargetSSID" | sed -r 's/( |\/|\.|\~|\\)+/_/g'
)
shift;; shift;;
-c|--channel) FluxionTargetChannel=$2; shift;; -c|--channel) FluxionTargetChannel=$2; shift;;
-l|--language) FluxionLanguage=$2; shift;; -l|--language) FluxionLanguage=$2; shift;;
@ -197,14 +194,12 @@ readonly IOUtilsPrompt="$FLUXIONPrompt"
readonly HashOutputDevice="$FLUXIONOutputDevice" readonly HashOutputDevice="$FLUXIONOutputDevice"
# ============================================================ # # ============================================================ #
# =================== < Default Language > =================== # # =================== < Default Language > =================== #
# ============================================================ # # ============================================================ #
# Set by default in case fluxion is aborted before setting one. # Set by default in case fluxion is aborted before setting one.
source "$FLUXIONPath/language/en.sh" source "$FLUXIONPath/language/en.sh"
# ============================================================ # # ============================================================ #
# ================== < Startup & Shutdown > ================== # # ================== < Startup & Shutdown > ================== #
# ============================================================ # # ============================================================ #
@ -236,11 +231,7 @@ fluxion_startup() {
clear clear
if [ "$FLUXIONAuto" ]; then if [ "$FLUXIONAuto" ]; then echo -e "$CBlu"; else echo -e "$CRed"; fi
echo -e "$CBlu"
else
echo -e "$CRed"
fi
for line in "${banner[@]}"; do for line in "${banner[@]}"; do
echo "$line"; sleep 0.05 echo "$line"; sleep 0.05
@ -1726,7 +1717,7 @@ fluxion_set_attack() {
if [ "${IOQueryFormatFields[1]}" = "$FLUXIONGeneralBackOption" ]; then if [ "${IOQueryFormatFields[1]}" = "$FLUXIONGeneralBackOption" ]; then
return -1 return -1
fi fi
if [ "${IOQueryFormatFields[1]}" = "$FLUXIONAttackRestartOption" ]; then if [ "${IOQueryFormatFields[1]}" = "$FLUXIONAttackRestartOption" ]; then
return 2 return 2
fi fi