adding scenarios for booting msfconsole without a db
parent
f80fd68480
commit
15a7ed0031
|
@ -52,6 +52,8 @@ tags
|
|||
|
||||
# Rails log directory
|
||||
/log
|
||||
# Rails tmp directory
|
||||
/tmp
|
||||
|
||||
# ignore release/debug folders for exploits
|
||||
external/source/exploits/**/Debug
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
##YAML Template
|
||||
---
|
||||
<% common = "--tags ~@wip --strict --tags ~@targets" %>
|
||||
default: <%= common %> features
|
||||
boot: <%= common %> --format html --out=features_report.html features
|
||||
default: <%= common %> --tags ~@boot features
|
||||
boot: <%= common %> --tags @boot features
|
|
@ -1,7 +1,7 @@
|
|||
@msfconsole
|
||||
Feature: Help command
|
||||
|
||||
Scenario: The Help commands output
|
||||
Scenario: The 'help' command's output
|
||||
When I type "help"
|
||||
And I type "exit"
|
||||
Then the output should contain:
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
@boot
|
||||
Feature: Launching `msfconsole`
|
||||
|
||||
@no-database-yml
|
||||
Scenario: Starting `msfconsole` without a database.yml
|
||||
Given I run `msfconsole` interactively
|
||||
And I wait for stdout to contain "Free Metasploit Pro trial: http://r-7.co/trymsp"
|
||||
When I type "db_status"
|
||||
And I type "exit"
|
||||
Then the output should contain "[*] postgresql selected, no connection"
|
||||
|
||||
@no-database-yml
|
||||
Scenario: Starting `msfconsole` with an invalid database.yml
|
||||
Given a file named "database.yml" with:
|
||||
"""
|
||||
development: &pgsql
|
||||
adapter: postgresql
|
||||
database: metasploit_framework_development
|
||||
username: postgres
|
||||
port: 6543
|
||||
pool: 5
|
||||
timeout: 5
|
||||
production:
|
||||
<<: *pgsql
|
||||
test:
|
||||
<<: *pgsql
|
||||
database: metasploit_framework_test
|
||||
"""
|
||||
Given I run `msfconsole -y database.yml` interactively
|
||||
And I wait for stdout to contain "Free Metasploit Pro trial: http://r-7.co/trymsp"
|
||||
When I type "db_status"
|
||||
And I type "exit"
|
||||
Then the output should contain "[-] Failed to connect to the database: could not connect to server"
|
||||
Then the output should contain "[*] postgresql selected, no connection"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -9,3 +9,21 @@ end
|
|||
Before('@targets') do
|
||||
step 'targets are loaded'
|
||||
end
|
||||
|
||||
Before('@no-database-yml') do
|
||||
if File.exists?('config/database.yml') && File.exists?('config/database.yml.local')
|
||||
FileUtils.rm('config/database.yml.local')
|
||||
FileUtils.mv('config/database.yml', 'config/database.yml.local')
|
||||
elsif File.exists?('config/database.yml')
|
||||
FileUtils.mv('config/database.yml', 'config/database.yml.local')
|
||||
end
|
||||
end
|
||||
|
||||
After('@no-database-yml') do
|
||||
if File.exists?('config/database.yml') && File.exists?('config/database.yml.local')
|
||||
FileUtils.rm('config/database.yml')
|
||||
FileUtils.mv('config/database.yml.local', 'config/database.yml')
|
||||
elsif File.exists?('config/database.yml.local')
|
||||
FileUtils.mv('config/database.yml.local', 'config/database.yml')
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@ begin
|
|||
|
||||
namespace :features do
|
||||
Cucumber::Rake::Task.new(:boot) do |t|
|
||||
t.profile = 'startup'
|
||||
t.profile = 'boot'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue