(pkt)
return (usr, pswd)
Parse LDAP credentials; only supports simple (0)
        authentication right now.  Scapy doesn't currently
        support LDAP packets, so we'll do this by hand.
Parse LDAP credentials; only supports simple (0)
        authentication right now.  Scapy doesn't currently
        support LDAP packets, so we'll do this by hand.
Parse LDAP credentials ; only supports simple ( 0 ) authentication right now . Scapy doesn t currently support LDAP packets so we ll do this by hand .
def parse_ldap(pkt):
    """ Parse LDAP credentials; only supports simple (0)
        authentication right now.  Scapy doesn't currently
        support LDAP packets, so we'll do this by hand.
    """
    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':
            # bind request
            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' : # bind request 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 )