From 93bb31dfa0aaa737bc5fbb4ffa87bc6040eca134 Mon Sep 17 00:00:00 2001 From: Jon Hart Date: Sat, 21 Nov 2015 19:50:33 -0800 Subject: [PATCH] Make path to rsyncd configuration file configurable --- modules/post/multi/gather/rsyncd_creds.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/post/multi/gather/rsyncd_creds.rb b/modules/post/multi/gather/rsyncd_creds.rb index 95220d9f81..cc89536385 100644 --- a/modules/post/multi/gather/rsyncd_creds.rb +++ b/modules/post/multi/gather/rsyncd_creds.rb @@ -29,6 +29,11 @@ class Metasploit3 < Msf::Post OptBool.new('USER_CONFIGS', [true, 'Get passwords from each local user\'s rsyncd.conf', true]) ] ) + register_advanced_options( + [ + OptString.new('RSYNCD_CONFIG', [true, 'Path to rsyncd.conf', '/etc/rsyncd.conf']) + ] + ) end def dump_rsync_secrets(config_file) @@ -72,8 +77,9 @@ class Metasploit3 < Msf::Post # build up a list of rsync configuration files to read, including the # default location of the daemon config as well as any per-user # configuration files that may exist (rare) - config_files = Set.new([ '/etc/rsyncd.conf' ]) - config_files |= enum_user_directories.map { |d| ::File.join(d, 'rsyncd.conf') } if datastore['USER_CONFIGS'] + config_path = datastore['RSYNCD_CONFIG'] + config_files = Set.new([ config_path ]) + config_files |= enum_user_directories.map { |d| ::File.join(d, ::File.basename(config_path)) } if datastore['USER_CONFIGS'] config_files.map { |config_file| dump_rsync_secrets(config_file) } end end