def parse_ldap(pkt):
 payload = pkt[TCP].payload
 pkt_layer = util.get_layer_bytes(str(payload))
 (usr, pswd) = (None, None)
 if (len(pkt_layer) > 0):
  if (pkt_layer[4] == '01'):
   (usr, pswd) = ('', '')
   usr_len = int(pkt_layer[11])
   for idx in xrange(usr_len):
    usr += pkt_layer[(12 + idx)].decode('hex')
   pw_len = int(pkt_layer[(13 + usr_len)])
   for idx in xrange(pw_len):
    pswd += pkt_layer[((14 + usr_len) + idx)].decode('hex')
 return (usr, pswd)

def parse_ldap ( pkt ) : payload = pkt [ TCP ] . payload pkt_layer = util . get_layer_bytes ( str ( payload ) ) ( usr , pswd ) = ( None , None ) if ( len ( pkt_layer ) > 0 ) : if ( pkt_layer [ 4 ] == '01' ) : ( usr , pswd ) = ( '' , '' ) usr_len = int ( pkt_layer [ 11 ] ) for idx in xrange ( usr_len ) : usr += pkt_layer [ ( 12 + idx ) ] . decode ( 'hex' ) pw_len = int ( pkt_layer [ ( 13 + usr_len ) ] ) for idx in xrange ( pw_len ) : pswd += pkt_layer [ ( ( 14 + usr_len ) + idx ) ] . decode ( 'hex' ) return ( usr , pswd )
parse ldap credentials; only supports simple (0) authentication right now .