Add janky regex check if we're reloading a module

GSoC/Meterpreter_Web_Console
William Vu 2018-05-16 12:03:54 -05:00
parent 5addc54b4b
commit 365289b19e
1 changed files with 7 additions and 1 deletions

View File

@ -73,6 +73,12 @@ module Msf
return
end
# The file must exist to reach this, so we try our best here
if path =~ %r{^(?:\./)?modules/}
print_error('Reloading Metasploit modules is not supported (try "reload")')
return
end
print_status("Reloading #{path}")
load path
end
@ -642,7 +648,7 @@ module Msf
# Ensure we have a reference name and not a path
if mod_name.start_with?('./', 'modules/')
mod_name.sub!(/^(?:\.\/)?modules\//, '')
mod_name.sub!(%r{^(?:\./)?modules/}, '')
end
if mod_name.end_with?('.rb')
mod_name.sub!(/\.rb$/, '')