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/modules/post/solaris/gather/enum_services.rb
Views: 11784
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
)
23
)
24
end
25
26
# Run Method for when run command is issued
27
def run
28
distro = get_sysinfo
29
store_loot('solaris.version', 'text/plain', session, "Distro: #{distro[:hostname]}, Version: #{distro[:version]}, Kernel: #{distro[:kernel]}", 'solaris_info.txt', 'Solaris Version')
30
31
# Print the info
32
print_good('Info:')
33
print_good("\t#{distro[:version]}")
34
print_good("\t#{distro[:kernel]}")
35
installed_pkg = get_services
36
pkg_loot = store_loot('solaris.services', 'text/plain', session, installed_pkg, 'configured_services.txt', 'Solaris Configured Services')
37
print_good("Service list saved to loot file: #{pkg_loot}")
38
if datastore['VERBOSE']
39
print_good('Services:')
40
41
# Print the Packages
42
installed_pkg.each_line do |p|
43
print_good("\t#{p.chomp}")
44
end
45
end
46
end
47
48
def get_services
49
services_installed = ''
50
services_installed = cmd_exec('/usr/bin/svcs -a')
51
return services_installed
52
end
53
end
54
55