'Uses Tshark or Pyrit to strip all non-handshake packets from a .cap file
File in location \'capfile\' is overwritten!'

def strip_handshake(self, capfile):

    output_file = capfile
    if program_exists('pyrit'):
        cmd = ['pyrit', '-r', capfile, '-o', (capfile + '.temp'), 'stripLive']
        call(cmd, stdout=DN, stderr=DN)
        rename((capfile + '.temp'), output_file)
    elif program_exists('tshark'):
        cmd = ['tshark', '-r', capfile, '-R', 'eapol    ||    wlan_mgt.tag.interpretation', '-2', '-w', (capfile + '.temp')]
        proc_strip = call(cmd, stdout=DN, stderr=DN)
        rename((capfile + '.temp'), output_file)
    else:
        print ((((R + '    [!]') + O) + '    unable    to    strip    .cap    file:    neither    pyrit    nor    tshark    were    found') + W)
