Last active
September 6, 2019 01:38
-
-
Save HQarroum/9458fe2d401051be59f4d261991378f2 to your computer and use it in GitHub Desktop.
Enables the monitoring mode of your wireless adapter and dumps found Wi-Fi probe requests on OSX.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Stopping the script when a command's exit code signals a failure. \ | |
set -e | |
set -o pipefail | |
# Variables. \ | |
WLAN_INTERFACE='en0' | |
# The help usage text. | |
USAGE="$(basename "$0") [-i] -- Puts the Wireless interface in monitor mode and dumps sniffed Wi-Fi probe requests." | |
# Retrieving arguments from the command-line. | |
while getopts ":i:hs" o; do | |
case "${o}" in | |
i) WLAN_INTERFACE=${OPTARG} ;; | |
h) echo "$USAGE" | |
exit 0 ;; | |
\?) echo "Invalid option: -$OPTARG" >&2 | |
exit 1 ;; | |
:) echo "Option -$OPTARG requires an argument." >&2 | |
exit 1 ;; | |
esac | |
done | |
# Starts listening to Wi-Fi probe requests. | |
sudo tcpdump -l --monitor-mode -i $WLAN_INTERFACE -e --snapshot-length 256 type mgt subtype probe-req | |
# Re-setting the interface. | |
echo "Re-setting the '$WLAN_INTERFACE' network adapter ..." | |
sudo ifconfig $WLAN_INTERFACE down && sudo ifconfig $WLAN_INTERFACE up | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment