CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/post/meterpreter/extensions/extapi/ntds/ntds.rb
Views: 11795
1
# -*- coding: binary -*-
2
3
module Rex
4
module Post
5
module Meterpreter
6
module Extensions
7
module Extapi
8
module Ntds
9
10
###
11
#
12
# This meterpreter extension contains extended API functions for
13
# parsing the NT Directory Service database.
14
#
15
###
16
class Ntds
17
18
def initialize(client)
19
@client = client
20
end
21
22
def parse(filepath)
23
request = Packet.create_request(COMMAND_ID_EXTAPI_NTDS_PARSE)
24
request.add_tlv( TLV_TYPE_NTDS_PATH, filepath)
25
# wait up to 90 seconds for a response
26
response = client.send_request(request, 90)
27
channel_id = response.get_tlv_value(TLV_TYPE_CHANNEL_ID)
28
if channel_id.nil?
29
raise Exception, "We did not get a channel back!"
30
end
31
Rex::Post::Meterpreter::Channels::Pool.new(client, channel_id, "extapi_ntds", CHANNEL_FLAG_SYNCHRONOUS, response)
32
end
33
34
attr_accessor :client
35
36
end
37
38
end; end; end; end; end; end
39
40
41