diff --git a/Gemfile b/Gemfile index d9c827c8a0..7aea56b7d3 100755 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,12 @@ group :development, :test do gem 'rspec', '>= 2.12', '< 3.0.0' # Define `rake spec`. Must be in development AND test so that its available by default as a rake test when the # environment is development - gem 'rspec-rails' , '>= 2.12', '< 3.0.0' + gem 'rspec-rails' , '>= 2.12', '< 3.0.0' + + gem 'cucumber' + + gem 'aruba' + end group :pcap do diff --git a/Gemfile.lock b/Gemfile.lock index 71511c4719..b281bb5823 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,9 +45,20 @@ GEM arel (3.0.3) arel-helpers (2.0.1) activerecord (>= 3.1.0, < 5) + aruba (0.6.0) + childprocess (>= 0.3.6) + cucumber (>= 1.1.1) + rspec-expectations (>= 2.7.0) bcrypt (3.1.7) builder (3.0.4) + childprocess (0.5.3) + ffi (~> 1.0, >= 1.0.11) coderay (1.1.0) + cucumber (1.2.1) + builder (>= 2.1.2) + diff-lcs (>= 1.1.3) + gherkin (~> 2.11.0) + json (>= 1.4.6) diff-lcs (1.2.5) erubis (2.7.0) factory_girl (4.4.0) @@ -55,7 +66,10 @@ GEM factory_girl_rails (4.4.1) factory_girl (~> 4.4.0) railties (>= 3.0.0) + ffi (1.9.3) fivemat (1.2.1) + gherkin (2.11.6) + json (>= 1.7.6) hike (1.2.3) i18n (0.6.11) journey (1.0.4) @@ -157,6 +171,8 @@ PLATFORMS DEPENDENCIES activerecord (>= 3.0.0, < 4.0.0) + aruba + cucumber factory_girl (>= 4.1.0) factory_girl_rails fivemat (= 1.2.1) diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 index 232a7351b2..b589c89409 --- a/Rakefile +++ b/Rakefile @@ -9,3 +9,15 @@ require 'metasploit/framework/require' Metasploit::Framework::Require.optionally_active_record_railtie Metasploit::Framework::Application.load_tasks + + +begin + require 'cucumber' + require 'cucumber/rake/task' + Cucumber::Rake::Task.new(:features) do |t| + t.cucumber_opts = 'features --format pretty' + end +rescue LoadError + puts "cucumber not in bundle, so can't set up feature tasks. " \ + "To run features ensure to install the development and test groups." +end \ No newline at end of file diff --git a/features/msfconsole.feature b/features/msfconsole.feature new file mode 100644 index 0000000000..0650062314 --- /dev/null +++ b/features/msfconsole.feature @@ -0,0 +1,20 @@ +Feature: test msfconsole + + Scenario: This works + When I run `msfconsole` interactively + And I type "help" + And I type "exit" + Then the output should contain: + """ + Commands + """ + + Scenario: stuff + When I run `msfconsole` interactively + And I type "use exploit/windows/smb/ms08_067_netapi" + And I type "set RHOST w2k3sp2-x86-u.vuln.lax.rapid7.com" + And I type "set PAYLOAD windows/meterpreter/bind_tcp" + And I type "run" + And I type "exit" + And I type "exit" + Then the output should match /Meterpreter session \d+ opened/ diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 0000000000..c55133d40d --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,11 @@ +require 'aruba/cucumber' +paths = [ + File.expand_path(File.join(File.dirname(__FILE__))), + File.expand_path(File.join(File.dirname(__FILE__), %w(.. ..))), + ENV['PATH'] +] +ENV['PATH'] = paths.join(File::PATH_SEPARATOR) +#"#{File.expand_path(File.join(File.dirname(__FILE__)))}#{File::PATH_SEPARATOR}#{ENV['PATH']}" +Before do + @aruba_timeout_seconds = 60 +end \ No newline at end of file diff --git a/features/support/stty b/features/support/stty new file mode 100755 index 0000000000..03538c00a8 --- /dev/null +++ b/features/support/stty @@ -0,0 +1,2 @@ +#!/bin/sh +exit 0 \ No newline at end of file