From da450f49a45256c8cc1c662d62725485a77c2733 Mon Sep 17 00:00:00 2001 From: Luke Imhoff Date: Tue, 21 Oct 2014 13:46:39 -0500 Subject: [PATCH] Fail rake spec if untested payloads MSP-11145 Add action to spec task that will cause spec to exit(1) if log/untested-payloads.log exists. The untested payloads are then printed with instructions of which spec to update. --- Rakefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Rakefile b/Rakefile index 232a7351b2..b9f7b530f4 100755 --- a/Rakefile +++ b/Rakefile @@ -9,3 +9,20 @@ require 'metasploit/framework/require' Metasploit::Framework::Require.optionally_active_record_railtie Metasploit::Framework::Application.load_tasks + +# append action to run after normal spec action +task :spec do + untested_payloads_pathname = Pathname.new 'log/untested-payloads.log' + + if untested_payloads_pathname.exist? + $stderr.puts "Untested payload detected. Add tests to spec/modules/payload_spec.rb for payloads classes composed of the following payload modules:" + + untested_payloads_pathname.open do |f| + f.each_line do |line| + $stderr.write " #{line}" + end + end + + exit 1 + end +end \ No newline at end of file