Skip to content

Commit c6bbc5b

Browse files
committed
Merge branch 'landing-4055' into upstream-master
2 parents 5e0993d + dae114a commit c6bbc5b

File tree

12 files changed

+3697
-1
lines changed

12 files changed

+3697
-1
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
env:
22
- RAKE_TASK=cucumber
33
- RAKE_TASK=cucumber:boot
4-
- RAKE_TASK=spec
4+
- RAKE_TASK=spec SPEC_OPTS="--tag content"
5+
- RAKE_TASK=spec SPEC_OPTS="--tag ~content"
56

67
language: ruby
78
before_install:

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env rake
22
require File.expand_path('../config/application', __FILE__)
33
require 'metasploit/framework/require'
4+
require 'metasploit/framework/spec/untested_payloads'
45

56
# @note must be before `Metasploit::Framework::Application.load_tasks`
67
#
@@ -9,3 +10,4 @@ require 'metasploit/framework/require'
910
Metasploit::Framework::Require.optionally_active_record_railtie
1011

1112
Metasploit::Framework::Application.load_tasks
13+
Metasploit::Framework::Spec::UntestedPayloads.define_task
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# @note needs to use explicit nesting. so this file can be loaded directly without loading 'metasploit/framework' which
2+
# allows for faster loading of rake tasks.
3+
module Metasploit
4+
module Framework
5+
module Spec
6+
module UntestedPayloads
7+
# @note `Metasploit::Framework::Spec::UntestedPayloads.define_task` should be run after the normal spec task is
8+
# defined.
9+
#
10+
# Adds action to `spec` tasks so that `rake spec` fails if `log/untested-payloads.log` exists and prints out untested
11+
# payloads from that log to stderr.
12+
#
13+
# # @example Using `Metasploit::Framework::Spec::UntestedPayloads.define_task` with 'payload can be instantiated' shared examples and 'untested payloads' shared context
14+
# # Rakefile
15+
# require 'metasploit/framework/spec/untested_payloads'
16+
#
17+
# # defined spec task with rspec-rails
18+
# My::Application.load_tasks
19+
# # extends spec task to fail when there are untested payloads
20+
# Metasploit::Framework::Spec::UntestedPayloads.define_task
21+
#
22+
# # spec/modules/payloads_spec.rb
23+
# require 'spec_helper'
24+
#
25+
# describe 'modules/payloads' do
26+
# modules_pathname = Pathname.new(__FILE__).parent.parent.parent.join('modules')
27+
#
28+
# include_context 'untested payloads', modules_pathname: modules_pathname
29+
#
30+
# context 'my/staged/payload/handler' do
31+
# it_should_behave_like 'payload can be instantiated',
32+
# ancestor_reference_names: [
33+
# 'stages/my/payload',
34+
# 'stagers/my/payload/handler'
35+
# ],
36+
# modules_pathname: modules_pathname,
37+
# reference_name: 'my/staged/payload/handler'
38+
# end
39+
# end
40+
#
41+
# @return [void]
42+
def self.define_task
43+
Rake::Task.define_task :spec do
44+
untested_payloads_pathname = Pathname.new 'log/untested-payloads.log'
45+
46+
if untested_payloads_pathname.exist?
47+
tool_path = 'tools/missing-payload-tests.rb'
48+
49+
$stderr.puts "Untested payload detected. Running `#{tool_path}` to see contexts to add to " \
50+
"`spec/modules/payloads_spec.rb` to test those payload ancestor reference names."
51+
52+
system(tool_path)
53+
54+
exit 1
55+
end
56+
end
57+
end
58+
end
59+
end
60+
end
61+
end

lib/msf/core/payload/windows/dllinject.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: binary -*-
22
require 'msf/core'
3+
require 'msf/core/payload/windows'
34

45
module Msf
56

modules/exploits/linux/local/pkexec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6+
#
7+
# Project
8+
#
9+
10+
require 'msf/core/exploit/local/linux'
11+
612
class Metasploit4 < Msf::Exploit::Local
713
Rank = GreatRanking
814

0 commit comments

Comments
 (0)