Skip to content

Commit e168280

Browse files
committed
Add changes after discussion with msf team
2 parents f6f8d7b + 341d8b0 commit e168280

File tree

942 files changed

+42616
-26259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

942 files changed

+42616
-26259
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Gemfile.local.lock
1313
.DS_Store
1414
# database config for testing
1515
config/database.yml
16+
# target config file for testing
17+
features/support/targets.yml
1618
# simplecov coverage data
1719
coverage
1820
doc/
@@ -48,6 +50,11 @@ tags
4850
*.opensdf
4951
*.user
5052

53+
# Rails log directory
54+
/log
55+
# Rails tmp directory
56+
/tmp
57+
5158
# ignore release/debug folders for exploits
5259
external/source/exploits/**/Debug
5360
external/source/exploits/**/Release

.rubocop.yml

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,78 @@
1-
LineLength:
2-
Enabled: true
3-
Max: 180
1+
# This list was intially created by analyzing the last three months (51
2+
# modules) committed to Metasploit Framework. Many, many older modules
3+
# will have offenses, but this should at least provide a baseline for
4+
# new modules.
5+
#
6+
# Updates to this file should include a 'Description' parameter for any
7+
# explaination needed.
48

5-
MethodLength:
6-
Enabled: true
7-
Max: 100
9+
# inherit_from: .rubocop_todo.yml
810

911
Style/ClassLength:
12+
Description: 'Most Metasploit modules are quite large. This is ok.'
13+
Enabled: true
1014
Exclude:
11-
# Most modules are quite large and all contained in one class. This is OK.
1215
- 'modules/**/*'
1316

17+
Style/Documentation:
18+
Enabled: true
19+
Description: 'Most Metasploit modules do not have class documentation.'
20+
Exclude:
21+
- 'modules/**/*'
22+
23+
Style/Encoding:
24+
Enabled: true
25+
Description: 'We prefer binary to UTF-8.'
26+
EnforcedStyle: 'when_needed'
27+
28+
Style/LineLength:
29+
Description: >-
30+
Metasploit modules often pattern match against very
31+
long strings when identifying targets.
32+
Enabled: true
33+
Max: 180
34+
35+
Style/MethodLength:
36+
Enabled: true
37+
Description: >-
38+
While the style guide suggests 10 lines, exploit definitions
39+
often exceed 200 lines.
40+
Max: 300
41+
42+
# Basically everything in metasploit needs binary encoding, not UTF-8.
43+
# Disable this here and enforce it through msftidy
44+
Style/Encoding:
45+
Enabled: false
46+
1447
Style/NumericLiterals:
1548
Enabled: false
49+
Description: 'This often hurts readability for exploit-ish code.'
50+
51+
Style/SpaceInsideBrackets:
52+
Enabled: false
53+
Description: 'Until module template are final, most modules will fail this.'
54+
55+
Style/StringLiterals:
56+
Enabled: false
57+
Description: 'Single vs double quote fights are largely unproductive.'
58+
59+
Style/WordArray:
60+
Enabled: false
61+
Description: 'Metasploit prefers consistent use of []'
62+
63+
Style/RedundantBegin:
64+
Exclude:
65+
# this pattern is very common and somewhat unavoidable
66+
# def run_host(ip)
67+
# begin
68+
# ...
69+
# rescue ...
70+
# ...
71+
# ensure
72+
# disconnect
73+
# end
74+
# end
75+
- 'modules/**/*'
1676

1777
Documentation:
1878
Exclude:

.simplecov

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ SimpleCov.configure do
3939
# Other library groups
4040
#
4141

42-
add_group 'Fastlib', 'lib/fastlib'
4342
add_group 'Metasm', 'lib/metasm'
4443
add_group 'PacketFu', 'lib/packetfu'
4544
add_group 'Rex', 'lib/rex'

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
env:
2+
- RAKE_TASK=cucumber
3+
- RAKE_TASK=cucumber:boot
4+
- RAKE_TASK=spec
5+
16
language: ruby
27
before_install:
38
- rake --version
@@ -14,6 +19,7 @@ before_script:
1419
- bundle exec rake --version
1520
- bundle exec rake db:create
1621
- bundle exec rake db:migrate
22+
script: "bundle exec rake $RAKE_TASK"
1723

1824
rvm:
1925
#- '1.8.7'

.yardopts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
--exclude \.ut\.rb/
44
--exclude \.ts\.rb/
55
--files CONTRIBUTING.md,COPYING,HACKING,LICENSE
6+
app/**/*.rb
67
lib/msf/**/*.rb
8+
lib/metasploit/**/*.rb
79
lib/rex/**/*.rb
810
plugins/**/*.rb

CONTRIBUTING.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
Thanks for your interest in making Metasploit -- and therefore, the
44
world -- a better place!
55

6-
Are you about to report a bug? If so, please use our [Redmine Bug
7-
Tracker](https://dev.metasploit.com/redmine/projects/framework). An
8-
account is required but it only takes a minute or two.
6+
Are you about to report a bug? Sorry to hear it.
97

10-
Are you about to report a security vulnerability in Metasploit?
11-
If so, please take a look at Rapid's [Vulnerability
12-
Disclosure Policy](https://www.rapid7.com/disclosure.jsp) policy.
8+
Here's our [Issue tracker](https://github.com/rapid7/metasploit-framework/issues).
9+
Please try to be as specific as you can about your problem, include steps
10+
to reproduce (cut and paste from your console output if it's helpful), and
11+
what you were expecting to happen.
12+
13+
Are you about to report a security vulnerability in Metasploit itself?
14+
How ironic! Please take a look at Rapid7's [Vulnerability
15+
Disclosure Policy](https://www.rapid7.com/disclosure.jsp), and send
16+
your report to [email protected] using [our PGP key](http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x2380F85B8AD4DB8D).
1317

1418
Are you about to contribute some new functionality, a bug fix, or a new
1519
Metasploit module? If so, read on...
@@ -33,7 +37,7 @@ and Metasploit's [Common Coding Mistakes](https://github.com/rapid7/metasploit-f
3337
## Code Contributions
3438

3539
* **Do** stick to the [Ruby style guide](https://github.com/bbatsov/ruby-style-guide).
36-
* Similarly, **try** to get Rubocop passing or at least relatively quiet against the files added/modified as part of your contribution
40+
* *Do* get [Rubocop](https://rubygems.org/search?query=rubocop) relatively quiet against the code you are adding or modifying.
3741
* **Do** follow the [50/72 rule](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for Git commit messages.
3842
* **Do** create a [topic branch](http://git-scm.com/book/en/Git-Branching-Branching-Workflows#Topic-Branches) to work on instead of working directly on `master`.
3943

@@ -64,18 +68,14 @@ Pull requests [#2940](https://github.com/rapid7/metasploit-framework/pull/2940)
6468
#### Bug Fixes
6569

6670
* **Do** include reproduction steps in the form of verification steps.
67-
* **Do** include a link to the corresponding [Redmine](https://dev.metasploit.com/redmine/projects/framework) issue in the format of `SeeRM #1234` in your commit description.
71+
* **Do** include a link to any corresponding [Issue](https://github.com/rapid7/metasploit-framework/issues) in the format of `See #1234` in your commit description.
6872

6973
## Bug Reports
7074

7175
* **Do** report vulnerabilities in Rapid7 software directly to [email protected].
72-
* **Do** create a Redmine account and report your non-vulnerability bugs there.
7376
* **Do** write a detailed description of your bug and use a descriptive title.
7477
* **Do** include reproduction steps, stack traces, and anything else that might help us verify and fix your bug.
7578
* **Don't** file duplicate reports - search for your bug before filing a new report.
76-
* **Don't** report a bug on GitHub. Use [Redmine](https://dev.metasploit.com/redmine/projects/framework) instead.
77-
78-
Redmine issues [#8762](https://dev.metasploit.com/redmine/issues/8762) and [#8764](https://dev.metasploit.com/redmine/issues/8764) are a couple good examples to follow.
7979

8080
If you need some more guidance, talk to the main body of open
8181
source contributors over on the [Freenode IRC channel](http://webchat.freenode.net/?channels=%23metasploit&uio=d4)

Gemfile

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,58 @@
11
source 'https://rubygems.org'
2-
3-
# Need 3+ for ActiveSupport::Concern
4-
gem 'activesupport', '>= 3.0.0', '< 4.0.0'
5-
# Needed for some admin modules (cfme_manageiq_evm_pass_reset.rb)
6-
gem 'bcrypt'
7-
# Needed for some admin modules (scrutinizer_add_user.rb)
8-
gem 'json'
9-
# Needed for Meterpreter on Windows, soon others.
10-
gem 'meterpreter_bins', '0.0.6'
11-
# Needed by msfgui and other rpc components
12-
gem 'msgpack'
13-
# Needed by anemone crawler
14-
gem 'nokogiri'
15-
# Needed by db.rb and Msf::Exploit::Capture
16-
gem 'packetfu', '1.1.9'
17-
# Needed by JSObfu
18-
gem 'rkelly-remix', '0.0.6'
19-
# Needed by anemone crawler
20-
gem 'robots'
21-
# Needed for some post modules
22-
gem 'sqlite3'
2+
# Add default group gems to `metasploit-framework.gemspec`:
3+
# spec.add_runtime_dependency '<name>', [<version requirements>]
4+
gemspec
235

246
group :db do
257
# Needed for Msf::DbManager
268
gem 'activerecord', '>= 3.0.0', '< 4.0.0'
9+
10+
# Metasploit::Credential database models
11+
gem 'metasploit-credential', '~> 0.12.0'
2712
# Database models shared between framework and Pro.
28-
gem 'metasploit_data_models', '0.17.0'
13+
gem 'metasploit_data_models', '~> 0.21.1'
2914
# Needed for module caching in Mdm::ModuleDetails
3015
gem 'pg', '>= 0.11'
3116
end
3217

33-
group :pcap do
34-
gem 'network_interface', '~> 0.0.1'
35-
# For sniffer and raw socket modules
36-
gem 'pcaprub'
37-
end
38-
3918
group :development do
40-
# Style/sanity checking Ruby code
41-
gem 'rubocop'
4219
# Markdown formatting for yard
4320
gem 'redcarpet'
4421
# generating documentation
4522
gem 'yard'
23+
# for development and testing purposes
24+
gem 'pry'
4625
end
4726

4827
group :development, :test do
4928
# supplies factories for producing model instance for specs
5029
# Version 4.1.0 or newer is needed to support generate calls without the
5130
# 'FactoryGirl.' in factory definitions syntax.
5231
gem 'factory_girl', '>= 4.1.0'
32+
# automatically include factories from spec/factories
33+
gem 'factory_girl_rails'
5334
# Make rspec output shorter and more useful
5435
gem 'fivemat', '1.2.1'
5536
# running documentation generation tasks and rspec tasks
5637
gem 'rake', '>= 10.0.0'
38+
# testing framework
39+
gem 'rspec', '>= 2.12', '< 3.0.0'
40+
# Define `rake spec`. Must be in development AND test so that its available by default as a rake test when the
41+
# environment is development
42+
gem 'rspec-rails' , '>= 2.12', '< 3.0.0'
43+
end
44+
45+
group :pcap do
46+
gem 'network_interface', '~> 0.0.1'
47+
# For sniffer and raw socket modules
48+
gem 'pcaprub'
5749
end
5850

5951
group :test do
60-
# Removes records from database created during tests. Can't use rspec-rails'
61-
# transactional fixtures because multiple connections are in use so
62-
# transactions won't work.
63-
gem 'database_cleaner'
64-
# testing framework
65-
gem 'rspec', '>= 2.12'
52+
# cucumber extension for testing command line applications, like msfconsole
53+
gem 'aruba'
54+
# cucumber + automatic database cleaning with database_cleaner
55+
gem 'cucumber-rails', :require => false
6656
gem 'shoulda-matchers'
6757
# code coverage for tests
6858
# any version newer than 0.5.4 gives an Encoding error when trying to read the source files.

Gemfile.local.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ end
2727

2828
# Create a custom group
2929
group :local do
30-
# Use pry to help view and interact with objects in the framework
31-
gem 'pry', '~> 0.9'
3230
# Use pry-debugger to step through code during development
3331
gem 'pry-debugger', '~> 0.2'
3432
# Add the lab gem so that the 'lab' plugin will work again

0 commit comments

Comments
 (0)