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/stdapi/fs/mount.rb
Views: 11795
1
# -*- coding: binary -*-
2
3
require 'rex/post/meterpreter/extensions/stdapi/stdapi'
4
5
module Rex
6
module Post
7
module Meterpreter
8
module Extensions
9
module Stdapi
10
module Fs
11
12
class Mount
13
14
# Used when matching against windows drive types
15
DRIVE_TYPES = [
16
:unknown,
17
:no_root,
18
:removable,
19
:fixed,
20
:remote,
21
:cdrom,
22
:ramdisk
23
]
24
25
def initialize(client)
26
self.client = client
27
end
28
29
def show_mount
30
request = Packet.create_request(COMMAND_ID_STDAPI_FS_MOUNT_SHOW)
31
32
response = client.send_request(request)
33
34
results = []
35
36
response.each(TLV_TYPE_MOUNT) do |d|
37
results << {
38
name: d.get_tlv_value(TLV_TYPE_MOUNT_NAME),
39
type: DRIVE_TYPES[d.get_tlv_value(TLV_TYPE_MOUNT_TYPE)],
40
user_space: d.get_tlv_value(TLV_TYPE_MOUNT_SPACE_USER),
41
total_space: d.get_tlv_value(TLV_TYPE_MOUNT_SPACE_TOTAL),
42
free_space: d.get_tlv_value(TLV_TYPE_MOUNT_SPACE_FREE),
43
unc: d.get_tlv_value(TLV_TYPE_MOUNT_UNCPATH)
44
}
45
end
46
47
results
48
end
49
50
protected
51
attr_accessor :client # :nodoc:
52
53
end
54
55
end; end; end; end; end; end
56
57
58
59