'Analyzes given capfile for handshakes using various programs.
Prints results to console.'

def analyze_capfile(self, capfile):

    wpa_attack = WPAAttack(None, None, None, None)
    if ((self.RUN_CONFIG.TARGET_ESSID == '') and (self.RUN_CONFIG.TARGET_BSSID == '')):
        print (((R + '    [!]') + O) + '    target    ssid    and    bssid    are    required    to    check    for    handshakes')
        print (((R + '    [!]') + O) + '    please    enter    essid    (access    point    name)    using    -e    <name>')
        print (((R + '    [!]') + O) + '    and/or    target    bssid    (mac    address)    using    -b    <mac>\n')
    if (self.RUN_CONFIG.TARGET_BSSID == ''):
        self.RUN_CONFIG.TARGET_BSSID = get_bssid_from_cap(self.RUN_CONFIG.TARGET_ESSID, capfile)
        if (self.RUN_CONFIG.TARGET_BSSID == ''):
            print (((R + '    [!]') + O) + '    unable    to    guess    BSSID    from    ESSID!')
        else:
            print (((GR + '    [+]') + W) + ('    guessed    bssid:    %s' % ((G + self.RUN_CONFIG.TARGET_BSSID) + W)))
    if ((self.RUN_CONFIG.TARGET_BSSID != '') and (self.RUN_CONFIG.TARGET_ESSID == '')):
        self.RUN_CONFIG.TARGET_ESSID = get_essid_from_cap(self.RUN_CONFIG.TARGET_BSSID, capfile)
    print (((GR + '\n    [+]') + W) + ('    checking    for    handshakes    in    %s' % ((G + capfile) + W)))
    t = Target(self.RUN_CONFIG.TARGET_BSSID, '', '', '', 'WPA', self.RUN_CONFIG.TARGET_ESSID)
    if program_exists('pyrit'):
        result = wpa_attack.has_handshake_pyrit(t, capfile)
        print (((((((GR + '    [+]') + W) + '                ') + G) + 'pyrit') + W) + (': DCTB  DCTB  DCTB     %s' % (((G + 'found!') + W) if result else ((O + 'not    found') + W))))
    else:
        print (((R + '    [!]') + O) + '    program    not    found:    pyrit')
    if program_exists('cowpatty'):
        result = wpa_attack.has_handshake_cowpatty(t, capfile, nonstrict=True)
        print (((((((GR + '    [+]') + W) + '                ') + G) + 'cowpatty') + W) + ('    (nonstrict): DCTB     %s' % (((G + 'found!') + W) if result else ((O + 'not    found') + W))))
        result = wpa_attack.has_handshake_cowpatty(t, capfile, nonstrict=False)
        print (((((((GR + '    [+]') + W) + '                ') + G) + 'cowpatty') + W) + ('    (strict): DCTB     %s' % (((G + 'found!') + W) if result else ((O + 'not    found') + W))))
    else:
        print (((R + '    [!]') + O) + '    program    not    found:    cowpatty')
    if program_exists('tshark'):
        result = wpa_attack.has_handshake_tshark(t, capfile)
        print (((((((GR + '    [+]') + W) + '                ') + G) + 'tshark') + W) + (': DCTB  DCTB  DCTB     %s' % (((G + 'found!') + W) if result else ((O + 'not    found') + W))))
    else:
        print (((R + '    [!]') + O) + '    program    not    found:    tshark')
    if program_exists('aircrack-ng'):
        result = wpa_attack.has_handshake_aircrack(t, capfile)
        print (((((((GR + '    [+]') + W) + '                ') + G) + 'aircrack-ng') + W) + (': DCTB  DCTB     %s' % (((G + 'found!') + W) if result else ((O + 'not    found') + W))))
    else:
        print (((R + '    [!]') + O) + '    program    not    found:    aircrack-ng')
    print ''
    self.RUN_CONFIG.exit_gracefully(0)
