Sha256: 1d5ce86b58038e80621539b6478a4b5be81af9dee76ff57ea71d7e31a4ca1711
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
module Dap module Filter require 'openssl' require 'dap/proto/ldap' # # Decode an LDAP SearchRequest probe response # class FilterDecodeLdapSearchResult include BaseDecoder # # Decode an LDAP SearchRequest probe response # # @param data [String] Binary string containing raw response from server # @return [Hash] Hash containing all LDAP responses # def decode(data) info = {} # RFC 4511 - 4.5.2 SearchResult contains zero or more SearchResultEntry or # SearchResultReference messages followed by a single SearchResultDone # message. OpenSSL::ASN1.decode doesn't handle the back to back Sequences # well, so identify the lengths and split them into individual ASN1 elements messages = Dap::Proto::LDAP.split_messages(data) if messages.empty? err_msg = 'FilterDecodeLdapSearchResult - Unable to parse response' info['Error'] = { 'errorMessage' => err_msg } end messages.each do |element| begin elem_decoded = OpenSSL::ASN1.decode(element) rescue Exception => e err_msg = 'FilterDecodeLdapSearchResult - Unable to decode ANS1 element' $stderr.puts "#{err_msg}: #{e}" $stderr.puts e.backtrace info['Error'] = { 'errorMessage' => err_msg } next end parsed_type, parsed_data = Dap::Proto::LDAP.parse_message(elem_decoded) info[parsed_type] = parsed_data if parsed_type && parsed_data end info end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dap-0.0.9 | lib/dap/filter/ldap.rb |