Skip to content

Instantly share code, notes, and snippets.

@kleo
Created April 17, 2017 23:30
Show Gist options
  • Save kleo/d8ba385e4820e17d8e9d69d0fceefc55 to your computer and use it in GitHub Desktop.
Save kleo/d8ba385e4820e17d8e9d69d0fceefc55 to your computer and use it in GitHub Desktop.
Wifi Pineapple Analyze OUI
#!/bin/bash
# Darren Kitchen - https://forums.hak5.org/index.php?/topic/36913-is-analyzesh-mentioned-at-defcon-available/&do=findComment&comment=268226
if [ -z "$1" ]; then
echo "Usage: analyze.sh input_file output_file"; exit
fi
if [ ! -f oui-small.txt ]
then
echo "Downloading OUI Database"
wget http://standards.ieee.org/regauth/oui/oui.txt
echo "Database downloaded. Fixing up oui.txt"
cat oui.txt | grep "base 16" | sed "s/(base 16)//g" | cut -c 3- | sed "s/\t//g" | sed "s/ / /g" > oui-small.txt
fi
echo -e "Processing PineAP Log\n"
rm /tmp/analyze_tmp &>/dev/null
rm $2 &>/dev/null
while read i; do
OUI=$(echo $i | awk {'print $7'} | cut -c 1-8 | sed "s/://g" | awk '{print toupper($0)}')
grep $OUI oui-small.txt | awk {'print $2'} >> /tmp/analyze_tmp
done < $1
unique_manufacturer=$(cat /tmp/analyze_tmp | awk '{print tolower($0)}' | sed "s/,//g" | sort | uniq | wc -l)
printf "Unique:\n" >> $2
printf " Probes: " >> $2 && cat pineap.log | awk {'print $10'} | sed "s/'//g" | sort | uniq | wc -l >> $2
printf " Devices: " >> $2 && cat pineap.log | awk {'print $7'} | sort | uniq | wc -l >> $2
printf " OUIs: " >> $2 && cat pineap.log | awk {'print $7'} | sort | cut -c 1-8 | uniq | wc -l >> $2
printf "Manufacturers: $unique_manufacturer\n\n" >> $2
printf "Top 10 Manufacturers:\n" >> $2
cat /tmp/analyze_tmp | sed "s/,//g" | sort | uniq -c | sort -g -r | head -10 >> $2
printf "\nTop 10 Probe Requests:\n" >> $2
cat $1 | awk '{print $10}' | sort | uniq -c | sort -g -r | head -10 >> $2
cat $2
printf "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment