Skip to content

Commit

Permalink
Add tests for aux and exploit cmd_check and cmd_run
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Jul 8, 2021
1 parent 2fa2709 commit e5241b4
Show file tree
Hide file tree
Showing 8 changed files with 1,251 additions and 45 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Gemfile.local.lock
config/database.yml
# target config file for testing
features/support/targets.yml
# Generated test files
spec/dummy
# simplecov coverage data
coverage
doc/
Expand Down Expand Up @@ -94,6 +96,5 @@ docker-compose.local*
*.pyc
rspec.failures


#Ignore any base disk store files
db/modules_metadata_base.pstore
db/modules_metadata_base.pstore
2 changes: 1 addition & 1 deletion lib/msf/ui/console/command_dispatcher/auxiliary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def cmd_run(*args, action: nil)
jobify = true
end

rhosts = datastore['RHOSTS']
rhosts = mod.datastore['RHOSTS']
begin
# Check if this is a scanner module or doesn't target remote hosts
if rhosts.blank? || mod.class.included_modules.include?(Msf::Auxiliary::Scanner)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

module MetasploitModule

CachedSize = 12

include Msf::Payload::Single
include Msf::Sessions::CommandShellOptions

def initialize(info = {})
super(
merge_info(
info,
'Name' => 'mock payload which gives no session',
'Description' => 'mock payload which gives no session',
'Author' => ['unknown'],
'License' => MSF_LICENSE,
'Platform' => ['unix'],
'Arch' => ARCH_CMD,
# 'Handler' => Msf::Handler::ReverseTcp,
'Session' => Msf::Sessions::CommandShell,
'PayloadType' => 'cmd',
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
)
)
end

def wait_for_session(_t = wfs_delay)
# noop
end

def generate
'mock payload'
end
end
Loading

0 comments on commit e5241b4

Please sign in to comment.