Fixed MSF Tests
This commit is contained in:
38
rakefile
38
rakefile
@@ -1,3 +1,6 @@
|
||||
|
||||
@msf_process_id = nil;
|
||||
|
||||
desc "Run quick unit tests"
|
||||
task :quick_unit_tests do
|
||||
sh "cd test/unit/;ruby ts_beef.rb"
|
||||
@@ -5,15 +8,42 @@ end
|
||||
|
||||
desc "Run all unit tests"
|
||||
task :all_unit_tests => ["msf_install"] do
|
||||
Rake::Task['msf_update'].invoke
|
||||
Rake::Task['msf_start'].invoke
|
||||
sh "cd test/unit/;ruby ts_beef.rb"
|
||||
Rake::Task['msf_stop'].invoke
|
||||
end
|
||||
|
||||
task :msf_install do
|
||||
sh "cd test;svn co https://www.metasploit.com/svn/framework3/trunk/ msf"
|
||||
task :no_msf_tests do
|
||||
sh "cd test/unit/;ruby ts_beef.rb no_msf"
|
||||
end
|
||||
|
||||
task :msf_update do
|
||||
sh "cd test/msf;svn update"
|
||||
task :msf_start => 'test/msf-test/msfconsole' do
|
||||
printf "Starting MSF (wait 30 seconds)..."
|
||||
@msf_process_id = IO.popen("test/msf-test/msfconsole -r test/unit/BeEF.rc 2> /dev/null", "w+")
|
||||
(1..7).each do |i| # delay for 30 seconds
|
||||
printf '.'
|
||||
sleep (8-i) # increase the . display rate
|
||||
end
|
||||
puts '.'
|
||||
end
|
||||
|
||||
task :msf_stop do
|
||||
puts "\nShutting down MSF...\n"
|
||||
@msf_process_id.puts "quit"
|
||||
end
|
||||
|
||||
task :msf_install => 'test/msf-test/msfconsole' do
|
||||
# sh "cd test;git clone https://github.com/rapid7/metasploit-framework.git msf-test"
|
||||
end
|
||||
|
||||
task :msf_update => 'test/msf-test/msfconsole' do
|
||||
sh "cd test/msf-test;git pull"
|
||||
end
|
||||
|
||||
file 'test/msf-test/msfconsole' do
|
||||
puts "Installing MSF"
|
||||
sh "cd test;git clone https://github.com/rapid7/metasploit-framework.git msf-test"
|
||||
end
|
||||
|
||||
task :default => ["all_unit_tests"]
|
||||
|
||||
@@ -48,12 +48,6 @@ require './tc_grep'
|
||||
require './tc_filesystem'
|
||||
require './extensions/tc_metasploit'
|
||||
|
||||
begin
|
||||
puts "Starting MSF..."
|
||||
p2 = IO.popen("../msf/msfconsole -r ../unit/BeEF.rc", "w+")
|
||||
sleep 30
|
||||
end
|
||||
|
||||
class TS_BeefTests
|
||||
def self.suite
|
||||
suite = Test::Unit::TestSuite.new(name="BeEF TestSuite")
|
||||
@@ -64,14 +58,10 @@ class TS_BeefTests
|
||||
suite << TC_Filesystem.suite
|
||||
suite << TC_Grep.suite
|
||||
suite << TC_DynamicReconstruction.suite
|
||||
suite << TC_Metasploit.suite
|
||||
suite << TC_Metasploit.suite unless (ARGV[0] == 'no_msf')
|
||||
return suite
|
||||
end
|
||||
end
|
||||
|
||||
Test::Unit::UI::Console::TestRunner.run(TS_BeefTests)
|
||||
|
||||
begin
|
||||
puts "\nShutting down MSF...\n"
|
||||
p2.puts "quit"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user