Fix load_attack config corruption, allow --list-interfaces without root

- Replace more with direct redirection in load_attack (Handshake Snooper
  and Captive Portal): more adds 3 header lines when stdout is a pipe,
  shifting all config array indices by +3 and corrupting the deauth method,
  jammer interface, and verifier settings on second and subsequent runs
- Apply the same fix to fluxion_handle_target_change, which read
  target_info.txt through more causing MAC/SSID/channel corruption on
  tracker-triggered restarts
- Allow --list-interfaces to run without root: all operations are read-only
  sysfs/lsusb/lspci/iw queries that need no elevated privileges
- Skip preferences file load/create when not root to avoid permission errors
  on the root-owned preferences.conf
This commit is contained in:
strasharo 2026-02-21 14:15:33 +02:00
parent 079f4988a5
commit cdacff38e1
3 changed files with 12 additions and 10 deletions

View File

@ -1363,7 +1363,7 @@ load_attack() {
local -r configurationPath=$1
local configuration
readarray -t configuration < <(more "$configurationPath")
readarray -t configuration < "$configurationPath"
CaptivePortalJammerInterfaceOriginal=${configuration[0]}
CaptivePortalAccessPointInterfaceOriginal=${configuration[1]}

View File

@ -541,7 +541,7 @@ load_attack() {
local -r configurationPath=$1
local configuration
readarray -t configuration < <(more "$configurationPath")
readarray -t configuration < "$configurationPath"
HandshakeSnooperDeauthenticatorIdentifier=${configuration[0]}
HandshakeSnooperJammerInterfaceOriginal=${configuration[1]}

View File

@ -22,7 +22,7 @@ readonly FLUXIONNoiseFloor=-90
readonly FLUXIONNoiseCeiling=-60
readonly FLUXIONVersion=6
readonly FLUXIONRevision=22
readonly FLUXIONRevision=23
# Declare window ration bigger = smaller windows
FLUXIONWindowRatio=4
@ -53,7 +53,7 @@ for arg in "$@"; do
esac
done
if [ $EUID -ne 0 ] && [ ! "$FLUXIONPreParseHelp" ]; then
if [ $EUID -ne 0 ] && [ ! "$FLUXIONPreParseHelp" ] && [ ! "$FLUXIONPreParseListIfaces" ]; then
echo -e "\\033[31mAborted, please execute the script as root.\\033[0m"; exit 1
fi
@ -198,11 +198,13 @@ shift # Remove "--" to prepare for attacks to read parameters.
# Load user-defined preferences if there's an executable script.
# If no script exists, prepare one for the user to store config.
# WARNING: Preferences file must assure no redeclared constants.
if [ -x "$FLUXIONPreferencesFile" ]; then
source "$FLUXIONPreferencesFile"
else
echo '#!/usr/bin/env bash' > "$FLUXIONPreferencesFile"
chmod u+x "$FLUXIONPreferencesFile"
if [ $EUID -eq 0 ]; then
if [ -x "$FLUXIONPreferencesFile" ]; then
source "$FLUXIONPreferencesFile"
else
echo '#!/usr/bin/env bash' > "$FLUXIONPreferencesFile"
chmod u+x "$FLUXIONPreferencesFile"
fi
fi
# ================ < Configurable Constants > ================ #
@ -656,7 +658,7 @@ fluxion_handle_target_change() {
echo "Target change signal received!" > $FLUXIONOutputDevice
local targetInfo
readarray -t targetInfo < <(more "$FLUXIONWorkspacePath/target_info.txt")
readarray -t targetInfo < "$FLUXIONWorkspacePath/target_info.txt"
FluxionTargetMAC=${targetInfo[0]}
FluxionTargetSSID=${targetInfo[1]}