From 5a83e1f5ed22de7fdea1cd9aa0c730c95ae249a8 Mon Sep 17 00:00:00 2001 From: Wade Alcorn Date: Thu, 12 Jan 2012 19:03:44 +1000 Subject: [PATCH] Added start and stop beef tasks to the rake tests --- rakefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rakefile b/rakefile index 955c32aea..161d8a456 100644 --- a/rakefile +++ b/rakefile @@ -30,7 +30,9 @@ end desc "Run integration unit tests" task :integration => ["install"] do + Rake::Task['beef_start'].invoke sh "cd test/integration;ruby -W0 ts_integration.rb" + Rake::Task['beef_stop'].invoke end desc "Run integration unit tests" @@ -50,6 +52,28 @@ task :install do sh "bundle > /dev/null" end +################################ +# BeEF environment set up + +@beef_process_id = nil; + +task :beef_start => 'beef' do + printf "Starting BeEF (wait 10 seconds)..." + @beef_process_id = IO.popen("./beef -x 2> /dev/null", "w+") + delays = [2, 2, 1, 1, 1, 0.5, 0.5 , 0.5, 0.3, 0.2, 0.1, 0.1, 0.1, 0.05, 0.05] + delays.each do |i| # delay for 10 seconds + printf '.' + sleep (i) # increase the . display rate + end + puts '.' +end + +task :beef_stop do + puts "\nShutting down BeEF...\n" + puts @beef_process_id.pid + Process.kill 'INT', -Process.getpgrp +end + ################################ # MSF environment set up