Path: blob/master/modules/post/solaris/gather/enum_packages.rb
19535 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::File7include Msf::Post::Solaris::System89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Solaris Gather Installed Packages',14'Description' => %q{15Post module to enumerate installed packages on a Solaris system.16},17'License' => MSF_LICENSE,18'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],19'Platform' => [ 'solaris' ],20'SessionTypes' => [ 'shell' ],21'Notes' => {22'Stability' => [CRASH_SAFE],23'SideEffects' => [],24'Reliability' => []25}26)27)28end2930def run31distro = get_sysinfo32print_status("Running module against #{distro[:hostname]}")33packages = cmd_exec('/usr/bin/pkginfo -l')3435if packages.blank?36print_error('No packages identified')37return38end3940pkg_loot = store_loot('solaris.packages', 'text/plain', session, packages, 'installed_packages.txt', 'Solaris Installed Packages')41print_good("Package list saved to loot file: #{pkg_loot}")4243if datastore['VERBOSE']44packages.each do |p|45print_good("\t#{p.chomp}")46end47end48end49end505152