def get_monitor_adapter():
 tmp = init_app('iwconfig', True)
 for line in tmp.split('\n'):
  if line.startswith(' '):
   continue
  elif (len(line.split(' ')[0]) > 1):
   if ('Mode:Monitor' in line):
    return line.split(' ')[0]
 return None

def get_monitor_adapter ( ) : tmp = init_app ( 'iwconfig' , True ) for line in tmp . split ( '\n' ) : if line . startswith ( ' ' ) : continue elif ( len ( line . split ( ' ' ) [ 0 ] ) > 1 ) : if ( 'Mode:Monitor' in line ) : return line . split ( ' ' ) [ 0 ] return None
try and automatically detect which adapter is in monitor mode .