Class: Rex::Post::Meterpreter::Extensions::Extapi::Adsi::Adsi

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb

Overview

This meterpreter extension contains extended API functions for querying and managing desktop windows.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Adsi

Returns a new instance of Adsi


18
19
20
# File 'lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client


66
67
68
# File 'lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb', line 66

def client
  @client
end

Instance Method Details

#domain_query(domain_name, filter, max_results, page_size, fields) ⇒ Object

Perform a generic domain query against ADSI.

Parameters:

  • domain_name (String)

    The FQDN of the target domain.

  • filter (String)

    The filter to apply to the query in LDAP format.

  • max_results (Integer)

    The maximum number of results to return.

  • page_size (Integer)

    The size of the page of results to return.

  • fields (Array)

    Array of string fields to return for each result found


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb', line 37

def domain_query(domain_name, filter, max_results, page_size, fields)
  request = Packet.create_request('extapi_adsi_domain_query')

  request.add_tlv(TLV_TYPE_EXT_ADSI_DOMAIN, domain_name)
  request.add_tlv(TLV_TYPE_EXT_ADSI_FILTER, filter)
  request.add_tlv(TLV_TYPE_EXT_ADSI_MAXRESULTS, max_results)
  request.add_tlv(TLV_TYPE_EXT_ADSI_PAGESIZE, page_size)

  fields.each do |f|
    request.add_tlv(TLV_TYPE_EXT_ADSI_FIELD, f)
  end

  response = client.send_request(request)

  results = []
  response.each(TLV_TYPE_EXT_ADSI_RESULT) { |r|
    result = []
    r.each(TLV_TYPE_EXT_ADSI_VALUE) { |v|
      result << v.value
    }
    results << result
  }

  return {
    :fields  => fields,
    :results => results
  }
end