Browse Source

kill cucumber in framework

Brent Cook 1 year ago
parent
commit
dbef4ee816

+ 0
- 2
.travis.yml View File

@@ -16,8 +16,6 @@ rvm:
16 16
   - '2.4.1'
17 17
 
18 18
 env:
19
-# TODO: restore these tests when the code passes them!
20
-#  - CMD='bundle exec rake cucumber cucumber:boot CREATE_BINSTUBS=true'
21 19
   - CMD='bundle exec rake rspec-rerun:spec SPEC_OPTS="--tag content"'
22 20
   - CMD='bundle exec rake rspec-rerun:spec SPEC_OPTS="--tag ~content"'
23 21
 

+ 0
- 8
Gemfile View File

@@ -37,14 +37,6 @@ group :development, :test do
37 37
 end
38 38
 
39 39
 group :test do
40
-  # cucumber extension for testing command line applications, like msfconsole
41
-  gem 'aruba'
42
-  # cucumber + automatic database cleaning with database_cleaner
43
-  gem 'cucumber-rails', :require => false
44
-  gem 'shoulda-matchers'
45 40
   # Manipulate Time.now in specs
46 41
   gem 'timecop'
47
-  # Needed to work around a regression between capybara 2.7.1 and xpath 2.1
48
-  # XXX remove when capybara is updated to work with xpath 2.1
49
-  gem 'xpath', '2.0'
50 42
 end

+ 0
- 48
Gemfile.lock View File

@@ -102,46 +102,12 @@ GEM
102 102
     arel (6.0.4)
103 103
     arel-helpers (2.4.0)
104 104
       activerecord (>= 3.1.0, < 6)
105
-    aruba (0.14.2)
106
-      childprocess (~> 0.5.6)
107
-      contracts (~> 0.9)
108
-      cucumber (>= 1.3.19)
109
-      ffi (~> 1.9.10)
110
-      rspec-expectations (>= 2.99)
111
-      thor (~> 0.19)
112 105
     backports (3.8.0)
113 106
     bcrypt (3.1.11)
114 107
     bindata (2.4.0)
115 108
     bit-struct (0.16)
116 109
     builder (3.2.3)
117
-    capybara (2.14.4)
118
-      addressable
119
-      mime-types (>= 1.16)
120
-      nokogiri (>= 1.3.3)
121
-      rack (>= 1.0.0)
122
-      rack-test (>= 0.5.4)
123
-      xpath (~> 2.0)
124
-    childprocess (0.5.9)
125
-      ffi (~> 1.0, >= 1.0.11)
126 110
     coderay (1.1.1)
127
-    contracts (0.16.0)
128
-    cucumber (2.4.0)
129
-      builder (>= 2.1.2)
130
-      cucumber-core (~> 1.5.0)
131
-      cucumber-wire (~> 0.0.1)
132
-      diff-lcs (>= 1.1.3)
133
-      gherkin (~> 4.0)
134
-      multi_json (>= 1.7.5, < 2.0)
135
-      multi_test (>= 0.1.2)
136
-    cucumber-core (1.5.0)
137
-      gherkin (~> 4.0)
138
-    cucumber-rails (1.5.0)
139
-      capybara (>= 1.1.2, < 3)
140
-      cucumber (>= 1.3.8, < 4)
141
-      mime-types (>= 1.17, < 4)
142
-      nokogiri (~> 1.5)
143
-      railties (>= 4, < 5.2)
144
-    cucumber-wire (0.0.1)
145 111
     diff-lcs (1.3)
146 112
     dnsruby (1.60.1)
147 113
     docile (1.1.5)
@@ -153,10 +119,8 @@ GEM
153 119
       railties (>= 3.0.0)
154 120
     faraday (0.12.1)
155 121
       multipart-post (>= 1.2, < 3)
156
-    ffi (1.9.18)
157 122
     filesize (0.1.1)
158 123
     fivemat (1.3.5)
159
-    gherkin (4.1.3)
160 124
     google-protobuf (3.3.0)
161 125
     googleauth (0.5.1)
162 126
       faraday (~> 0.9)
@@ -216,14 +180,10 @@ GEM
216 180
       recog (~> 2.0)
217 181
     metasploit_payloads-mettle (0.1.10)
218 182
     method_source (0.8.2)
219
-    mime-types (3.1)
220
-      mime-types-data (~> 3.2015)
221
-    mime-types-data (3.2016.0521)
222 183
     mini_portile2 (2.2.0)
223 184
     minitest (5.10.2)
224 185
     msgpack (1.1.0)
225 186
     multi_json (1.12.1)
226
-    multi_test (0.1.2)
227 187
     multipart-post (2.0.0)
228 188
     nessus_rest (0.1.6)
229 189
     net-ssh (4.1.0)
@@ -358,8 +318,6 @@ GEM
358 318
     sawyer (0.8.1)
359 319
       addressable (>= 2.3.5, < 2.6)
360 320
       faraday (~> 0.8, < 1.0)
361
-    shoulda-matchers (3.1.1)
362
-      activesupport (>= 4.0.0)
363 321
     signet (0.7.3)
364 322
       addressable (~> 2.3)
365 323
       faraday (~> 0.9)
@@ -386,16 +344,12 @@ GEM
386 344
       activemodel (>= 4.2.7)
387 345
       activesupport (>= 4.2.7)
388 346
     xmlrpc (0.3.0)
389
-    xpath (2.0.0)
390
-      nokogiri (~> 1.3)
391 347
     yard (0.9.9)
392 348
 
393 349
 PLATFORMS
394 350
   ruby
395 351
 
396 352
 DEPENDENCIES
397
-  aruba
398
-  cucumber-rails
399 353
   factory_girl_rails
400 354
   fivemat
401 355
   metasploit-aggregator
@@ -406,10 +360,8 @@ DEPENDENCIES
406 360
   redcarpet
407 361
   rspec-rails
408 362
   rspec-rerun
409
-  shoulda-matchers
410 363
   simplecov
411 364
   timecop
412
-  xpath (= 2.0)
413 365
   yard
414 366
 
415 367
 BUNDLED WITH

+ 37
- 42
LICENSE_GEMS View File

@@ -1,71 +1,62 @@
1 1
 This file is auto-generated by tools/dev/update_gem_licenses.sh
2
-actionpack, 4.2.8, MIT
3
-actionview, 4.2.8, MIT
4
-activemodel, 4.2.8, MIT
5
-activerecord, 4.2.8, MIT
6
-activesupport, 4.2.8, MIT
2
+Ascii85, 1.0.2, MIT
3
+actionpack, 4.2.9, MIT
4
+actionview, 4.2.9, MIT
5
+activemodel, 4.2.9, MIT
6
+activerecord, 4.2.9, MIT
7
+activesupport, 4.2.9, MIT
7 8
 addressable, 2.5.1, "Apache 2.0"
9
+afm, 0.2.2, MIT
8 10
 arel, 6.0.4, MIT
9 11
 arel-helpers, 2.4.0, unknown
10
-aruba, 0.14.2, MIT
11 12
 backports, 3.8.0, MIT
12 13
 bcrypt, 3.1.11, MIT
13 14
 bindata, 2.4.0, ruby
14 15
 bit-struct, 0.16, ruby
15 16
 builder, 3.2.3, MIT
16
-bundler, 1.15.0, MIT
17
-capybara, 2.14.0, MIT
18
-childprocess, 0.5.9, MIT
17
+bundler, 1.15.1, MIT
19 18
 coderay, 1.1.1, MIT
20
-contracts, 0.16.0, "Simplified BSD"
21
-cucumber, 2.4.0, MIT
22
-cucumber-core, 1.5.0, MIT
23
-cucumber-rails, 1.5.0, MIT
24
-cucumber-wire, 0.0.1, MIT
25 19
 diff-lcs, 1.3, "MIT, Artistic-2.0, GPL-2.0+"
20
+dnsruby, 1.60.1, "Apache 2.0"
26 21
 docile, 1.1.5, MIT
27 22
 erubis, 2.7.0, MIT
28 23
 factory_girl, 4.8.0, MIT
29 24
 factory_girl_rails, 4.8.0, MIT
30 25
 faraday, 0.12.1, MIT
31
-ffi, 1.9.18, "New BSD"
32 26
 filesize, 0.1.1, MIT
33
-fivemat, 1.3.3, MIT
34
-gherkin, 4.1.3, MIT
27
+fivemat, 1.3.5, MIT
35 28
 google-protobuf, 3.3.0, "New BSD"
36 29
 googleauth, 0.5.1, "Apache 2.0"
37
-grpc, 1.3.4, "New BSD"
38
-i18n, 0.8.1, MIT
30
+grpc, 1.4.1, "New BSD"
31
+hashery, 2.1.2, "Simplified BSD"
32
+i18n, 0.8.6, MIT
39 33
 jsobfu, 0.4.2, "New BSD"
40 34
 json, 2.1.0, ruby
41 35
 jwt, 1.5.6, MIT
42 36
 little-plugger, 1.1.4, MIT
43 37
 logging, 2.2.2, MIT
44 38
 loofah, 2.0.3, MIT
45
-memoist, 0.15.0, MIT
39
+memoist, 0.16.0, MIT
46 40
 metasm, 1.0.3, LGPL
47 41
 metasploit-aggregator, 0.2.1, "New BSD"
48
-metasploit-concern, 2.0.4, "New BSD"
49
-metasploit-credential, 2.0.9, "New BSD"
50
-metasploit-framework, 4.14.23, "New BSD"
42
+metasploit-concern, 2.0.5, "New BSD"
43
+metasploit-credential, 2.0.10, "New BSD"
44
+metasploit-framework, 4.15.0, "New BSD"
51 45
 metasploit-model, 2.0.4, "New BSD"
52
-metasploit-payloads, 1.2.29, "3-clause (or ""modified"") BSD"
53
-metasploit_data_models, 2.0.14, "New BSD"
54
-metasploit_payloads-mettle, 0.1.9, "3-clause (or ""modified"") BSD"
46
+metasploit-payloads, 1.2.37, "3-clause (or ""modified"") BSD"
47
+metasploit_data_models, 2.0.15, "New BSD"
48
+metasploit_payloads-mettle, 0.1.10, "3-clause (or ""modified"") BSD"
55 49
 method_source, 0.8.2, MIT
56
-mime-types, 3.1, MIT
57
-mime-types-data, 3.2016.0521, MIT
58
-mini_portile2, 2.1.0, MIT
50
+mini_portile2, 2.2.0, MIT
59 51
 minitest, 5.10.2, MIT
60 52
 msgpack, 1.1.0, "Apache 2.0"
61 53
 multi_json, 1.12.1, MIT
62
-multi_test, 0.1.2, MIT
63 54
 multipart-post, 2.0.0, MIT
64 55
 nessus_rest, 0.1.6, MIT
65 56
 net-ssh, 4.1.0, MIT
66 57
 network_interface, 0.0.1, MIT
67
-nexpose, 6.0.0, BSD
68
-nokogiri, 1.7.2, MIT
58
+nexpose, 6.1.0, BSD
59
+nokogiri, 1.8.0, MIT
69 60
 octokit, 4.7.0, MIT
70 61
 openssl-ccm, 1.2.1, MIT
71 62
 openvas-omp, 0.0.4, MIT
@@ -73,6 +64,7 @@ os, 0.9.6, MIT
73 64
 packetfu, 1.1.13, BSD
74 65
 patch_finder, 1.0.2, "New BSD"
75 66
 pcaprub, 0.12.4, LGPL-2.1
67
+pdf-reader, 2.0.0, MIT
76 68
 pg, 0.20.0, "New BSD"
77 69
 pg_array_parser, 0.0.9, unknown
78 70
 postgres_ext, 3.0.0, MIT
@@ -83,14 +75,14 @@ rack-test, 0.6.3, MIT
83 75
 rails-deprecated_sanitizer, 1.0.3, MIT
84 76
 rails-dom-testing, 1.0.8, MIT
85 77
 rails-html-sanitizer, 1.0.3, MIT
86
-railties, 4.2.8, MIT
78
+railties, 4.2.9, MIT
87 79
 rake, 12.0.0, MIT
88 80
 rb-readline, 0.5.4, BSD
89
-recog, 2.1.8, unknown
81
+recog, 2.1.11, unknown
90 82
 redcarpet, 3.4.0, MIT
91
-rex-arch, 0.1.4, "New BSD"
92
-rex-bin_tools, 0.1.3, "New BSD"
93
-rex-core, 0.1.10, "New BSD"
83
+rex-arch, 0.1.9, "New BSD"
84
+rex-bin_tools, 0.1.4, "New BSD"
85
+rex-core, 0.1.11, "New BSD"
94 86
 rex-encoder, 0.1.4, "New BSD"
95 87
 rex-exploitation, 0.1.14, "New BSD"
96 88
 rex-java, 0.1.5, "New BSD"
@@ -101,23 +93,25 @@ rex-powershell, 0.1.72, "New BSD"
101 93
 rex-random_identifier, 0.1.2, "New BSD"
102 94
 rex-registry, 0.1.3, "New BSD"
103 95
 rex-rop_builder, 0.1.3, "New BSD"
104
-rex-socket, 0.1.6, "New BSD"
96
+rex-socket, 0.1.8, "New BSD"
105 97
 rex-sslscan, 0.1.4, "New BSD"
106 98
 rex-struct2, 0.1.2, "New BSD"
107 99
 rex-text, 0.2.15, "New BSD"
108 100
 rex-zip, 0.1.3, "New BSD"
109 101
 rkelly-remix, 0.0.7, MIT
110 102
 robots, 0.10.1, MIT
103
+rspec, 3.6.0, MIT
111 104
 rspec-core, 3.6.0, MIT
112 105
 rspec-expectations, 3.6.0, MIT
113 106
 rspec-mocks, 3.6.0, MIT
114 107
 rspec-rails, 3.6.0, MIT
108
+rspec-rerun, 1.1.0, MIT
115 109
 rspec-support, 3.6.0, MIT
116
-ruby_smb, 0.0.17, "New BSD"
110
+ruby-rc4, 0.1.5, MIT
111
+ruby_smb, 0.0.18, "New BSD"
117 112
 rubyntlm, 0.6.2, MIT
118 113
 rubyzip, 1.2.1, "Simplified BSD"
119 114
 sawyer, 0.8.1, MIT
120
-shoulda-matchers, 3.1.1, MIT
121 115
 signet, 0.7.3, "Apache 2.0"
122 116
 simplecov, 0.14.1, MIT
123 117
 simplecov-html, 0.10.1, MIT
@@ -126,10 +120,11 @@ sqlite3, 1.3.13, "New BSD"
126 120
 sshkey, 1.9.0, MIT
127 121
 thor, 0.19.4, MIT
128 122
 thread_safe, 0.3.6, "Apache 2.0"
129
-timecop, 0.8.1, MIT
123
+timecop, 0.9.1, MIT
124
+ttfunk, 1.5.1, "Nonstandard, GPL-2.0, GPL-3.0"
130 125
 tzinfo, 1.2.3, MIT
131 126
 tzinfo-data, 1.2017.2, MIT
132 127
 windows_error, 0.1.2, BSD
128
+xdr, 2.0.0, "Apache 2.0"
133 129
 xmlrpc, 0.3.0, ruby
134
-xpath, 2.1.0, MIT
135 130
 yard, 0.9.9, MIT

+ 0
- 111
features/commands/help.feature View File

@@ -1,111 +0,0 @@
1
-Feature: Help command
2
-
3
-  Background:
4
-    Given I run `msfconsole --defer-module-loads -q -x help -x exit`
5
-
6
-  Scenario: The 'help' command's output
7
-    Then the output should contain:
8
-      """
9
-      Core Commands
10
-      =============
11
-
12
-          Command       Description
13
-          -------       -----------
14
-          ?             Help menu
15
-          banner        Display an awesome metasploit banner
16
-          cd            Change the current working directory
17
-          color         Toggle color
18
-          connect       Communicate with a host
19
-          exit          Exit the console
20
-          get           Gets the value of a context-specific variable
21
-          getg          Gets the value of a global variable
22
-          grep          Grep the output of another command
23
-          help          Help menu
24
-          history       Show command history
25
-          irb           Drop into irb scripting mode
26
-          load          Load a framework plugin
27
-          quit          Exit the console
28
-          route         Route traffic through a session
29
-          save          Saves the active datastores
30
-          sessions      Dump session listings and display information about sessions
31
-          set           Sets a context-specific variable to a value
32
-          setg          Sets a global variable to a value
33
-          sleep         Do nothing for the specified number of seconds
34
-          spool         Write console output into a file as well the screen
35
-          threads       View and manipulate background threads
36
-          unload        Unload a framework plugin
37
-          unset         Unsets one or more context-specific variables
38
-          unsetg        Unsets one or more global variables
39
-          version       Show the framework and console library version numbers
40
-
41
-
42
-      Module Commands
43
-      ===============
44
-
45
-          Command       Description
46
-          -------       -----------
47
-          advanced      Displays advanced options for one or more modules
48
-          back          Move back from the current context
49
-          edit          Edit the current module with the preferred editor
50
-          info          Displays information about one or more modules
51
-          loadpath      Searches for and loads modules from a path
52
-          options       Displays global options or for one or more modules
53
-          popm          Pops the latest module off the stack and makes it active
54
-          previous      Sets the previously loaded module as the current module
55
-          pushm         Pushes the active or list of modules onto the module stack
56
-          reload_all    Reloads all modules from all defined module paths
57
-          search        Searches module names and descriptions
58
-          show          Displays modules of a given type, or all modules
59
-          use           Selects a module by name
60
-
61
-
62
-      Job Commands
63
-      ============
64
-
65
-          Command       Description
66
-          -------       -----------
67
-          handler       Start a payload handler as job
68
-          jobs          Displays and manages jobs
69
-          kill          Kill a job
70
-          rename_job    Rename a job
71
-
72
-
73
-      Resource Script Commands
74
-      ========================
75
-
76
-          Command       Description
77
-          -------       -----------
78
-          makerc        Save commands entered since start to a file
79
-          resource      Run the commands stored in a file
80
-
81
-
82
-      Database Backend Commands
83
-      =========================
84
-
85
-          Command           Description
86
-          -------           -----------
87
-          db_connect        Connect to an existing database
88
-          db_disconnect     Disconnect from the current database instance
89
-          db_export         Export a file containing the contents of the database
90
-          db_import         Import a scan result file (filetype will be auto-detected)
91
-          db_nmap           Executes nmap and records the output automatically
92
-          db_rebuild_cache  Rebuilds the database-stored module cache
93
-          db_status         Show the current database status
94
-          hosts             List all hosts in the database
95
-          loot              List all loot in the database
96
-          notes             List all notes in the database
97
-          services          List all services in the database
98
-          vulns             List all vulnerabilities in the database
99
-          workspace         Switch between database workspaces
100
-
101
-
102
-    Credentials Backend Commands
103
-    ============================
104
-
105
-          Command       Description
106
-          -------       -----------
107
-          creds         List all credentials in the database
108
-
109
-
110
-      """
111
-

+ 0
- 48
features/modules/exploit/smb/ms08_067_netapi.feature View File

@@ -1,48 +0,0 @@
1
-@targets @db
2
-Feature: MS08-067 netapi
3
-
4
-  Background:
5
-    Given a directory named "home"
6
-    And I cd to "home"
7
-    And a mocked home directory
8
-
9
-  Scenario: The MS08-067 should get a session with bind_tcp
10
-    Given I ready the windows targets
11
-    Given a file named "ms08-067-bind.rc" with:
12
-      """
13
-      <ruby>
14
-      self.run_single("spool #{Rails.root.join('tmp', 'console.log')}")
15
-      hosts           = YAML.load File.open Rails.root.join('features', 'support', 'targets.yml')
16
-      payload_name    = 'windows/meterpreter/bind_tcp'
17
-      exploited_hosts = []
18
-      failed_hosts    = []
19
-
20
-      hosts.each do |host|
21
-        print_status("Trying MS08-067 against #{host['ipAddress']}")
22
-        mod = framework.exploits.create('windows/smb/ms08_067_netapi')
23
-        mod.datastore['PAYLOAD'] = payload_name
24
-        mod.datastore['RHOST'] = host['ipAddress']
25
-        m = mod.exploit_simple(
26
-          'LocalInput'  => nil,
27
-          'LocalOutput' => nil,
28
-          'Payload'     => payload_name,
29
-          'RunAsJob'    => false
30
-        )
31
-
32
-        sleep(1)
33
-
34
-        if m
35
-          exploited_hosts << host['ipAddress']
36
-        else
37
-          failed_hosts << host['ipAddress']
38
-        end
39
-      end
40
-
41
-      print_status("Exploited hosts: #{exploited_hosts.inspect}")
42
-      print_status("Failed hosts: #{failed_hosts.inspect}")
43
-      self.run_single('sessions -K')
44
-      </ruby>
45
-      """
46
-    When I successfully run `msfconsole --environment test -q -r ms08-067-bind.rc -x exit` for up to 100 seconds
47
-    Then the 'Mdm::Host' table contains the expected targets
48
-    

+ 0
- 153
features/msfconsole/database_yml.feature View File

@@ -1,153 +0,0 @@
1
-@boot
2
-Feature: `msfconsole` `database.yml`
3
-
4
-  In order to connect to the database in `msfconsole`
5
-  As a user calling `msfconsole` from a terminal
6
-  I want to be able to set the path of the `database.yml` in one of 4 locations (in order of precedence):
7
-
8
-  1. An explicit argument to the `-y` flag to `msfconsole`
9
-  2. The MSF_DATABASE_CONFIG environment variable
10
-  3. The user's `~/.msf4/database.yml`
11
-  4. `config/database.yml` in the metasploit-framework checkout location.
12
-
13
-  Scenario: With all 4 locations, --yaml wins
14
-    Given a file named "command_line.yml" with:
15
-      """
16
-      test:
17
-        adapter: postgresql
18
-        database: command_line_metasploit_framework_test
19
-        username: command_line_metasploit_framework_test
20
-      """
21
-    And a file named "msf_database_config.yml" with:
22
-      """
23
-      test:
24
-        adapter: postgresql
25
-        database: environment_metasploit_framework_test
26
-        username: environment_metasploit_framework_test
27
-      """
28
-    And I set the environment variables to:
29
-      | variable            | value                   |
30
-      | MSF_DATABASE_CONFIG | msf_database_config.yml |
31
-    And a directory named "home"
32
-    And I cd to "home"
33
-    And a mocked home directory
34
-    And a directory named ".msf4"
35
-    And I cd to ".msf4"
36
-    And a file named "database.yml" with:
37
-      """
38
-      test:
39
-        adapter: postgresql
40
-        database: user_metasploit_framework_test
41
-        username: user_metasploit_framework_test
42
-      """
43
-    And I cd to "../.."
44
-    And the project "database.yml" exists with:
45
-      """
46
-      test:
47
-        adapter: postgresql
48
-        database: project_metasploit_framework_test
49
-        username: project_metasploit_framework_test
50
-      """
51
-    When I run `msfconsole -q --defer-module-loads --environment test --execute-command exit --yaml command_line.yml`
52
-    Then the output should contain "command_line_metasploit_framework_test"
53
-
54
-  Scenario: Without --yaml, MSF_DATABASE_CONFIG wins
55
-    Given a file named "msf_database_config.yml" with:
56
-      """
57
-      test:
58
-        adapter: postgresql
59
-        database: environment_metasploit_framework_test
60
-        username: environment_metasploit_framework_test
61
-      """
62
-    And I set the environment variables to:
63
-      | variable            | value                   |
64
-      | MSF_DATABASE_CONFIG | msf_database_config.yml |
65
-    And a directory named "home"
66
-    And I cd to "home"
67
-    And a mocked home directory
68
-    And a directory named ".msf4"
69
-    And I cd to ".msf4"
70
-    And a file named "database.yml" with:
71
-      """
72
-      test:
73
-        adapter: postgresql
74
-        database: user_metasploit_framework_test
75
-        username: user_metasploit_framework_test
76
-      """
77
-    And I cd to "../.."
78
-    And the project "database.yml" exists with:
79
-      """
80
-      test:
81
-        adapter: postgresql
82
-        database: project_metasploit_framework_test
83
-        username: project_metasploit_framework_test
84
-      """
85
-    When I run `msfconsole -q --defer-module-loads --environment test --execute-command exit`
86
-    Then the output should contain "environment_metasploit_framework_test"
87
-
88
-  Scenario: Without --yaml or MSF_DATABASE_CONFIG, ~/.msf4/database.yml wins
89
-    Given I unset the environment variables:
90
-      | variable            |
91
-      | MSF_DATABASE_CONFIG |
92
-    And a directory named "home"
93
-    And I cd to "home"
94
-    And a mocked home directory
95
-    And a directory named ".msf4"
96
-    And I cd to ".msf4"
97
-    And a file named "database.yml" with:
98
-      """
99
-      test:
100
-        adapter: postgresql
101
-        database: user_metasploit_framework_test
102
-        username: user_metasploit_framework_test
103
-      """
104
-    And I cd to "../.."
105
-    And the project "database.yml" exists with:
106
-      """
107
-      test:
108
-        adapter: postgresql
109
-        database: project_metasploit_framework_test
110
-        username: project_metasploit_framework_test
111
-      """
112
-    When I run `msfconsole -q --defer-module-loads --environment test --execute-command exit`
113
-    Then the output should contain "user_metasploit_framework_test"
114
-
115
-  Scenario: Without --yaml, MSF_DATABASE_CONFIG or ~/.msf4/database.yml, project "database.yml" wins
116
-    Given I unset the environment variables:
117
-      | variable            |
118
-      | MSF_DATABASE_CONFIG |
119
-    And a directory named "home"
120
-    And I cd to "home"
121
-    And a mocked home directory
122
-    And I cd to "../.."
123
-    And the project "database.yml" exists with:
124
-      """
125
-      test:
126
-        adapter: postgresql
127
-        database: project_metasploit_framework_test
128
-        username: project_metasploit_framework_test
129
-      """
130
-    When I run `msfconsole -q --defer-module-loads --environment test --execute-command db_status --execute-command exit`
131
-    Then the output should contain "project_metasploit_framework_test"
132
-
133
-
134
-  Scenario: Without --yaml, MSF_DATABASE_CONFIG, ~/.msf4/database.yml, or project "database.yml", no database connection
135
-    Given I unset the environment variables:
136
-      | variable            |
137
-      | MSF_DATABASE_CONFIG |
138
-    And a directory named "home"
139
-    And I cd to "home"
140
-    And a mocked home directory
141
-    And I cd to "../.."
142
-    And the project "database.yml" does not exist
143
-    When I run `msfconsole -q --defer-module-loads --environment test --execute-command db_status --execute-command exit`
144
-    Then the output should not contain "command_line_metasploit_framework_test"
145
-    And the output should not contain "environment_metasploit_framework_test"
146
-    And the output should not contain "user_metasploit_framework_test"
147
-    And the output should not contain "project_metasploit_framework_test"
148
-    And the output should contain "[*] postgresql selected, no connection"
149
-
150
-  Scenario: Starting `msfconsole` with a valid database.yml
151
-    When I run `msfconsole -q --defer-module-loads --execute-command db_status --execute-command exit`
152
-    Then the output should contain "[*] postgresql connected to metasploit_framework_test"
153
-

+ 0
- 20
features/step_definitions/environment_variables.rb View File

@@ -1,20 +0,0 @@
1
-Given /^I unset the environment variables:$/ do |table|
2
-  table.hashes.each do |row|
3
-    variable = row['variable'].to_s.upcase
4
-
5
-    # @todo add extension to Announcer
6
-    announcer.instance_eval do
7
-      if @options[:env]
8
-        print "$ unset #{variable}"
9
-      end
10
-    end
11
-
12
-    current_value = ENV.delete(variable)
13
-
14
-    # if original_env already has the key, then the true original was already recorded from a previous unset or set,
15
-    # so don't record the current value as it will cause ENV not to be restored after the Scenario.
16
-    unless original_env.key? variable
17
-      original_env[variable] = current_value
18
-    end
19
-  end
20
-end

+ 0
- 14
features/step_definitions/project.rb View File

@@ -1,14 +0,0 @@
1
-require 'metasploit/framework/database/cucumber'
2
-
3
-Given /^the project "database.yml" does not exist$/ do
4
-  Metasploit::Framework::Database::Cucumber.backup_project_configurations
5
-end
6
-
7
-Given /^the project "database.yml" exists with:$/ do |file_content|
8
-  Metasploit::Framework::Database::Cucumber.backup_project_configurations
9
-  File.open(Metasploit::Framework::Database::Cucumber.project_configurations_path, 'wb') { |file| file.write(file_content) }
10
-end
11
-
12
-After do
13
-  Metasploit::Framework::Database::Cucumber.restore_project_configurations
14
-end

+ 0
- 26
features/support/bin/stty View File

@@ -1,26 +0,0 @@
1
-#!/usr/bin/env ruby
2
-
3
-case ARGV[0]
4
-  when 'size'
5
-    puts "30 134"
6
-  when '-a'
7
-    puts <<EOS
8
-speed 38400 baud; 30 rows; 134 columns;
9
-lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
10
-	-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
11
-	-extproc
12
-iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
13
-	-ignbrk brkint -inpck -ignpar -parmrk
14
-oflags: opost onlcr -oxtabs -onocr -onlret
15
-cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
16
-	-dtrflow -mdmbuf
17
-cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
18
-	eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
19
-	min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
20
-	stop = ^S; susp = ^Z; time = 0; werase = ^W;
21
-EOS
22
-  when '-g'
23
-    puts "gfmt1:cflag=4b00:iflag=6b02:lflag=200005cf:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=38400:ospeed=38400"
24
-end
25
-
26
-exit 0

+ 0
- 34
features/support/env.rb View File

@@ -1,34 +0,0 @@
1
-# @note `require 'simplecov'` is not used here because all features currently use external `msfconsole` process, so only
2
-#   that child process needs to load 'simplecov'.
3
-
4
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
5
-# It is recommended to regenerate this file in the future when you upgrade to a 
6
-# newer version of cucumber-rails. Consider adding your own code to a new file 
7
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
8
-# files.
9
-
10
-require 'cucumber/rails'
11
-require 'aruba/cucumber'
12
-
13
-# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
14
-# order to ease the transition to Capybara we set the default here. If you'd
15
-# prefer to use XPath just remove this line and adjust any selectors in your
16
-# steps to use the XPath syntax.
17
-Capybara.default_selector = :css
18
-
19
-# By default, any exception happening in your Rails application will bubble up
20
-# to Cucumber so that your scenario will fail. This is a different from how 
21
-# your application behaves in the production environment, where an error page will 
22
-# be rendered instead.
23
-#
24
-# Sometimes we want to override this default behaviour and allow Rails to rescue
25
-# exceptions and display an error page (just like when the app is running in production).
26
-# Typical scenarios where you want to do this is when you test your error pages.
27
-# There are two ways to allow Rails to rescue exceptions:
28
-#
29
-# 1) Tag your scenario (or feature) with @allow-rescue
30
-#
31
-# 2) Set the value below to true. Beware that doing this globally is not
32
-# recommended as it will mask a lot of errors for you!
33
-#
34
-ActionController::Base.allow_rescue = false

+ 0
- 39
features/support/hooks.rb View File

@@ -1,39 +0,0 @@
1
-Before do
2
-  set_env('MSF_DATBASE_CONFIG', Rails.configuration.paths['config/database'].existent.first)
3
-  set_env('RAILS_ENV', 'test')
4
-  @aruba_timeout_seconds = 8.minutes
5
-end
6
-
7
-Before('@db') do |scenario|
8
-  dbconfig = YAML::load(File.open(Metasploit::Framework::Database.configurations_pathname))
9
-  ActiveRecord::Base.establish_connection(dbconfig["test"])
10
-end
11
-
12
-# don't setup child processes to load simplecov_setup.rb if simplecov isn't installed
13
-# unless Bundler.settings.without.include?(:coverage)
14
-#   Before do |scenario|
15
-#     command_name = case scenario
16
-#                    when Cucumber::Ast::Scenario, Cucumber::Ast::ScenarioOutline
17
-#                      "#{scenario.feature.title} #{scenario.name}"
18
-#                    when Cucumber::Ast::OutlineTable::ExampleRow
19
-#                      scenario_outline = scenario.scenario_outline
20
-#
21
-#                      "#{scenario_outline.feature.title} #{scenario_outline.name} #{scenario.name}"
22
-#                    else
23
-#                      raise TypeError, "Don't know how to extract command name from #{scenario.class}"
24
-#                    end
25
-#
26
-#     # Used in simplecov_setup so that each scenario has a different name and their coverage results are merged instead
27
-#     # of overwriting each other as 'Cucumber Features'
28
-#     set_env('SIMPLECOV_COMMAND_NAME', command_name)
29
-#
30
-#     simplecov_setup_pathname = Pathname.new(__FILE__).expand_path.parent.join('simplecov_setup')
31
-#     # set environment variable so child processes will merge their coverage data with parent process's coverage data.
32
-#     set_env('RUBYOPT', "#{ENV['RUBYOPT']} -r#{simplecov_setup_pathname}")
33
-#   end
34
-#
35
-#   Before('@db') do |scenario|
36
-#     dbconfig = YAML::load(File.open(Metasploit::Framework::Database.configurations_pathname))
37
-#     ActiveRecord::Base.establish_connection(dbconfig["test"])
38
-#   end
39
-# end

+ 0
- 16
features/support/simplecov_setup.rb View File

@@ -1,16 +0,0 @@
1
-# @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for child processes
2
-
3
-simplecov_command_name = ENV['SIMPLECOV_COMMAND_NAME']
4
-
5
-# will not be set if hook does not run because `bundle install --without coverage`
6
-if simplecov_command_name
7
-  require 'simplecov'
8
-
9
-  require 'pathname'
10
-
11
-  root = Pathname(__FILE__).expand_path.parent.parent.parent
12
-
13
-  SimpleCov.command_name(simplecov_command_name)
14
-  SimpleCov.root(root)
15
-  load root.join('.simplecov')
16
-end

+ 0
- 11
features/support/stty.rb View File

@@ -1,11 +0,0 @@
1
-require 'pathname'
2
-
3
-support = Pathname.new(__FILE__).realpath.parent
4
-
5
-paths = [
6
-    # adds support/bin at the front of the path so that the support/bin/stty script will be used to fake system stty
7
-    # output.
8
-    support.join('bin').to_path,
9
-    ENV['PATH']
10
-]
11
-ENV['PATH'] = paths.join(File::PATH_SEPARATOR)

+ 0
- 7
features/support/targets.yml.example View File

@@ -1,7 +0,0 @@
1
-windows:
2
-  -
3
-    hostname: wxpsp0
4
-    ip: 127.0.0.100
5
-  -
6
-    hostname: wxpsp2
7
-    ip: 127.0.0.101

+ 0
- 36
lib/metasploit/framework/database/cucumber.rb View File

@@ -1,36 +0,0 @@
1
-require 'metasploit/framework/database'
2
-
3
-module Metasploit::Framework::Database::Cucumber
4
-  def self.project_configurations_path
5
-    Rails.root.join('config', 'database.yml').to_path
6
-  end
7
-
8
-  def self.backup_project_configurations
9
-    if File.exist?(project_configurations_path)
10
-      # assume that the backup file is from a previously aborted run and it contains the real database.yml data, so
11
-      # just delete the fake database.yml and the After hook will restore the real database.yml from the backup location
12
-      if File.exist?(backup_project_configurations_path)
13
-        File.delete(project_configurations_path)
14
-      else
15
-        # project contains the real database.yml and there was no previous, aborted run.
16
-        File.rename(project_configurations_path, backup_project_configurations_path)
17
-      end
18
-    end
19
-  end
20
-
21
-  def self.backup_project_configurations_path
22
-    "#{project_configurations_path}.cucumber.bak"
23
-  end
24
-
25
-  def self.restore_project_configurations
26
-    if File.exist?(backup_project_configurations_path)
27
-      if File.exist?(project_configurations_path)
28
-        # Remove fake, leftover database.yml
29
-        File.delete(project_configurations_path)
30
-      end
31
-
32
-      File.rename(backup_project_configurations_path, project_configurations_path)
33
-    end
34
-  end
35
-end
36
-

+ 0
- 74
lib/tasks/cucumber.rake View File

@@ -1,74 +0,0 @@
1
-# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
-# It is recommended to regenerate this file in the future when you upgrade to a 
3
-# newer version of cucumber-rails. Consider adding your own code to a new file 
4
-# instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
-# files.
6
-
7
-
8
-unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
-
10
-vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
-$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
-
13
-begin
14
-  require 'cucumber/rake/task'
15
-
16
-  namespace :cucumber do
17
-    Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
18
-      t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
-      t.fork = true # You may get faster startup if you set this to false
20
-      t.profile = 'default'
21
-    end
22
-
23
-    Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
24
-      t.binary = vendored_cucumber_bin
25
-      t.fork = true # You may get faster startup if you set this to false
26
-      t.profile = 'wip'
27
-    end
28
-
29
-    Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
-      t.binary = vendored_cucumber_bin
31
-      t.fork = true # You may get faster startup if you set this to false
32
-      t.profile = 'rerun'
33
-    end
34
-
35
-    desc 'Run all features'
36
-    task :all => [:ok, :wip]
37
-
38
-    task :statsetup do
39
-      require 'rails/code_statistics'
40
-      ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
-      ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42
-    end
43
-  end
44
-  desc 'Alias for cucumber:ok'
45
-  task :cucumber => 'cucumber:ok'
46
-
47
-  task :default => :cucumber
48
-
49
-  task :features => :cucumber do
50
-    STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
51
-  end
52
-
53
-  # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
54
-  task 'db:test:prepare' do
55
-  end
56
-
57
-  task 'db:config:restore' do
58
-    require 'metasploit/framework/database/cucumber'
59
-    Metasploit::Framework::Database::Cucumber.restore_project_configurations
60
-  end
61
-
62
-  # Restore the config/database.yml from config/database.cucumber.yml before attempting to copy development to test
63
-  # database in order to recover from interrupted cucumber runs
64
-  task 'environment' => 'db:config:restore'
65
-
66
-  task :stats => 'cucumber:statsetup'
67
-rescue LoadError
68
-  desc 'cucumber rake task not available (cucumber not installed)'
69
-  task :cucumber do
70
-    abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
71
-  end
72
-end
73
-
74
-end

+ 0
- 30
lib/tasks/custom_cucumber.rake View File

@@ -1,30 +0,0 @@
1
-unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
2
-
3
-vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
4
-$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
5
-
6
-begin
7
-  require 'cucumber/rake/task'
8
-
9
-  namespace :cucumber do
10
-    Cucumber::Rake::Task.new({:boot => 'db:test:prepare'}, 'Run features that should pass') do |t|
11
-      t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
12
-      t.fork = true # You may get faster startup if you set this to false
13
-      t.profile = 'boot'
14
-    end
15
-    Cucumber::Rake::Task.new({:exploit => 'db:test:prepare'}, 'Run features that should pass') do |t|
16
-      t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
17
-      t.fork = true # You may get faster startup if you set this to false
18
-      t.profile = 'exploit'
19
-    end
20
-    
21
-  end
22
-
23
-rescue LoadError
24
-  desc 'cucumber rake task not available (cucumber not installed)'
25
-  task :cucumber do
26
-    abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
27
-  end
28
-end
29
-
30
-end

+ 0
- 10
script/cucumber View File

@@ -1,10 +0,0 @@
1
-#!/usr/bin/env ruby
2
-
3
-vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
4
-if vendored_cucumber_bin
5
-  load File.expand_path(vendored_cucumber_bin)
6
-else
7
-  require 'rubygems' unless ENV['NO_RUBYGEMS']
8
-  require 'cucumber'
9
-  load Cucumber::BINARY
10
-end

Loading…
Cancel
Save