Skip to content

Commit 2cc4fa3

Browse files
committed
Land rapid7#2785, @todb-r7's support for post modules on msfcli
2 parents 9c484dd + 6422ad2 commit 2cc4fa3

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

msfcli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ class Msfcli
312312
modules[:module] = @framework.exploits.create($1)
313313
elsif module_name =~ /auxiliary\/(.*)/
314314
modules[:module] = @framework.auxiliary.create($1)
315+
elsif module_name =~ /post\/(.*)/
316+
modules[:module] = @framework.post.create($1)
315317
else
316318
modules[:module] = @framework.exploits.create(module_name)
317319
if modules[:module].nil?

spec/msfcli_spec.rb

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,37 @@ def get_stdout(&block)
222222
end
223223

224224
context ".init_modules" do
225+
226+
it "should inititalize an exploit module" do
227+
args = 'exploit/windows/smb/psexec S'
228+
m = ''
229+
stdout = get_stdout {
230+
cli = Msfcli.new(args.split(' '))
231+
m = cli.init_modules
232+
}
233+
m[:module].class.to_s.should start_with("Msf::Modules::Mod")
234+
end
235+
236+
it "should inititalize an auxiliary module" do
237+
args = 'auxiliary/server/browser_autopwn S'
238+
m = ''
239+
stdout = get_stdout {
240+
cli = Msfcli.new(args.split(' '))
241+
m = cli.init_modules
242+
}
243+
m[:module].class.to_s.should start_with("Msf::Modules::Mod")
244+
end
245+
246+
it "should inititalize a post module" do
247+
args = 'post/windows/gather/credentials/gpp S'
248+
m = ''
249+
stdout = get_stdout {
250+
cli = Msfcli.new(args.split(' '))
251+
m = cli.init_modules
252+
}
253+
m[:module].class.to_s.should start_with("Msf::Modules::Mod")
254+
end
255+
225256
it "should have multi/handler module initialized" do
226257
args = "multi/handler payload=windows/meterpreter/reverse_tcp lhost=127.0.0.1 E"
227258
m = ''
@@ -384,4 +415,4 @@ def get_stdout(&block)
384415
end
385416

386417
end
387-
end
418+
end

0 commit comments

Comments
 (0)