fragattacks/research/scan.sh
2020-05-24 04:39:15 +04:00

29 lines
522 B
Bash
Executable File

#!/bin/bash
set -e
if ! [ $(id -u) = 0 ]; then
echo "You must run the script as root"
exit 1
fi
if [[ $# -ne 1 ]]; then
echo "Illegal number of parameters"
exit 2
fi
IFACE=$1
# Assure device is in managed mode
ifconfig $IFACE down
iw $IFACE set type managed
ifconfig $IFACE up
# Scan and list the results
RESULTS=( $(iwlist $IFACE scan | grep -E "Channel:|SSID") )
for chanidx in $(seq 0 2 ${#RESULTS[@]})
do
ssididx=$((chanidx+1))
echo ${RESULTS[$ssididx]} ${RESULTS[$chanidx]}
done
ifconfig $IFACE down