def get_essid_from_cap(bssid, capfile):
 if (not program_exists('tshark')):
  return ''
 cmd = ['tshark', '-r', capfile, '-R', ('wlan.fc.type_subtype == 0x05 && wlan.sa == %s' % bssid), '-n']
 proc = Popen(cmd, stdout=PIPE, stderr=DN)
 proc.wait()
 for line in proc.communicate()[0].split('\n'):
  if (line.find('SSID=') != (-1)):
   essid = line[(line.find('SSID=') + 5):]
   print (((GR + ' [+]') + W) + (' guessed essid: %s' % ((G + essid) + W)))
   return essid
 print ((((R + ' [!]') + O) + ' unable to guess essid!') + W)
 return ''

def get_essid_from_cap ( bssid , capfile ) : if ( not program_exists ( 'tshark' ) ) : return '' cmd = [ 'tshark' , '-r' , capfile , '-R' , ( 'wlan.fc.type_subtype == 0x05 && wlan.sa == %s' % bssid ) , '-n' ] proc = Popen ( cmd , stdout = PIPE , stderr = DN ) proc . wait ( ) for line in proc . communicate ( ) [ 0 ] . split ( '\n' ) : if ( line . find ( 'SSID=' ) != ( - 1 ) ) : essid = line [ ( line . find ( 'SSID=' ) + 5 ) : ] print ( ( ( GR + ' [+]' ) + W ) + ( ' guessed essid: %s' % ( ( G + essid ) + W ) ) ) return essid print ( ( ( ( R + ' [!]' ) + O ) + ' unable to guess essid!' ) + W ) return ''
attempts to get essid from cap file using bssid as reference .