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_packages.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 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
)
23
)
24
end
25
26
# Run Method for when run command is issued
27
def run
28
distro = get_sysinfo
29
print_status("Running Module against #{distro[:hostname]}")
30
packages = cmd_exec('/usr/bin/pkginfo -l')
31
pkg_loot = store_loot('solaris.packages', 'text/plain', session, packages, 'installed_packages.txt', 'Solaris Installed Packages')
32
print_good("Package list saved to loot file: #{pkg_loot}")
33
34
if datastore['VERBOSE']
35
packages.each do |p|
36
print_good("\t#{p.chomp}")
37
end
38
end
39
end
40
end
41
42