From 68a90dc684049c3f0c3d474ffc686f5b64937534 Mon Sep 17 00:00:00 2001 From: deltaxflux Date: Wed, 30 May 2018 00:38:10 +0200 Subject: [PATCH 1/2] Fix installer loop #523 --- lib/InterfaceUtils.sh | 8 ++++---- lib/installer/InstallerUtils.sh | 18 ++++++++++-------- lib/installer/managers/apt.sh | 4 ++++ lib/installer/managers/emerge.sh | 4 ++++ lib/installer/managers/pacman.sh | 4 ++++ lib/installer/managers/yum.sh | 4 ++++ lib/installer/managers/zypp.sh | 4 ++++ 7 files changed, 34 insertions(+), 12 deletions(-) diff --git a/lib/InterfaceUtils.sh b/lib/InterfaceUtils.sh index 1d8f3ba..8ed1da8 100755 --- a/lib/InterfaceUtils.sh +++ b/lib/InterfaceUtils.sh @@ -162,18 +162,18 @@ function interface_set_mode() { function interface_reidentify() { if [ ${#@} -ne 2 ]; then return 1; fi - + local -r __interface_reidentify__oldIdentifier=$1 local -r __interface_reidentify__newIdentifier=$2 - + if [[ $__interface_reidentify__newIdentifier == *" "* ]] then return 2 fi - + if ! interface_set_state $__interface_reidentify__oldIdentifier down then return 3 fi - + # TODO: Add alternatives to 'ip' in case of failure. ip link set $__interface_reidentify__oldIdentifier name $__interface_reidentify__newIdentifier return $? diff --git a/lib/installer/InstallerUtils.sh b/lib/installer/InstallerUtils.sh index 6a6978b..3e02823 100755 --- a/lib/installer/InstallerUtils.sh +++ b/lib/installer/InstallerUtils.sh @@ -210,7 +210,6 @@ function installer_utils_check_dependencies() { 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")" @@ -236,8 +235,7 @@ function installer_utils_run_dependencies() { echo -e "\n\n$FormatCenterLiterals" format_center_literals "[ ${CSRed}CANNOT CONTINUE${CClr} ]" - echo -e "$FormatCenterLiterals" - sleep 5 + echo -e "$FormatCenterLiterals"; sleep 3 return 3 fi @@ -254,21 +252,25 @@ function installer_utils_run_dependencies() { done if [ ! "$PackageManagerCLT" ]; then - format_center_literals "${CRed}[ ~ No Suitable Package Manager Found ~ ]$CClr" - echo + format_center_literals "${CRed}[ ~ No Suitable Package Manager Found ~ ]$CClr";echo sleep 3 return 2 fi + check_package_manager 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/*:/} + + k=${#__installer_utils_run_dependencies__packages[@]};i=1 + 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 + clear + if $PackageManagerCLT $PackageManagerCLTInstallOptions $__installer_utils_run_dependencies__package; then break; fi + if [ $k -eq $i ];then clear; echo -e "[\033[31m!\033[0m] Can't install all dependencies, quitting..."; sleep 2; fluxion_shutdown; fi + i=$(echo $(($i+1))) done done diff --git a/lib/installer/managers/apt.sh b/lib/installer/managers/apt.sh index 5128f81..4b6a456 100755 --- a/lib/installer/managers/apt.sh +++ b/lib/installer/managers/apt.sh @@ -13,6 +13,10 @@ if [ -f "/etc/debian_version" ]; then 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 } + check_package_manager() { + echo "Nothing to check." >$PackageManagerOutputDevice + } + prep_package_manager() { if [ ! "$(cat /etc/apt/sources.list | egrep 'deb http://http.kali.org/kali ((kali-rolling|main|contrib|non-free) )*')" ]; then echo "Adding missing sources to package manager, please wait." diff --git a/lib/installer/managers/emerge.sh b/lib/installer/managers/emerge.sh index 9ca53f2..1c2aa54 100755 --- a/lib/installer/managers/emerge.sh +++ b/lib/installer/managers/emerge.sh @@ -13,6 +13,10 @@ if [ -f "/etc/gentoo-release" ]; then echo "Nothing to unprepare." >$PackageManagerOutputDevice } + check_package_manager() { + echo "Nothing to check." >$PackageManagerOutputDevice + } + prep_package_manager() { echo "Nothing to prepare." >$PackageManagerOutputDevice } diff --git a/lib/installer/managers/pacman.sh b/lib/installer/managers/pacman.sh index 76f5de2..d79510a 100755 --- a/lib/installer/managers/pacman.sh +++ b/lib/installer/managers/pacman.sh @@ -21,6 +21,10 @@ if [ -f "/etc/arch-release" ]; then echo "Nothing to unprepare." >$PackageManagerOutputDevice } + check_package_manager() { + if [ -f "/var/lib/pacman/db.lck" ];then echo -e "[\033[31m!\033[0m] Pacman is locked, can't install dependencies. Exit."; exit 4; fi + } + prep_package_manager() { echo "Nothing to prepare." >$PackageManagerOutputDevice } diff --git a/lib/installer/managers/yum.sh b/lib/installer/managers/yum.sh index 3d21f3c..ad15f3a 100755 --- a/lib/installer/managers/yum.sh +++ b/lib/installer/managers/yum.sh @@ -13,6 +13,10 @@ if [ -f "/etc/redhat-release" ]; then echo "Nothing to unprepare." >$PackageManagerOutputDevice } + check_package_manager () { + echo "Nothing to check." >$PackageManagerOutputDevice + } + prep_package_manager() { echo "Nothing to prepare." >$PackageManagerOutputDevice } diff --git a/lib/installer/managers/zypp.sh b/lib/installer/managers/zypp.sh index c3b8810..071a07a 100755 --- a/lib/installer/managers/zypp.sh +++ b/lib/installer/managers/zypp.sh @@ -13,6 +13,10 @@ if [ -f "/etc/SuSE-release" ]; then echo "Nothing to unprepare." >$PackageManagerOutputDevice } + check_package_manager() { + echo "Nothing to check." >$PackageManagerOutputDevice + } + prep_package_manager() { echo "Nothing to prepare." >$PackageManagerOutputDevice } From 0523d1f6d64a7e0a2c04b95a6bba7084956ea2ae Mon Sep 17 00:00:00 2001 From: deltaxflux Date: Wed, 30 May 2018 00:47:13 +0200 Subject: [PATCH 2/2] Allow to skip dependencies if required with --skip-dependencies --- fluxion.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fluxion.sh b/fluxion.sh index b4f704a..de677b9 100755 --- a/fluxion.sh +++ b/fluxion.sh @@ -27,6 +27,9 @@ readonly FLUXIONRevision=11 # Declare window ration bigger = smaller windows FLUXIONWindowRatio=4 +# Allow to skip dependencies if required, not recommended +FLUXIONSkipDependencies=0 + # ============================================================ # # ================= < Script Sanity Checks > ================= # # ============================================================ # @@ -80,7 +83,7 @@ source "$FLUXIONPath/lib/Help.sh" # ============================================================ # if ! FLUXIONCLIArguments=$( getopt --options="vdkrnmtbhe:c:l:a:r" \ - --longoptions="debug,version,killer,reloader,help,airmon-ng,multiplexer,target,test,auto,bssid:,essid:,channel:,language:,attack:,ratio:" \ + --longoptions="debug,version,killer,reloader,help,airmon-ng,multiplexer,target,test,auto,bssid:,essid:,channel:,language:,attack:,ratio,skip-dependencies" \ --name="FLUXION V$FLUXIONVersion.$FLUXIONRevision" -- "$@" ); then echo -e "${CRed}Aborted$CClr, parameter error detected..."; exit 5 @@ -120,6 +123,7 @@ while [ "$1" != "" -a "$1" != "--" ]; do -a|--attack) FluxionAttack=$2; shift;; --ratio) FLUXIONWindowRatio=$2; shift;; --auto) readonly FLUXIONAuto=1;; + --skip-dependencies) readonly FLUXIONSkipDependencies=1;; esac shift # Shift new parameters done @@ -274,9 +278,11 @@ fluxion_startup() { "fuser:psmisc" "killall:psmisc" ) - while ! installer_utils_check_dependencies requiredCLITools[@]; do - installer_utils_run_dependencies InstallerUtilsCheckDependencies[@] - done + if [ $FLUXIONSkipDependencies != 1 ];then + while ! installer_utils_check_dependencies requiredCLITools[@]; do + installer_utils_run_dependencies InstallerUtilsCheckDependencies[@] + done + fi echo -e "\n\n" # This echo is for spacing }