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


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.


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