Skip to content

Commit 52cbbe3

Browse files
committed
Add some documentation to the ADSI functions
1 parent 8329a15 commit 52cbbe3

File tree

2 files changed

+35
-0
lines changed
  • lib/rex/post/meterpreter
    • extensions/extapi/adsi
    • ui/console/command_dispatcher/extapi

2 files changed

+35
-0
lines changed

lib/rex/post/meterpreter/extensions/extapi/adsi/adsi.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ def domain_query(domain_name, filter, max_results, page_size, fields)
6060

6161
protected
6262

63+
#
64+
# Retrieve the results of the query from the response
65+
# packet that was returned from Meterpreter.
66+
#
67+
# @param response [Packet] Reference to the received
68+
# packet that was returned from Meterpreter.
69+
#
70+
# @return [Array[Array[[Hash]]] Collection of results from
71+
# the ADSI query.
72+
#
6373
def extract_results(response)
6474
results = []
6575

@@ -70,6 +80,15 @@ def extract_results(response)
7080
results
7181
end
7282

83+
#
84+
# Extract a single row of results from a TLV group.
85+
#
86+
# @param tlv_container [Packet] Reference to the TLV
87+
# group to pull the values from.
88+
#
89+
# @return [Array[Hash]] Collection of values from
90+
# the single ADSI query result row.
91+
#
7392
def extract_values(tlv_container)
7493
values = []
7594
tlv_container.get_tlvs(TLV_TYPE_ANY).each do |v|
@@ -78,6 +97,14 @@ def extract_values(tlv_container)
7897
values
7998
end
8099

100+
#
101+
# Convert a single ADSI result value into a usable
102+
# value that also describes its type.
103+
#
104+
# @param v [TLV] The TLV item that contains the value.
105+
#
106+
# @return [Hash] The type/value pair from the TLV.
107+
#
81108
def extract_value(v)
82109
value = {
83110
:type => :unknown

lib/rex/post/meterpreter/ui/console/command_dispatcher/extapi/adsi.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ def cmd_adsi_domain_query(*args)
191191

192192
protected
193193

194+
#
195+
# Convert an ADSI result row to a table row so that it can
196+
# be rendered to screen appropriately.
197+
#
198+
# @param result [Array[Hash]] Array of type/value pairs.
199+
#
200+
# @return [Array[String]] Renderable view of the value.
201+
#
194202
def to_table_row(result)
195203
values = []
196204

0 commit comments

Comments
 (0)