Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/solaris/gather/enum_services.rb
19850 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Post
7
include Msf::Post::File
8
include Msf::Post::Solaris::System
9
10
def initialize(info = {})
11
super(
12
update_info(
13
info,
14
'Name' => 'Solaris Gather Configured Services',
15
'Description' => %q{
16
Post module to enumerate services on a Solaris system.
17
},
18
'License' => MSF_LICENSE,
19
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
20
'Platform' => [ 'solaris' ],
21
'SessionTypes' => [ 'shell' ],
22
'Notes' => {
23
'Stability' => [CRASH_SAFE],
24
'SideEffects' => [],
25
'Reliability' => []
26
}
27
)
28
)
29
end
30
31
def run
32
distro = get_sysinfo
33
store_loot('solaris.version', 'text/plain', session, "Distro: #{distro[:hostname]}, Version: #{distro[:version]}, Kernel: #{distro[:kernel]}", 'solaris_info.txt', 'Solaris Version')
34
35
print_good('Info:')
36
print_good("\t#{distro[:version]}")
37
print_good("\t#{distro[:kernel]}")
38
39
installed_pkg = get_services
40
if installed_pkg.blank?
41
print_error('No services identified')
42
return
43
end
44
45
pkg_loot = store_loot('solaris.services', 'text/plain', session, installed_pkg, 'configured_services.txt', 'Solaris Configured Services')
46
print_good("Service list saved to loot file: #{pkg_loot}")
47
48
if datastore['VERBOSE']
49
print_good('Services:')
50
installed_pkg.each_line do |p|
51
print_good("\t#{p.chomp}")
52
end
53
end
54
end
55
56
def get_services
57
cmd_exec('/usr/bin/svcs -a') || ''
58
end
59
end
60
61