Merge pull request #110 from FluxionNetwork/installer-update

Installer update
This commit is contained in:
Matias Barcenas 2017-08-22 01:38:44 -05:00 committed by GitHub
commit 36a1b498be
8 changed files with 418 additions and 150 deletions

View File

@ -3,50 +3,41 @@
################################ < FLUXION Parameters > ################################ ################################ < FLUXION Parameters > ################################
# NOTE: The FLUXIONPath constant will not be populated correctly if the script is called # NOTE: The FLUXIONPath constant will not be populated correctly if the script is called
# directly via a symlink. Symlinks in the path to the script should work completely fine. # directly via a symlink. Symlinks in the path to the script should work completely fine.
FLUXIONPath="$( cd "$(dirname "$0")" ; pwd -P )" declare -r FLUXIONPath="$( cd "$(dirname "$0")" ; pwd -P )"
FLUXIONWorkspacePath="/tmp/fluxspace" declare -r FLUXIONWorkspacePath="/tmp/fluxspace"
FLUXIONHashPath="$FLUXIONPath/attacks/Handshake Snooper/handshakes" declare -r FLUXIONHashPath="$FLUXIONPath/attacks/Handshake Snooper/handshakes"
FLUXIONScanDB="dump" declare -r FLUXIONScanDB="dump"
FLUXIONNoiseFloor=-90 declare -r FLUXIONNoiseFloor=-90
FLUXIONNoiseCeiling=-60 declare -r FLUXIONNoiseCeiling=-60
FLUXIONVersion=3 declare -r FLUXIONVersion=3
FLUXIONRevision=1 declare -r FLUXIONRevision=1
FLUXIONDebug=${FLUXIONDebug:+1} declare -r FLUXIONDebug=${FLUXIONDebug:+1}
FLUXIONWIKillProcesses=${FLUXIONWIKillProcesses:+1} declare -r FLUXIONWIKillProcesses=${FLUXIONWIKillProcesses:+1}
FLUXIONWIReloadDriver=${FLUXIONWIReloadDriver:+1} declare -r FLUXIONWIReloadDriver=${FLUXIONWIReloadDriver:+1}
FLUXIONAuto=${FLUXIONAuto:+1} declare -r FLUXIONAuto=${FLUXIONAuto:+1}
# FLUXIONDebug [Normal Mode "" / Developer Mode 1] # FLUXIONDebug [Normal Mode "" / Developer Mode 1]
export FLUXIONOutputDevice=$([ $FLUXIONDebug ] && echo "/dev/stdout" || echo "/dev/null") declare -r FLUXIONOutputDevice=$([ $FLUXIONDebug ] && echo "/dev/stdout" || echo "/dev/null")
FLUXIONHoldXterm=$([ $FLUXIONDebug ] && echo "-hold" || echo "") declare -r FLUXIONHoldXterm=$([ $FLUXIONDebug ] && echo "-hold" || echo "")
################################# < Shell Color Codes > ################################ ################################# < Library Includes > #################################
CRed="\e[1;31m" source lib/installer/InstallerUtils.sh
CGrn="\e[1;32m" source lib/InterfaceUtils.sh
CYel="\e[1;33m" source lib/SandboxUtils.sh
CBlu="\e[1;34m" source lib/FormatUtils.sh
CPrp="\e[5;35m" source lib/ColorUtils.sh
CCyn="\e[5;36m" source lib/IOUtils.sh
CGry="\e[0;37m" source lib/HashUtils.sh
CWht="\e[1;37m"
CClr="\e[0m"
################################ < FLUXION Parameters > ################################ ################################ < FLUXION Parameters > ################################
FLUXIONPrompt="$CRed[${CBlu}fluxion$CYel@$CClr$HOSTNAME$CRed]-[$CYel~$CRed]$CClr " FLUXIONPrompt="$CRed[${CBlu}fluxion$CYel@$CClr$HOSTNAME$CRed]-[$CYel~$CRed]$CClr "
FLUXIONVLine="$CRed[$CYel*$CRed]$CClr" FLUXIONVLine="$CRed[$CYel*$CRed]$CClr"
################################# < Library Includes > #################################
source lib/InterfaceUtils.sh
source lib/SandboxUtils.sh
source lib/FormatUtils.sh
source lib/IOUtils.sh
source lib/HashUtils.sh
source language/English.lang source language/English.lang
################################ < Library Parameters > ################################ ################################ < Library Parameters > ################################
@ -55,26 +46,36 @@ InterfaceUtilsOutputDevice="$FLUXIONOutputDevice"
SandboxWorkspacePath="$FLUXIONWorkspacePath" SandboxWorkspacePath="$FLUXIONWorkspacePath"
SandboxOutputDevice="$FLUXIONOutputDevice" SandboxOutputDevice="$FLUXIONOutputDevice"
InstallerUtilsWorkspacePath="$FLUXIONWorkspacePath"
InstallerUtilsOutputDevice="$FLUXIONOutputDevice"
InstallerUtilsNoticeMark="$FLUXIONVLine"
PackageManagerLog="$InstallerUtilsWorkspacePath/package_manager.log"
IOUtilsHeader="fluxion_header" IOUtilsHeader="fluxion_header"
IOUtilsQueryMark="$FLUXIONVLine" IOUtilsQueryMark="$FLUXIONVLine"
IOUtilsPrompt="$FLUXIONPrompt" IOUtilsPrompt="$FLUXIONPrompt"
HashOutputDevice="$FLUXIONOutputDevice" HashOutputDevice="$FLUXIONOutputDevice"
################################# < User Preferences > ################################# ################################# < Super User Check > #################################
if [ -x "$FLUXIONPath/preferences.sh" ]; then source "$FLUXIONPath/preferences.sh"; fi if [ $EUID -ne 0 ]; then
########################################################################################
if [[ $EUID -ne 0 ]]; then
echo -e "${CRed}You don't have admin privilegies, execute the script as root.$CClr" echo -e "${CRed}You don't have admin privilegies, execute the script as root.$CClr"
exit 1 exit 1
fi fi
if [ -z "${DISPLAY:-}" ]; then if [ ! "${DISPLAY:-}" ]; then
echo -e "${CRed}The script should be exected inside a X (graphical) session.$CClr" echo -e "${CRed}The script should be exected inside a X (graphical) session.$CClr"
exit 1 exit 2
fi fi
################################# < Default Language > #################################
source language/English.lang
################################# < User Preferences > #################################
if [ -x "$FLUXIONPath/preferences.sh" ]; then source "$FLUXIONPath/preferences.sh"; fi
########################################################################################
function exitmode() { function exitmode() {
if [ ! $FLUXIONDebug ]; then if [ ! $FLUXIONDebug ]; then
fluxion_header fluxion_header
@ -157,36 +158,6 @@ function conditional_bail() {
read bullshit read bullshit
} }
function check_updates() {
# Attempt to retrieve versioning information from repository script.
local FLUXIONOnlineInfo=("`timeout -s SIGTERM 20 curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion.sh" 2>/dev/null | egrep "^(FLUXIONVersion|FLUXIONRevision)"`")
if [ -z "${FLUXIONOnlineInfo[@]}" ]; then
FLUXIONOnlineInfo=("version=?\n" "revision=?\n")
fi
echo -e "${FLUXIONOnlineInfo[@]}" > "$FLUXIONWorkspacePath/latest_version"
}
# Animation
function spinner() {
local pid=$1
local delay=0.15
local spinstr='|/-\'
tput civis
while [ "`ps a | awk '{print $1}' | grep $pid`" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
tput cnorm
}
# ERROR Report only in Developer Mode # ERROR Report only in Developer Mode
function error_report() { function error_report() {
echo "Error on line $1" echo "Error on line $1"
@ -243,22 +214,23 @@ fi
####################################### < Start > ###################################### ####################################### < Start > ######################################
if [ ! $FLUXIONDebug ]; then if [ ! $FLUXIONDebug ]; then
FLUXIONBanner=() FLUXIONBanner=()
format_center_literals " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals";
format_center_literals " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; format_center_literals " ⌠▓▒▓▒ ⌠▓╗ ⌠█┐ ┌█ ┌▓\ /▓┐ ⌠▓╖ ⌠◙▒▓▒◙ ⌠█\ ☒┐"; FLUXIONBanner+=("$FormatCenterLiterals");
format_center_literals " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; format_center_literals " ║▒_ │▒║ │▒║ ║▒ \▒\/▒/ │☢╫ │▒┌╤┐▒ ║▓▒\ ▓║"; FLUXIONBanner+=("$FormatCenterLiterals");
format_center_literals " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; format_center_literals " ≡◙◙ ║◙║ ║◙║ ║◙ ◙◙ ║¤▒ ║▓║☯║▓ ♜◙\✪\◙♜"; FLUXIONBanner+=("$FormatCenterLiterals");
format_center_literals " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; format_center_literals " ║▒ │▒║__ │▒└_┘▒ /▒/\▒\ │☢╫ │▒└╧┘▒ ║█ \▒█║"; FLUXIONBanner+=("$FormatCenterLiterals");
format_center_literals "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"; FLUXIONBanner[${#FLUXIONBanner[@]}]="$FormatCenterLiterals"; format_center_literals " ⌡▓ ⌡◘▒▓▒ ⌡◘▒▓▒◘ └▓/ \▓┘ ⌡▓╝ ⌡◙▒▓▒◙ ⌡▓ \▓┘"; FLUXIONBanner+=("$FormatCenterLiterals");
format_center_literals "¯¯¯ ¯¯¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯ ¯¯¯ ¯¯¯¯ ¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯"; FLUXIONBanner+=("$FormatCenterLiterals");
clear clear
if [ "$FLUXIONAuto" ] if [ "$FLUXIONAuto" ]
then echo -e "$CBlu" then echo -e "$CBlu"
else echo -e "$CRed" else echo -e "$CRed"
fi fi
for line in "${FLUXIONBanner[@]}"; do for line in "${FLUXIONBanner[@]}"
echo "$line"; sleep 0.05 do echo "$line"; sleep 0.05
done done
#echo "${FLUXIONBanner[@]}" #echo "${FLUXIONBanner[@]}"
echo echo
@ -270,84 +242,22 @@ if [ ! $FLUXIONDebug ]; then
format_center_literals "${CRed}FLUXION $CWht$FLUXIONVersion (rev. $CGrn$FLUXIONRevision$CWht)$CYel by$CWht ghost"; echo -e "$FormatCenterLiterals" format_center_literals "${CRed}FLUXION $CWht$FLUXIONVersion (rev. $CGrn$FLUXIONRevision$CWht)$CYel by$CWht ghost"; echo -e "$FormatCenterLiterals"
sleep 0.1 sleep 0.1
FLUXIONVNotice="Online Version" if installer_utils_check_update "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion.sh" "FLUXIONVersion=" "FLUXIONRevision=" $FLUXIONVersion $FLUXIONRevision
FLUXIONVNoticeOffset=$(($(tput cols) / 2 + ((${#FLUXIONVNotice} / 2) - 4))) then installer_utils_run_update "https://github.com/FluxionNetwork/fluxion/archive/master.zip" "FLUXION-V$FLUXIONVersion.$FLUXIONRevision" "`dirname "$FLUXIONPath"`"
printf "%${FLUXIONVNoticeOffset}s" "Online Version"
check_updates &
spinner "$!"
if [ -f "$FLUXIONWorkspacePath/latest_version" -a \
-s "$FLUXIONWorkspacePath/latest_version" ]; then
mapfile FLUXIONOnlineInfo < "$FLUXIONWorkspacePath/latest_version"
FLUXIONOnlineVersion=$(echo "${FLUXIONOnlineInfo[@]}" | awk -F= 'tolower($1)~/version/{print $2}')
FLUXIONOnlineRevision=$(echo "${FLUXIONOnlineInfo[@]}" | awk -F= 'tolower($1)~/revision/{print $2}')
else
FLUXIONOnlineVersion="?"
FLUXIONOnlineRevision="?"
fi fi
echo -e "$CClr [$CPrp$FLUXIONOnlineVersion.$FLUXIONOnlineRevision$CClr]"
if [ ! -z "${FLUXIONOnlineVersion[@]}" -a \
"$FLUXIONOnlineVersion" != "?" -a \
"$FLUXIONOnlineRevision" != "?" ]; then
if [ "$FLUXIONOnlineVersion" -gt "$FLUXIONVersion" -o \
"$FLUXIONOnlineVersion" -eq "$FLUXIONVersion" -a \
"$FLUXIONOnlineRevision" -gt "$FLUXIONRevision" ]; then
echo
echo
echo -ne $CRed" New revision found! "$CYel
echo -ne "Update? [Y/n]: "$CClr
read -N1 doupdate
echo -ne "$CClr"
doupdate=${doupdate:-"Y"}
if [ "$doupdate" = "Y" ]; then
cp $0 $HOME/flux_rev-$FLUXIONRevision.backup
curl "https://raw.githubusercontent.com/FluxionNetwork/fluxion/master/fluxion" -s -o $0
echo
echo
echo -e ""$CRed"Updated successfully! Restarting the script to apply the changes ..."$CClr""
sleep 3
chmod +x $0
exec $0
exit
fi
fi
fi
echo echo
sleep 1 FLUXIONCLIToolsRequired=("aircrack-ng" "awk:awk|gawk|mawk" "curl" "dhcpd:isc-dhcp-server" "hostapd" "lighttpd" "iwconfig:wireless-tools" "macchanger" "mdk3" "nmap" "openssl" "php-cgi" "pyrit" "xterm" "rfkill" "unzip" "route:net-tools" "fuser:psmisc" "killall:psmisc")
FLUXIONCLIToolsMissing=()
while ! installer_utils_check_dependencies FLUXIONCLIToolsRequired[@]
do installer_utils_run_dependencies InstallerUtilsCheckDependencies[@]
done
fi fi
################################### < Dependencies > ###################################
function check_dependencies() {
local CLITools=("aircrack-ng" "aireplay-ng" "airmon-ng" "airodump-ng" "airbase-ng" "awk" "curl" "dhcpd" "hostapd" "iwconfig" "lighttpd" "macchanger" "mdk3" "nmap" "php-cgi" "pyrit" "xterm" "openssl" "rfkill" "fuser")
local CLIToolsMissing
for CLITool in ${CLITools[*]}; do
# Could use parameter replacement, but requires extra variable.
local toolIdentifier=$(printf "%-44s" "$CLITool" | sed 's/ /./g')
local toolState=$(! hash $CLITool 2>/dev/null && echo "$CRed Missing!$CClr" || echo ".....$CGrn OK.$CClr")
CLIToolsMissing=$([[ "$toolState" = *"Missing"* ]] && echo true)
format_center_literals "$FLUXIONVLine $toolIdentifier$toolState"
echo -e "$FormatCenterLiterals"
done
if [ "$CLIToolsMissing" ]; then
echo
format_center_literals "${CRed}Stopping due to a lack of dependencies!"; echo -e "$FormatCenterLiterals"
echo
exit 1
fi
sleep 1
}
#################################### < Resolution > #################################### #################################### < Resolution > ####################################
# Windows + Resolution function set_resolution() { # Windows + Resolution
function set_resolution() {
function resA() { function resA() {
TOPLEFT="-geometry 90x13+0+0" TOPLEFT="-geometry 90x13+0+0"
TOPRIGHT="-geometry 83x26-0+0" TOPRIGHT="-geometry 83x26-0+0"
@ -1068,7 +978,6 @@ function run_attack() {
} }
################################### < FLUXION Loop > ################################### ################################### < FLUXION Loop > ###################################
check_dependencies
set_resolution set_resolution
set_language set_language

16
lib/ColorUtils.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
SandboxUtilsVersion="1.0"
################################# < Shell Color Codes > ################################
readonly CRed="\e[1;31m"
readonly CGrn="\e[1;32m"
readonly CYel="\e[1;33m"
readonly CBlu="\e[1;34m"
readonly CPrp="\e[5;35m"
readonly CCyn="\e[5;36m"
readonly CGry="\e[0;37m"
readonly CWht="\e[1;37m"
readonly CClr="\e[0m"
# FLUXSCRIPT END

View File

@ -0,0 +1,226 @@
#!/bin/bash
#if [ "$InstallerUtilsVersion" ]; then return 0; fi
# readonly InstallerUtilsVersion="1.0"
InstallerUtilsWorkspacePath="/tmp/verspace"
InstallerUtilsOutputDevice="/dev/stdout"
InstallerUtilsNoticeMark="*"
PackageManagerLog="$InstallerUtilsWorkspacePath/package_manager.log"
function installer_utils_run_spinner() {
local pid=$1
local delay=0.15
local spinstr='|/-\'
tput civis
while [ "`ps a | awk '{print $1}' | grep $pid`" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
tput cnorm
}
# Pamaters:
# $1 source - Online Info File (text)
# $2 version regex - Online version (regex)
# $3 revision regex - Online version (regex)
function installer_utils_check_version() {
if [ ${#@} -ne 3 ]; then return 1; fi
# Attempt to retrieve versioning information from repository script.
local -r __installer_utils_check_version__info=("`timeout -s SIGTERM 20 curl "$1" 2> /dev/null`")
local -r __installer_utils_check_version__onlineVersion=$(echo "${__installer_utils_check_version__info[@]}" | egrep "$2" | egrep -o "[0-9]+")
local -r __installer_utils_check_version__onlineRevision=$(echo "${__installer_utils_check_version__info[@]}" | egrep "$3" | egrep -o "[0-9]+")
if [ "$__installer_utils_check_version__onlineVersion" ] && [ "$__installer_utils_check_version__onlineRevision" ]
then echo -e "$__installer_utils_check_version__onlineVersion\n$__installer_utils_check_version__onlineRevision" > "$InstallerUtilsWorkspacePath/latest_version"
fi
}
# Pamaters:
# $1 source - Online Info File (text)
# $2 version regex - Online version (regex)
# $3 version local - Local version (number)
# $4 revision regex - Online version (regex)
# $5 revision local - Local version (number)
function installer_utils_check_update() {
# The following set of statements aren't very generic, need to be refactored.
local versionDialog="Online Version"
local versionDialogOffset=$(($(tput cols) / 2 + ((${#versionDialog} / 2) - 4)))
printf "%${versionDialogOffset}s" "$versionDialog"
installer_utils_check_version "${@:1:3}" &
installer_utils_run_spinner "$!" # This should be done externally (refactored).
local __installer_utils_check_update__localVersion=$4
local __installer_utils_check_update__localRevision=$5
local __installer_utils_check_update__version="?"
local __installer_utils_check_update__revision="?"
if [ -f "$InstallerUtilsWorkspacePath/latest_version" -a \
-s "$InstallerUtilsWorkspacePath/latest_version" ]; then
local __installer_utils_check_update__vInfo
mapfile -tn 2 __installer_utils_check_update__vInfo < "$InstallerUtilsWorkspacePath/latest_version"
sandbox_remove_workfile "$InstallerUtilsWorkspacePath/latest_version"
__installer_utils_check_update__version=${__installer_utils_check_update__vInfo[0]}
__installer_utils_check_update__revision=${__installer_utils_check_update__vInfo[1]}
fi
echo -e "$CClr [$__installer_utils_check_update__version.$__installer_utils_check_update__revision$CClr]"
if [ "$__installer_utils_check_update__version" != "?" -a "$__installer_utils_check_update__revision" != "?" ]; then
if [ "$__installer_utils_check_update__version" -gt "$__installer_utils_check_update__localVersion" -o \
"$__installer_utils_check_update__version" -eq "$__installer_utils_check_update__localRevision" -a \
"$__installer_utils_check_update__revision" -gt "$__installer_utils_check_update__localRevision" ]; then
format_center_literals "${CRed}A newer version has been found!$CClr"
return 0
fi
fi
return 1 # Failure
}
# Parameters: $1 - Update source (zip) $2 - Backup file name $3 - Update output
function installer_utils_run_update() {
if [ ${#@} -ne 2 ]; then return 1; fi
local __installer_utils_run_update__source="$1"
local __installer_utils_run_update__backup="$2"
local __installer_utils_run_update__output="$3"
format_center_literals "${CYel}[ Press Y or enter to update, anything else to skip ]$CClr"
tput civis
local __installer_utils_run_update__option
read -N1 __installer_utils_run_update__option
tput cnorm
__installer_utils_run_update__option=${__installer_utils_run_update__option:-Y}
# If the user doesn't want to upgrade, stop this procedure.
if [ "$__installer_utils_run_update__option" != "Y" -a \
"$__installer_utils_run_update__option" != "y" ]
then return 1
fi
local __installer_utils_run_update__backupFile="$__installer_utils_run_update__backup-`date +%F_%T`"
local __installer_utils_run_update__backupPath="`dirname $__installer_utils_run_update__output`/$__installer_utils_run_update__backupFile.7z"
# If a file with the backup name already exists, abort.
if [ -f "$__installer_utils_run_update__backupPath" ]
then return 2
fi
format_center_literals "${CClr}[ ~ Creating Backup ~ ]$CClr"; echo
# This could use a progress indicator, but I'm a bit tired.
7zr a "$__installer_utils_run_update__backupPath" "$__installer_utils_run_update__output" &> $InstallerUtilsOutputDevice
format_center_literals "${CClr}[ ~ Downloading Update ~ ]$CClr"; echo
if ! curl -L "$__installer_utils_run_update__source" -o "$InstallerUtilsWorkspacePath/update.zip"; then
format_center_literals "${CRed}[ ~ Download Failed ~ ]$CClr"
sleep 3
return 3
fi
format_center_literals "${CClr}[ ~ Verifying Download ~ ]$CClr"; echo
if ! unzip -t "$InstallerUtilsWorkspacePath/update.zip"; then
format_center_literals "${CRed}[ ~ Download Appears Corrupted ~ ]$CClr"
sleep 3
return 4
fi
format_center_literals "${CClr}[ ~ Extracting Files ~ ]$CClr"; echo
mkdir "$InstallerUtilsWorkspacePath/update_contents"
unzip "$InstallerUtilsWorkspacePath/update.zip" -d "$InstallerUtilsWorkspacePath/update_contents"
if [ ! -d "$__installer_utils_run_update__output" ]; then
if ! mkdir -p "$__installer_utils_run_update__output"; then
format_center_literals "${CRed}[ ~ Failed To Create Destination Directory ~ ]$CClr"; echo
fi
fi
format_center_literals "${CClr}[ ~ Moving Files ~ ]$CClr"; echo
mv "$InstallerUtilsWorkspacePath"/update_contents/* "$__installer_utils_run_update__output"
format_center_literals "${CGrn}[ ~ Update Completed ~ ]$CClr"; echo
sleep 3
}
# Parameters: $1 - CLI Tools required array $2 - CLI Tools missing array (will be populated)
function installer_utils_check_dependencies() {
if [ ! "$1" ]; then return 1; fi
local __installer_utils_run_dependencies__CLIToolsInfo=("${!1}")
InstallerUtilsCheckDependencies=()
local __installer_utils_run_dependencies__CLIToolInfo
for __installer_utils_run_dependencies__CLIToolInfo in "${__installer_utils_run_dependencies__CLIToolsInfo[@]}"; do
local __installer_utils_run_dependencies__CLITool=${__installer_utils_run_dependencies__CLIToolInfo/:*/}
local __installer_utils_run_dependencies__identifier="`printf "%-44s" "$__installer_utils_run_dependencies__CLITool"`"
local __installer_utils_run_dependencies__state=".....$CGrn OK.$CClr"
if ! hash "$__installer_utils_run_dependencies__CLITool" 2>/dev/null; then
__installer_utils_run_dependencies__state="$CRed Missing!$CClr"
InstallerUtilsCheckDependencies+=("$__installer_utils_run_dependencies__CLIToolInfo")
fi
format_center_literals "$InstallerUtilsNoticeMark ${__installer_utils_run_dependencies__identifier// /.}$__installer_utils_run_dependencies__state"
echo -e "$FormatCenterLiterals"
done
if [ ${#InstallerUtilsCheckDependencies[@]} -gt 0 ]; then return 2; fi
}
# Parameters: $1 - CLI Tools missing array (will be installed) $2 - substitutes array
function installer_utils_run_dependencies() {
if [ ! "$1" ]; then return 1; fi
# The array below holds all the packages that will be installed.
local __installer_utils_run_dependencies__dependenciesInfo=("${!1}")
local __installer_utils_run_dependencies__managers=(lib/installer/managers/*)
local __installer_utils_run_dependencies__manager
for __installer_utils_run_dependencies__manager in "${__installer_utils_run_dependencies__managers[@]}"; do
source "$__installer_utils_run_dependencies__manager"
if [ "$PackageManagerCLT" ]; then break; fi
done
if [ ! "$PackageManagerCLT" ]; then
format_center_literals "${CRed}[ ~ No Suitable Package Manager Found ~ ]$CClr"; echo
sleep 3
return 2
fi
prep_package_manager
for __installer_utils_run_dependencies__dependencyInfo in "${__installer_utils_run_dependencies__dependenciesInfo[@]}"; do
local __installer_utils_run_dependencies__target=${__installer_utils_run_dependencies__dependencyInfo/:*/}
local __installer_utils_run_dependencies__packages=${__installer_utils_run_dependencies__dependencyInfo/*:/}
for __installer_utils_run_dependencies__package in ${__installer_utils_run_dependencies__packages//|/ }; do
clear
if $PackageManagerCLT $PackageManagerCLTInstallOptions $__installer_utils_run_dependencies__package
then break
fi
done
done
unprep_package_manager
}
# FLUXSCRIPT END

View File

@ -0,0 +1,33 @@
#!/bin/bash
if [ -f "/etc/debian_version" ]; then
PackageManagerCLT="apt"
PackageManagerCLTInstallOptions="install -y"
PackageManagerCLTRemoveOptions="remove -y"
PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() {
echo "`cat /etc/apt/sources.list | grep -v 'deb http://http.kali.org/kali kali-rolling main non-free contrib # Installed By FLUXION'`" > /etc/apt/sources.list
}
function prep_package_manager() {
if [ ! "`cat /etc/apt/sources.list | egrep 'deb http://http.kali.org/kali ((kali-rolling|main|contrib|non-free) )*'`" ]; then
echo "Doesn't have kali..."
gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6
apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib # Installed By FLUXION" >> /etc/apt/sources.list
fi
# Cleanup package manager
sudo apt-get install -f -y | tee -a $PackageManagerLog
sudo apt-get autoremove -y | tee -a $PackageManagerLog
sudo apt-get autoclean -y | tee -a $PackageManagerLog
sudo apt-get clean -y | tee -a $PackageManagerLog
sudo apt-get update | tee -a $PackageManagerLog
}
fi
# FLUXSCRIPT END

View File

@ -0,0 +1,21 @@
#!/bin/bash
if [ -f "/etc/gentoo-release" ]; then
PackageManagerCLT="emerge"
PackageManagerCLTInstallOptions="-s"
PackageManagerCLTRemoveOptions=""
PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() {
echo "Nothing to unprepare." > $PackageManagerOutputDevice
}
function prep_package_manager() {
echo "Nothing to prepare." > $PackageManagerOutputDevice
}
fi
# FLUXSCRIPT END

View File

@ -0,0 +1,21 @@
#!/bin/bash
if [ -f "/etc/arch-release" ]; then
PackageManagerCLT="pacman"
PackageManagerCLTInstallOptions="-S -y"
PackageManagerCLTRemoveOptions="-Rs"
PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() {
echo "Nothing to unprepare." > $PackageManagerOutputDevice
}
function prep_package_manager() {
echo "Nothing to prepare." > $PackageManagerOutputDevice
}
fi
# FLUXSCRIPT END

View File

@ -0,0 +1,21 @@
#!/bin/bash
if [ -f "/etc/redhat-release" ]; then
PackageManagerCLT="yum"
PackageManagerCLTInstallOptions="-y install"
PackageManagerCLTRemoveOptions="remove"
PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() {
echo "Nothing to unprepare." > $PackageManagerOutputDevice
}
function prep_package_manager() {
echo "Nothing to prepare." > $PackageManagerOutputDevice
}
fi
# FLUXSCRIPT END

View File

@ -0,0 +1,21 @@
#!/bin/bash
if [ -f "/etc/SuSE-release" ]; then
PackageManagerCLT="zypp"
PackageManagerCLTInstallOptions="install"
PackageManagerCLTRemoveOptions="remove"
PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() {
echo "Nothing to unprepare." > $PackageManagerOutputDevice
}
function prep_package_manager() {
echo "Nothing to prepare." > $PackageManagerOutputDevice
}
fi
# FLUXSCRIPT END