Land #2785, @todb-r7's support for post modules on msfcli

This commit is contained in:
jvazquez-r7 2013-12-23 12:05:40 -06:00
commit 2cc4fa35cf
No known key found for this signature in database
GPG Key ID: 38D99152B9352D83
2 changed files with 34 additions and 1 deletions

2
msfcli
View File

@ -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?

View File

@ -222,6 +222,37 @@ describe Msfcli do
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 = ''
@ -384,4 +415,4 @@ describe Msfcli do
end
end
end
end