Path: blob/master/modules/post/solaris/gather/enum_services.rb
19850 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 Configured Services',14'Description' => %q{15Post module to enumerate services 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_sysinfo32store_loot('solaris.version', 'text/plain', session, "Distro: #{distro[:hostname]}, Version: #{distro[:version]}, Kernel: #{distro[:kernel]}", 'solaris_info.txt', 'Solaris Version')3334print_good('Info:')35print_good("\t#{distro[:version]}")36print_good("\t#{distro[:kernel]}")3738installed_pkg = get_services39if installed_pkg.blank?40print_error('No services identified')41return42end4344pkg_loot = store_loot('solaris.services', 'text/plain', session, installed_pkg, 'configured_services.txt', 'Solaris Configured Services')45print_good("Service list saved to loot file: #{pkg_loot}")4647if datastore['VERBOSE']48print_good('Services:')49installed_pkg.each_line do |p|50print_good("\t#{p.chomp}")51end52end53end5455def get_services56cmd_exec('/usr/bin/svcs -a') || ''57end58end596061