Skip to content

Commit

Permalink
Adds ability to load post modules in msfcli
Browse files Browse the repository at this point in the history
This is mainly important for normal load testing. It'd be unusual to
actually want to use this functionality with msfcli since post modules
already need established sessions in order to do something.

[SeeRM #8719]
  • Loading branch information
Tod Beardsley committed Dec 19, 2013
1 parent d41f05e commit 6422ad2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions msfcli
Expand Up @@ -312,6 +312,8 @@ class Msfcli
modules[:module] = @framework.exploits.create($1)
elsif module_name =~ /auxiliary\/(.*)/
modules[:module] = @framework.auxiliary.create($1)
elsif module_name =~ /post\/(.*)/
modules[:module] = @framework.post.create($1)
else
modules[:module] = @framework.exploits.create(module_name)
if modules[:module].nil?
Expand Down
33 changes: 32 additions & 1 deletion spec/msfcli_spec.rb
Expand Up @@ -222,6 +222,37 @@ def get_stdout(&block)
end

context ".init_modules" do

it "should inititalize an exploit module" do
args = 'exploit/windows/smb/psexec S'
m = ''
stdout = get_stdout {
cli = Msfcli.new(args.split(' '))
m = cli.init_modules
}
m[:module].class.to_s.should start_with("Msf::Modules::Mod")
end

it "should inititalize an auxiliary module" do
args = 'auxiliary/server/browser_autopwn S'
m = ''
stdout = get_stdout {
cli = Msfcli.new(args.split(' '))
m = cli.init_modules
}
m[:module].class.to_s.should start_with("Msf::Modules::Mod")
end

it "should inititalize a post module" do
args = 'post/windows/gather/credentials/gpp S'
m = ''
stdout = get_stdout {
cli = Msfcli.new(args.split(' '))
m = cli.init_modules
}
m[:module].class.to_s.should start_with("Msf::Modules::Mod")
end

it "should have multi/handler module initialized" do
args = "multi/handler payload=windows/meterpreter/reverse_tcp lhost=127.0.0.1 E"
m = ''
Expand Down Expand Up @@ -384,4 +415,4 @@ def get_stdout(&block)
end

end
end
end

0 comments on commit 6422ad2

Please sign in to comment.