Added tracker selection, and other minor bug fixes.

Added tracker selection to fluxion, querying an interface for tracking.
Fixed a bug where auto-mode was activating on manual mode (no flags).
Added skip option to the generic interface selection function.
Reidentified some targetting subroutines following the convention.
Corrected an outdated language global.
Added the general skip option.
This commit is contained in:
Matias Barcenas 2018-01-20 16:06:45 -06:00
parent 26ecea2a51
commit 488a850162
4 changed files with 183 additions and 102 deletions

View File

@ -1201,6 +1201,15 @@ attack_targetting_interfaces() {
done done
} }
attack_tracking_interfaces() {
interface_list_wireless
local interface
for interface in "${InterfaceListWireless[@]}"; do
echo "$interface"
done
echo "" # This enables the Skip option.
}
unprep_attack() { unprep_attack() {
CaptivePortalState="Not Ready" CaptivePortalState="Not Ready"

View File

@ -3,7 +3,7 @@
# description: Creates an "evil twin" access point. # description: Creates an "evil twin" access point.
CaptivePortalJammerInterfaceQuery="Select an interface for jamming." CaptivePortalJammerInterfaceQuery="Select an interface for jamming."
CaptivePortalAPInterfaceQuery="Select an interface for the access point." CaptivePortalAccessPointInterfaceQuery="Select an interface for the access point."
CaptivePortalAPServiceQuery="Select an access point service" CaptivePortalAPServiceQuery="Select an access point service"
CaptivePortalAPServiceHostapdOption="Rogue AP - hostapd (${CGrn}recommended$CClr)" CaptivePortalAPServiceHostapdOption="Rogue AP - hostapd (${CGrn}recommended$CClr)"

271
fluxion
View File

@ -96,7 +96,7 @@ declare -r FLUXIONCLIArguments=${FLUXIONCLIArguments%%--*}
# ============= < Argument Loaded Configurables > ============ # # ============= < Argument Loaded Configurables > ============ #
eval set -- "$FLUXIONCLIArguments" # Set environment parameters. eval set -- "$FLUXIONCLIArguments" # Set environment parameters.
[ "$1" != "--" ] && declare -r FLUXIONAuto=1 # Auto-mode if using CLI. [ "$1" != "" ] && declare -r FLUXIONAuto=1 # Auto-mode if using CLI.
while [ "$1" != "" -a "$1" != "--" ]; do while [ "$1" != "" -a "$1" != "--" ]; do
case "$1" in case "$1" in
@ -865,7 +865,7 @@ fluxion_allocate_interface() { # Reserve interfaces
# as the key for the global FluxionInterfaces hash/map/dictionary. # as the key for the global FluxionInterfaces hash/map/dictionary.
} }
# Parameters: <interfaces:lambda> # Parameters: <interfaces:lambda> [<query>]
# Note: The interfaces lambda must print an interface per line. # Note: The interfaces lambda must print an interface per line.
# ------------------------------------------------------------ # # ------------------------------------------------------------ #
# Return -1: Go back # Return -1: Go back
@ -880,30 +880,35 @@ fluxion_get_interface() {
fi fi
while true; do while true; do
local interfacesAvailable local candidateInterfaces
readarray -t interfacesAvailable < <($1) readarray -t candidateInterfaces < <($1)
local interfacesAvailable=()
local interfacesAvailableInfo=() local interfacesAvailableInfo=()
local interfacesAvailableColor=() local interfacesAvailableColor=()
local interfacesAvailableState=() local interfacesAvailableState=()
# Gather information from all available interfaces. # Gather information from all available interfaces.
local interfacesAvailableCount=${#interfacesAvailable[@]} local candidateInterface
for candidateInterface in "${candidateInterfaces[@]}"; do
if [ ! "$candidateInterface" ]; then
local skipOption=1
continue
fi
local i interface_chipset "$candidateInterface"
for (( i = 0; i < interfacesAvailableCount; i++ )); do
local interfaceCandidate=${interfacesAvailable[i]}
interface_chipset "$interfaceCandidate"
interfacesAvailableInfo+=("$InterfaceChipset") interfacesAvailableInfo+=("$InterfaceChipset")
# If it has already been allocated, we can use it at will. # If it has already been allocated, we can use it at will.
local interfaceCandidateAlt=${FluxionInterfaces["$interfaceCandidate"]} local candidateInterfaceAlt=${FluxionInterfaces["$candidateInterface"]}
if [ "$interfaceCandidateAlt" ]; then if [ "$candidateInterfaceAlt" ]; then
interfacesAvailable[$i]=$interfaceCandidateAlt interfacesAvailable+=("$candidateInterfaceAlt")
interfacesAvailableColor+=("$CGrn") interfacesAvailableColor+=("$CGrn")
interfacesAvailableState+=("[*]") interfacesAvailableState+=("[*]")
else else
interface_state "$interfaceCandidate" interfacesAvailable+=("$candidateInterface")
interface_state "$candidateInterface"
if [ "$InterfaceState" = "up" ]; then if [ "$InterfaceState" = "up" ]; then
interfacesAvailableColor+=("$CPrp") interfacesAvailableColor+=("$CPrp")
@ -917,20 +922,26 @@ fluxion_get_interface() {
# If only one interface exists and it's not unavailable, choose it. # If only one interface exists and it's not unavailable, choose it.
if [ "${#interfacesAvailable[@]}" -eq 1 -a \ if [ "${#interfacesAvailable[@]}" -eq 1 -a \
"${interfacesAvailableState[0]}" != "[-]" ]; then "${interfacesAvailableState[0]}" != "[-]" -a \
"$skipOption" == "" ]; then
FluxionInterfaceSelected="${interfacesAvailable[0]}" FluxionInterfaceSelected="${interfacesAvailable[0]}"
FluxionInterfaceSelectedState="${interfacesAvailableState[0]}" FluxionInterfaceSelectedState="${interfacesAvailableState[0]}"
FluxionInterfaceSelectedInfo="${interfacesAvailableInfo[0]}" FluxionInterfaceSelectedInfo="${interfacesAvailableInfo[0]}"
break break
else else
interfacesAvailable+=( \ if [ $skipOption ]; then
"$FLUXIONGeneralRepeatOption" \ interfacesAvailable+=("$FLUXIONGeneralSkipOption")
"$FLUXIONGeneralBackOption" \ interfacesAvailableColor+=("$CClr")
fi
interfacesAvailable+=(
"$FLUXIONGeneralRepeatOption"
"$FLUXIONGeneralBackOption"
) )
interfacesAvailableColor+=( \ interfacesAvailableColor+=(
"$CClr" \ "$CClr"
"$CClr" \ "$CClr"
) )
format_apply_autosize \ format_apply_autosize \
@ -944,6 +955,11 @@ fluxion_get_interface() {
echo echo
case "${IOQueryFormatFields[1]}" in case "${IOQueryFormatFields[1]}" in
"$FLUXIONGeneralSkipOption")
FluxionInterfaceSelected=""
FluxionInterfaceSelectedState=""
FluxionInterfaceSelectedInfo=""
return 0;;
"$FLUXIONGeneralRepeatOption") continue;; "$FLUXIONGeneralRepeatOption") continue;;
"$FLUXIONGeneralBackOption") return -1;; "$FLUXIONGeneralBackOption") return -1;;
*) *)
@ -1201,6 +1217,121 @@ fluxion_target_show() {
echo echo
} }
fluxion_target_unset_tracker() {
if [ ! "$FluxionTargetTrackerInterface" ]; then return 1; fi
FluxionTargetTrackerInterface=""
}
fluxion_target_set_tracker() {
if [ "$FluxionTargetTrackerInterface" ]; then return 0; fi
# Check if attack provides tracking interfaces, get & set one.
if ! type -t attack_tracking_interfaces &> /dev/null; then
return 1
fi
if [ "$FluxionTargetTrackerInterface" == "" -a ! "$FLUXIONAuto" ]; then
echo "Running get interface (tracker)." > $FLUXIONOutputDevice
if ! fluxion_get_interface attack_tracking_interfaces \
"$FLUXIONTargetTrackerInterfaceQuery"; then
echo "Failed to get tracker interface!" > $FLUXIONOutputDevice
return 2
fi
local selectedInterface=$FluxionInterfaceSelected
else
local selectedInterface=$FluxionTargetTrackerInterface
fi
# If user skipped a tracker interface, move on.
if [ ! "$selectedInterface" ]; then
fluxion_target_unset_tracker
return 0
fi
if ! fluxion_allocate_interface $selectedInterface; then
echo "Failed to allocate tracking interface!" > $FLUXIONOutputDevice
return 3
fi
echo "Successfully got tracker interface." > $FLUXIONOutputDevice
FluxionTargetTrackerInterface=${FluxionInterfaces[$selectedInterface]}
}
fluxion_target_unset() {
FluxionTargetMAC=""
FluxionTargetSSID=""
FluxionTargetChannel=""
FluxionTargetEncryption=""
FluxionTargetMakerID=""
FluxionTargetMaker=""
FluxionTargetSSIDClean=""
FluxionTargetRogueMAC=""
return 1 # To trigger undo-chain.
}
fluxion_target_set() {
# Check if attack is targetted & set the attack target if so.
if ! type -t attack_targetting_interfaces &> /dev/null; then
return 1
fi
if [ \
"$FluxionTargetSSID" -a \
"$FluxionTargetMAC" -a \
"$FluxionTargetChannel" \
]; then
# If we've got a candidate target, ask user if we'll keep targetting it.
fluxion_header
fluxion_target_show
echo
echo -e "$FLUXIONVLine $FLUXIONTargettingAccessPointAboveNotice"
# TODO: This doesn't translate choices to the selected language.
while ! echo "$choice" | grep -q "^[ynYN]$" &> /dev/null; do
echo -ne "$FLUXIONVLine $FLUXIONContinueWithTargetQuery [Y/n] "
local choice
read choice
if [ ! "$choice" ]; then break; fi
done
echo -ne "\n\n"
if [ "${choice,,}" != "n" ]; then
return 0
fi
elif [ \
"$FluxionTargetSSID" -o \
"$FluxionTargetMAC" -o \
"$FluxionTargetChannel" \
]; then
# TODO: Survey environment here to autofill missing fields.
# In other words, if a user gives incomplete information, scan
# the environment based on either the ESSID or BSSID, & autofill.
echo -e "$FLUXIONVLine $FLUXIONIncompleteTargettingInfoNotice"
sleep 3
fi
if ! fluxion_get_interface attack_targetting_interfaces; then
return 2
fi
if ! fluxion_allocate_interface $FluxionInterfaceSelected; then
return 3
fi
if ! fluxion_get_target \
${FluxionInterfaces[$FluxionInterfaceSelected]}; then
return 4
fi
}
# =================== < Hash Subroutines > =================== # # =================== < Hash Subroutines > =================== #
# Parameters: <hash path> <bssid> <essid> [channel [encryption [maker]]] # Parameters: <hash path> <bssid> <essid> [channel [encryption [maker]]]
@ -1228,12 +1359,7 @@ fluxion_hash_verify() {
echo -e "$FLUXIONVLine $FLUXIONHashVerificationMethodQuery" echo -e "$FLUXIONVLine $FLUXIONHashVerificationMethodQuery"
echo echo
fluxion_target_show \ fluxion_target_show
"$hashESSID" \
"$hashEncryption" \
"$hashChannel" \
"$hashBSSID" \
"$hashMaker"
local choices=( \ local choices=( \
"$FLUXIONHashVerificationMethodPyritOption" \ "$FLUXIONHashVerificationMethodPyritOption" \
@ -1431,78 +1557,6 @@ fluxion_set_attack() {
FluxionAttack=${IOQueryFormatFields[0]} FluxionAttack=${IOQueryFormatFields[0]}
} }
fluxion_unset_attack_target() {
FluxionTargetMAC=""
FluxionTargetSSID=""
FluxionTargetChannel=""
FluxionTargetEncryption=""
FluxionTargetMakerID=""
FluxionTargetMaker=""
FluxionTargetSSIDClean=""
FluxionTargetRogueMAC=""
return 1 # To trigger undo-chain.
}
fluxion_set_attack_target() {
# Check if attack is targetted & set the attack target if so.
if ! type -t attack_targetting_interfaces &> /dev/null; then
return 1
fi
if [ \
"$FluxionTargetSSID" -a \
"$FluxionTargetMAC" -a \
"$FluxionTargetChannel" \
]; then
fluxion_header
fluxion_target_show
echo
echo -e "$FLUXIONVLine $FLUXIONTargettingAccessPointAboveNotice"
# TODO: This doesn't translate choices to the selected language.
while ! echo "$choice" | grep -q "^[ynYN]$" &> /dev/null; do
echo -ne "$FLUXIONVLine $FLUXIONContinueWithTargetQuery [Y/n] "
local choice
read choice
if [ ! "$choice" ]; then break; fi
done
echo -ne "\n\n"
if [ "${choice,,}" != "n" ]; then
return 0
fi
elif [ \
"$FluxionTargetSSID" -o \
"$FluxionTargetMAC" -o \
"$FluxionTargetChannel" \
]; then
# TODO: Survey environment here to autofill missing fields.
# In other words, if a user gives incomplete information, scan
# the environment based on either the ESSID or BSSID, & autofill.
echo -e "$FLUXIONVLine $FLUXIONIncompleteTargettingInfoNotice"
sleep 3
fi
if ! fluxion_get_interface attack_targetting_interfaces; then
return 2
fi
if ! fluxion_allocate_interface $FluxionInterfaceSelected; then
return 3
fi
if ! fluxion_get_target \
${FluxionInterfaces[$FluxionInterfaceSelected]}; then
return 4
fi
}
fluxion_unprep_attack() { fluxion_unprep_attack() {
if type -t unprep_attack &> /dev/null; then if type -t unprep_attack &> /dev/null; then
unprep_attack unprep_attack
@ -1536,10 +1590,25 @@ fluxion_prep_attack() {
# Check if attack is targetted & set the attack target if so. # Check if attack is targetted & set the attack target if so.
if type -t attack_targetting_interfaces &> /dev/null; then if type -t attack_targetting_interfaces &> /dev/null; then
if ! fluxion_set_attack_target; then return 3; fi if ! fluxion_target_set; then return 3; fi
fi fi
if ! prep_attack; then return 4; fi # Check if attack provides tracking interfaces, get & set one.
if type -t attack_tracking_interfaces &> /dev/null; then
if ! fluxion_target_set_tracker; then return 4; fi
# TODO: Remove this below after we've implemented tracking.
# I suggest we use airodump-ng, periodically checking by BSSID.
if [ "$FluxionTargetTrackerInterface" ]; then
fluxion_header
echo -e "$FLUXIONVLine Hold the hell up... that hasn't been implemented yet."
sleep 4
echo -e "$FLUXIONVLine We'll pretend you selected \"$FLUXIONGeneralSkipOption\"$CClr."
sleep 4
FluxionTargetTrackerInterface=""
fi
fi
if ! prep_attack; then return 5; fi
} }
fluxion_run_attack() { fluxion_run_attack() {

View File

@ -8,6 +8,8 @@ FLUXIONDeallocatingInterfaceNotice="Deallocating reserved interface $CGrn\"\$int
FLUXIONReidentifyingInterface="Renaming interface." FLUXIONReidentifyingInterface="Renaming interface."
FLUXIONUnblockingWINotice="Unblocking all wireless interfaces." FLUXIONUnblockingWINotice="Unblocking all wireless interfaces."
FLUXIONTargetTrackerInterfaceQuery="Select an interface for target tracking."
#FLUXIONFindingExtraWINotice="Looking for extraneous wireless interfaces..." #FLUXIONFindingExtraWINotice="Looking for extraneous wireless interfaces..."
FLUXIONRemovingExtraWINotice="Removing extraneous wireless interfaces..." FLUXIONRemovingExtraWINotice="Removing extraneous wireless interfaces..."
FLUXIONFindingWINotice="Looking for available wireless interfaces..." FLUXIONFindingWINotice="Looking for available wireless interfaces..."
@ -70,6 +72,7 @@ FLUXIONAttackQuery="Select a wireless attack for the access point"
FLUXIONAttackInProgressNotice="${CCyn}\$FluxionAttack$CClr attack in progress..." FLUXIONAttackInProgressNotice="${CCyn}\$FluxionAttack$CClr attack in progress..."
FLUXIONSelectAnotherAttackOption="Select another attack" FLUXIONSelectAnotherAttackOption="Select another attack"
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
FLUXIONGeneralSkipOption="${CYel}Skip"
FLUXIONGeneralBackOption="${CRed}Back" FLUXIONGeneralBackOption="${CRed}Back"
FLUXIONGeneralExitOption="${CRed}Exit" FLUXIONGeneralExitOption="${CRed}Exit"
FLUXIONGeneralRepeatOption="${CRed}Repeat" FLUXIONGeneralRepeatOption="${CRed}Repeat"