metasploit-framework/modules/post/solaris/gather/enum_services.rb

51 lines
1.6 KiB
Ruby
Raw Normal View History

##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Post
2013-09-05 18:41:25 +00:00
include Msf::Post::File
include Msf::Post::Solaris::System
def initialize(info={})
super( update_info( info,
'Name' => 'Solaris Gather Configured Services',
'Description' => %q{ Post Module to enumerate services on a Solaris System},
'License' => MSF_LICENSE,
'Author' => [ 'Carlos Perez <carlos_perez[at]darkoperator.com>'],
'Platform' => [ 'solaris' ],
'SessionTypes' => [ 'shell' ]
))
end
# Run Method for when run command is issued
def run
distro = get_sysinfo
store_loot("solaris.version", "text/plain", session, "Distro: #{distro[:hostname]}, Version: #{distro[:version]}, Kernel: #{distro[:kernel]}", "solaris_info.txt", "Solaris Version")
# Print the info
print_good("Info:")
print_good("\t#{distro[:version]}")
print_good("\t#{distro[:kernel]}")
installed_pkg = get_services()
pkg_loot = store_loot("solaris.services", "text/plain", session, installed_pkg, "configured_services.txt", "Solaris Configured Services")
2017-07-19 12:02:49 +00:00
print_good("Service list saved to loot file: #{pkg_loot}")
2013-09-05 18:41:25 +00:00
if datastore['VERBOSE']
print_good("Services:")
# Print the Packages
installed_pkg.each_line do |p|
print_good("\t#{p.chomp}")
end
end
end
def get_services()
services_installed = ""
services_installed = cmd_exec("/usr/bin/svcs -a")
return services_installed
end
end