Skip to content

Commit 41605c5

Browse files
committed
Add reference name enforcement to cmd_use
1 parent d9f5385 commit 41605c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/msf/ui/console/command_dispatcher/modules.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,14 @@ def cmd_use(*args)
597597
# Try to create an instance of the supplied module name
598598
mod_name = args[0]
599599

600+
# Ensure we have a reference name and not a path
601+
if mod_name.start_with?('modules/')
602+
mod_name.sub!(/^modules\//, '')
603+
end
604+
if mod_name.end_with?('.', '.rb')
605+
mod_name.sub!(/\.(?:rb)?$/, '')
606+
end
607+
600608
begin
601609
mod = framework.modules.create(mod_name)
602610
unless mod

0 commit comments

Comments
 (0)