Skip to content

Commit 8329a15

Browse files
committed
Merge branch 'upstream/master' into group_tlv_refactors
2 parents cceb146 + d6f4c02 commit 8329a15

File tree

3,815 files changed

+100069
-61737
lines changed

Some content is hidden

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

3,815 files changed

+100069
-61737
lines changed

.gitignore

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.bundle
2+
Gemfile.local
3+
Gemfile.local.lock
24
# Rubymine project directory
35
.idea
46
# Sublime Text project directory (not created by ST by default)
@@ -11,10 +13,10 @@
1113
.DS_Store
1214
# database config for testing
1315
config/database.yml
16+
# target config file for testing
17+
features/support/targets.yml
1418
# simplecov coverage data
1519
coverage
16-
data/meterpreter/ext_server_pivot.x86.dll
17-
data/meterpreter/ext_server_pivot.x64.dll
1820
doc/
1921
external/source/meterpreter/java/bin
2022
external/source/meterpreter/java/build
@@ -48,6 +50,30 @@ 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
61+
62+
# Avoid checking in Meterpreter binaries. These are supplied upstream by
63+
# the meterpreter_bins gem.
64+
data/meterpreter/elevator.*.dll
65+
data/meterpreter/ext_server_espia.*.dll
66+
data/meterpreter/ext_server_extapi.*.dll
67+
data/meterpreter/ext_server_incognito.*.dll
68+
data/meterpreter/ext_server_kiwi.*.dll
69+
data/meterpreter/ext_server_lanattacks.*.dll
70+
data/meterpreter/ext_server_mimikatz.*.dll
71+
data/meterpreter/ext_server_priv.*.dll
72+
data/meterpreter/ext_server_stdapi.*.dll
73+
data/meterpreter/metsrv.*.dll
74+
data/meterpreter/screenshot.*.dll
75+
76+
# Avoid checking in Meterpreter libs that are built from
77+
# private source. If you're interested in this functionality,
78+
# check out Metasploit Pro: http://metasploit.com/download
79+
data/meterpreter/ext_server_pivot.*.dll

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ todb-r7 <todb-r7@github> Tod Beardsley <[email protected]>
1818
todb-r7 <todb-r7@github> Tod Beardsley <[email protected]>
1919
todb-r7 <todb-r7@github> Tod Beardsley <[email protected]>
2020
trosen-r7 <trosen-r7@github> Trevor Rosen <[email protected]>
21+
trosen-r7 <trosen-r7@github> Trevor Rosen <[email protected]>
2122
wchen-r7 <wchen-r7@github> sinn3r <[email protected]> # aka sinn3r
2223
wchen-r7 <wchen-r7@github> sinn3r <[email protected]>
2324
wchen-r7 <wchen-r7@github> Wei Chen <[email protected]>

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
--color
22
--format Fivemat
3+
--require spec_helper

.rubocop.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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.
8+
9+
# inherit_from: .rubocop_todo.yml
10+
11+
Style/ClassLength:
12+
Description: 'Most Metasploit modules are quite large. This is ok.'
13+
Enabled: true
14+
Exclude:
15+
- 'modules/**/*'
16+
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+
47+
Style/NumericLiterals:
48+
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/**/*'
76+
77+
Documentation:
78+
Exclude:
79+
- 'modules/**/*'

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.9.3-p484
1+
1.9.3-p547

.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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1+
env:
2+
- RAKE_TASK=cucumber
3+
- RAKE_TASK=cucumber:boot
4+
- RAKE_TASK=spec
5+
16
language: ruby
2-
env: MSF_SPOTCHECK_RECENT=1
37
before_install:
48
- rake --version
59
- sudo apt-get update -qq
610
- sudo apt-get install -qq libpcap-dev
11+
# Uncomment when we have fewer shipping msftidy warnings.
12+
# Merge committers will still be checking, just not autofailing.
13+
# See https://dev.metasploit.com/redmine/issues/8498
14+
# - ln -sf ../../tools/dev/pre-commit-hook.rb ./.git/hooks/post-merge
15+
# - ls -la ./.git/hooks
16+
# - ./.git/hooks/post-merge
717
before_script:
8-
- ./tools/msftidy.rb
918
- cp config/database.yml.travis config/database.yml
1019
- bundle exec rake --version
1120
- bundle exec rake db:create
1221
- bundle exec rake db:migrate
22+
script: "bundle exec rake $RAKE_TASK"
1323

1424
rvm:
1525
#- '1.8.7'

.yardopts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +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
10+
plugins/**/*.rb

CONTRIBUTING.md

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
# Contributing to Metasploit
1+
# Hello, World!
22

33
Thanks for your interest in making Metasploit -- and therefore, the
4-
world -- a better place! What you see here in CONTRIBUTING.md is a
5-
bullet-point list of the do's and don'ts of how to make sure *your*
6-
valuable contributions actually make it into Metasploit's master branch.
4+
world -- a better place!
5+
6+
Are you about to report a bug? Sorry to hear it.
7+
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).
17+
18+
Are you about to contribute some new functionality, a bug fix, or a new
19+
Metasploit module? If so, read on...
20+
21+
# Contributing to Metasploit
22+
23+
What you see here in CONTRIBUTING.md is a bullet-point list of the do's
24+
and don'ts of how to make sure *your* valuable contributions actually
25+
make it into Metasploit's master branch.
726

827
If you care not to follow these rules, your contribution **will** be
928
closed (*Road House* style). Sorry!
1029

11-
Incidentally, this is a **short** list. The
30+
This is intended to be a **short** list. The
1231
[wiki](https://github.com/rapid7/metasploit-framework/wiki) is much more
1332
exhaustive and reveals many mysteries. If you read nothing else, take a
1433
look at the standard [development environment setup
@@ -18,11 +37,13 @@ and Metasploit's [Common Coding Mistakes](https://github.com/rapid7/metasploit-f
1837
## Code Contributions
1938

2039
* **Do** stick to the [Ruby style guide](https://github.com/bbatsov/ruby-style-guide).
40+
* *Do* get [Rubocop](https://rubygems.org/search?query=rubocop) relatively quiet against the code you are adding or modifying.
2141
* **Do** follow the [50/72 rule](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) for Git commit messages.
2242
* **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`.
2343

2444
### Pull Requests
2545

46+
* **Do** target your pull request to the **master branch**. Not staging, not develop, not release.
2647
* **Do** specify a descriptive title to make searching for your pull request easier.
2748
* **Do** include [console output](https://help.github.com/articles/github-flavored-markdown#fenced-code-blocks), especially for witnessable effects in `msfconsole`.
2849
* **Do** list [verification steps](https://help.github.com/articles/writing-on-github#task-lists) so your code is testable.
@@ -34,30 +55,27 @@ Pull requests [#2940](https://github.com/rapid7/metasploit-framework/pull/2940)
3455
#### New Modules
3556

3657
* **Do** run `tools/msftidy.rb` against your module and fix any errors or warnings that come up. Even better would be to set up `msftidy.rb` as a [pre-commit hook](https://github.com/rapid7/metasploit-framework/blob/master/tools/dev/pre-commit-hook.rb).
37-
* **Do** use the [API](https://dev.metasploit.com/documents/api/). Wheel improvements are welcome; wheel reinventions, not so much.
58+
* **Do** use the [many module mixin APIs](https://dev.metasploit.com/api/). Wheel improvements are welcome; wheel reinventions, not so much.
3859
* **Don't** include more than one module per pull request.
3960

4061
#### Library Code
4162

4263
* **Do** write [RSpec](http://rspec.info/) tests - even the smallest change in library land can thoroughly screw things up.
4364
* **Do** follow [Better Specs](http://betterspecs.org/) - it's like the style guide for specs.
4465
* **Do** write [YARD](http://yardoc.org/) documentation - this makes it easier for people to use your code.
66+
* **Don't** fix a lot of things in one pull request. Small fixes are easier to validate.
4567

4668
#### Bug Fixes
4769

4870
* **Do** include reproduction steps in the form of verification steps.
49-
* **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.
5072

5173
## Bug Reports
5274

53-
* **Do** report vulnerabilities in Rapid7 software to [email protected].
54-
* **Do** create a Redmine account and report your bug there.
75+
* **Do** report vulnerabilities in Rapid7 software directly to [email protected].
5576
* **Do** write a detailed description of your bug and use a descriptive title.
5677
* **Do** include reproduction steps, stack traces, and anything else that might help us verify and fix your bug.
5778
* **Don't** file duplicate reports - search for your bug before filing a new report.
58-
* **Don't** report a bug on GitHub. Use [Redmine](https://dev.metasploit.com/redmine/projects/framework) instead.
59-
60-
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.
6179

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

Gemfile

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,58 @@
11
source 'https://rubygems.org'
2-
3-
# Need 3+ for ActiveSupport::Concern
4-
gem 'activesupport', '>= 3.0.0'
5-
# Needed for some admin modules (cfme_manageiq_evm_pass_reset.rb)
6-
gem 'bcrypt-ruby'
7-
# Needed for some admin modules (scrutinizer_add_user.rb)
8-
gem 'json'
9-
# Needed by msfgui and other rpc components
10-
gem 'msgpack'
11-
# Needed by anemone crawler
12-
gem 'nokogiri'
13-
# Needed by anemone crawler
14-
gem 'robots'
15-
# Needed by db.rb and Msf::Exploit::Capture
16-
gem 'packetfu', '1.1.9'
2+
# Add default group gems to `metasploit-framework.gemspec`:
3+
# spec.add_runtime_dependency '<name>', [<version requirements>]
4+
gemspec
175

186
group :db do
197
# Needed for Msf::DbManager
20-
gem 'activerecord'
8+
gem 'activerecord', '>= 3.0.0', '< 4.0.0'
9+
10+
# Metasploit::Credential database models
11+
gem 'metasploit-credential', '~> 0.12.0'
2112
# Database models shared between framework and Pro.
22-
gem 'metasploit_data_models', '~> 0.17.0'
13+
gem 'metasploit_data_models', '~> 0.21.1'
2314
# Needed for module caching in Mdm::ModuleDetails
2415
gem 'pg', '>= 0.11'
2516
end
2617

27-
group :pcap do
28-
gem 'network_interface', '~> 0.0.1'
29-
# For sniffer and raw socket modules
30-
gem 'pcaprub'
31-
end
32-
3318
group :development do
3419
# Markdown formatting for yard
3520
gem 'redcarpet'
3621
# generating documentation
3722
gem 'yard'
23+
# for development and testing purposes
24+
gem 'pry'
3825
end
3926

4027
group :development, :test do
4128
# supplies factories for producing model instance for specs
4229
# Version 4.1.0 or newer is needed to support generate calls without the
4330
# 'FactoryGirl.' in factory definitions syntax.
4431
gem 'factory_girl', '>= 4.1.0'
32+
# automatically include factories from spec/factories
33+
gem 'factory_girl_rails'
4534
# Make rspec output shorter and more useful
4635
gem 'fivemat', '1.2.1'
4736
# running documentation generation tasks and rspec tasks
4837
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'
4949
end
5050

5151
group :test do
52-
# Removes records from database created during tests. Can't use rspec-rails'
53-
# transactional fixtures because multiple connections are in use so
54-
# transactions won't work.
55-
gem 'database_cleaner'
56-
# testing framework
57-
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
5856
gem 'shoulda-matchers'
5957
# code coverage for tests
6058
# any version newer than 0.5.4 gives an Encoding error when trying to read the source files.

0 commit comments

Comments
 (0)