#!/bin/bash -e # SSIDstrip # Utility to strip ESSIDs from Kismet Newcore captures for a custom SSID wordlist. # v0.2 # last edit 09-04-2011 # # FIXED SETTINGS # ============== RED=$(tput setaf 1 && tput bold) GREEN=$(tput setaf 2 && tput bold) BLUE=$(tput setaf 6 && tput bold) STAND=$(tput sgr0) # # #=====================# #Combining 2 wordlists# #---------------------# function combine () { echo -ne $STAND"Enter existing SSID wordlist: "$GREEN read list1 while [ ! -f $list1 ] ; do echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN read list1 done echo -ne $STAND"Enter existing SSID to append first wordlist: "$GREEN read list2 while [ ! -f $list2 ] ; do echo -ne $RED"File does not exist, enter /path/to/file: "$GREEN read list2 done echo -ne $STAND"Enter output filename: "$GREEN read output if [ -f $output ] ; then echo -ne $STAND"File $output already exists, overwrite ? y/n "$GREEN read over if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then echo else echo $STAND"Process cancelled, quitting" exit fi fi cat $list1 > $output && cat $list2 >> $output sort -fu $output > ssidlist_tmp && cat ssidlist_tmp > $output numb=$(cat $output | wc -l) rm ssidlist_tmp echo $STAND"SSID wordlist $GREEN$list1$STAND and $GREEN$list2$STAND have been combined into $GREEN$output$STAND." exit } # # #================================================# # Help and Options listing # #------------------------------------------------# function help () { clear echo $BLUE" _____ _____ _____ _____ _ _ / ____|/ ____|_ _| __ \ | | (_) | (___ | (___ | | | | | |___| |_ _ __ _ _ __ \___ \ \___ \ | | | | | / __| __| '__| | '_ \\ ____) |____) |_| |_| |__| \__ \ |_| | | | |_) | |_____/|_____/|_____|_____/|___/\__|_| |_| .__/ v0.2 by TAPE | | |_|$STAND Strips SSIDs from Kismet nettxt files usage: ./ssidstrip -i [input .nettxt file] -o [output file]$RED Requires;$STAND -i --- input .nettxt file from a Kismet capture -o --- output filename for the wordlist$RED Options;$STAND (use without any other switches) -c --- combine one (SSID)wordlist with another -l --- list the .nettxt files in current directory -h --- this help information" echo exit } # # #==================================================# # Listing found .nettxt files in current directory # #--------------------------------------------------# function list () { LIST=$(find *.nettxt > ssidstrip_list.tmp) NUMB=$(cat ssidstrip_list.tmp | wc -l) echo echo $BLUE"Found $RED$NUMB$BLUE nettxt file(s) in current directory;"$STAND echo cat -n ssidstrip_list.tmp rm ssidstrip_list.tmp echo exit } # # #========================# #Script options/arguments# #------------------------# while getopts "chi:lo:v" opt ; do case ${opt} in c) combine;; i) infile=$OPTARG;; l) list;; o) outfile=$OPTARG;; h) help;; v) version;; ?) help exit 2 esac done shift $(($OPTIND - 1)) # # #===========================================================# #Running the script to list SSIDs from a kismet .nettxt file# #-----------------------------------------------------------# { if [ "$outfile" == "" ] ; then echo $RED"Need more input"$STAND sleep 1 help exit 2 fi while [ ! -f $infile ] ; do # Return error message if file does not exist echo -ne "Input file $GREEN$infile$STAND does not exist, please enter /path/to/file: " read infile done if [ -f $outfile ] ; then echo -ne "Output file $GREEN$outfile$STAND already exists, overwrite ? y/n "$GREEN read over if [ "$over" == "y" ] || [ "$over" == "Y" ] ; then echo else echo $STAND"Process cancelled, quitting.." exit fi fi echo $STAND"stripping SSIDs from$GREEN $infile"$STAND echo "--------------------" grep SSID $infile | egrep -v 'BSSID|SSID [0-9]' | cut -c 18- | sed 's/"//g' | sed 's/ *$//g' | sort -fu > $outfile WC=$(cat $outfile | wc -l) echo "SSID wordlist $GREEN$outfile$STAND has been created with $GREEN$WC$STAND entries;" echo exit }