Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/solaris/gather/enum_packages.rb
19535 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 Installed Packages',
15
'Description' => %q{
16
Post module to enumerate installed packages 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
print_status("Running module against #{distro[:hostname]}")
34
packages = cmd_exec('/usr/bin/pkginfo -l')
35
36
if packages.blank?
37
print_error('No packages identified')
38
return
39
end
40
41
pkg_loot = store_loot('solaris.packages', 'text/plain', session, packages, 'installed_packages.txt', 'Solaris Installed Packages')
42
print_good("Package list saved to loot file: #{pkg_loot}")
43
44
if datastore['VERBOSE']
45
packages.each do |p|
46
print_good("\t#{p.chomp}")
47
end
48
end
49
end
50
end
51
52