Skip to content

Commit 59ab73b

Browse files
author
Brent Cook
committed
Land rapid7#8464, Fix upstream packager issues with msfupdate, git
2 parents d4ba28a + 71404f7 commit 59ab73b

File tree

6 files changed

+62
-96
lines changed

6 files changed

+62
-96
lines changed

Gemfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ source 'https://rubygems.org'
33
# spec.add_runtime_dependency '<name>', [<version requirements>]
44
gemspec name: 'metasploit-framework'
55

6-
gem 'bit-struct', git: 'https://github.com/busterb/bit-struct', branch: 'ruby-2.4'
7-
gem 'method_source', git: 'https://github.com/banister/method_source', branch: 'master'
8-
96
# separate from test as simplecov is not run on travis-ci
107
group :coverage do
118
# code coverage for tests
@@ -18,7 +15,7 @@ group :development do
1815
# generating documentation
1916
gem 'yard'
2017
# for development and testing purposes
21-
gem 'pry', git: 'https://github.com/pry/pry', branch: 'master'
18+
gem 'pry'
2219
# module documentation
2320
gem 'octokit'
2421
# metasploit-aggregator as a framework only option for now

Gemfile.lock

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
GIT
2-
remote: https://github.com/banister/method_source
3-
revision: 0cc6cc8e15d08880585e8cb0c54e13c3cf937c54
4-
branch: master
5-
specs:
6-
method_source (0.8.1)
7-
8-
GIT
9-
remote: https://github.com/busterb/bit-struct
10-
revision: 707133ae6af5420be6fbe29be6baa5fbc929da2e
11-
branch: ruby-2.4
12-
specs:
13-
bit-struct (0.15.0)
14-
15-
GIT
16-
remote: https://github.com/pry/pry
17-
revision: f19d3e2ae86a677e1e926016fa1a5763675e3659
18-
branch: master
19-
specs:
20-
pry (0.10.4)
21-
coderay (~> 1.1.0)
22-
method_source (~> 0.8.1)
23-
241
PATH
252
remote: .
263
specs:
@@ -130,6 +107,7 @@ GEM
130107
backports (3.8.0)
131108
bcrypt (3.1.11)
132109
bindata (2.4.0)
110+
bit-struct (0.16)
133111
builder (3.2.3)
134112
capybara (2.14.0)
135113
addressable
@@ -229,6 +207,7 @@ GEM
229207
railties (~> 4.2.6)
230208
recog (~> 2.0)
231209
metasploit_payloads-mettle (0.1.9)
210+
method_source (0.8.2)
232211
mime-types (3.1)
233212
mime-types-data (~> 3.2015)
234213
mime-types-data (3.2016.0521)
@@ -259,6 +238,10 @@ GEM
259238
activerecord (>= 4.0.0)
260239
arel (>= 4.0.1)
261240
pg_array_parser (~> 0.0.9)
241+
pry (0.10.4)
242+
coderay (~> 1.1.0)
243+
method_source (~> 0.8.1)
244+
slop (~> 3.4)
262245
public_suffix (2.0.5)
263246
rack (1.6.8)
264247
rack-test (0.6.3)
@@ -366,6 +349,7 @@ GEM
366349
json (>= 1.8, < 3)
367350
simplecov-html (~> 0.10.0)
368351
simplecov-html (0.10.1)
352+
slop (3.6.0)
369353
sqlite3 (1.3.13)
370354
sshkey (1.9.0)
371355
thor (0.19.4)
@@ -386,15 +370,13 @@ PLATFORMS
386370

387371
DEPENDENCIES
388372
aruba
389-
bit-struct!
390373
cucumber-rails
391374
factory_girl_rails
392375
fivemat
393376
metasploit-aggregator
394377
metasploit-framework!
395-
method_source!
396378
octokit
397-
pry!
379+
pry
398380
rake
399381
redcarpet
400382
rspec-rails

LICENSE_GEMS

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@ activerecord, 4.2.8, MIT
66
activesupport, 4.2.8, MIT
77
addressable, 2.5.1, "Apache 2.0"
88
arel, 6.0.4, MIT
9-
arel-helpers, 2.3.0, unknown
9+
arel-helpers, 2.4.0, unknown
1010
aruba, 0.14.2, MIT
11+
backports, 3.8.0, MIT
1112
bcrypt, 3.1.11, MIT
1213
bindata, 2.4.0, ruby
13-
bit-struct, 0.15.0, ruby
14+
bit-struct, 0.16, ruby
1415
builder, 3.2.3, MIT
15-
bundler, 1.14.6, MIT
16+
bundler, 1.15.0, MIT
1617
capybara, 2.14.0, MIT
1718
childprocess, 0.5.9, MIT
1819
coderay, 1.1.1, MIT
1920
contracts, 0.16.0, "Simplified BSD"
2021
cucumber, 2.4.0, MIT
2122
cucumber-core, 1.5.0, MIT
22-
cucumber-rails, 1.4.5, MIT
23+
cucumber-rails, 1.5.0, MIT
2324
cucumber-wire, 0.0.1, MIT
2425
diff-lcs, 1.3, "MIT, Artistic-2.0, GPL-2.0+"
2526
docile, 1.1.5, MIT
@@ -31,9 +32,9 @@ ffi, 1.9.18, "New BSD"
3132
filesize, 0.1.1, MIT
3233
fivemat, 1.3.3, MIT
3334
gherkin, 4.1.3, MIT
34-
google-protobuf, 3.2.0.2, "New BSD"
35+
google-protobuf, 3.3.0, "New BSD"
3536
googleauth, 0.5.1, "Apache 2.0"
36-
grpc, 1.2.5, "New BSD"
37+
grpc, 1.3.4, "New BSD"
3738
i18n, 0.8.1, MIT
3839
jsobfu, 0.4.2, "New BSD"
3940
json, 2.1.0, ruby
@@ -43,19 +44,19 @@ logging, 2.2.2, MIT
4344
loofah, 2.0.3, MIT
4445
memoist, 0.15.0, MIT
4546
metasm, 1.0.3, LGPL
46-
metasploit-aggregator, 0.1.3, "New BSD"
47-
metasploit-concern, 2.0.3, "New BSD"
48-
metasploit-credential, 2.0.8, "New BSD"
49-
metasploit-framework, 4.14.17, "New BSD"
50-
metasploit-model, 2.0.3, "New BSD"
51-
metasploit-payloads, 1.2.28, "3-clause (or ""modified"") BSD"
47+
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"
51+
metasploit-model, 2.0.4, "New BSD"
52+
metasploit-payloads, 1.2.29, "3-clause (or ""modified"") BSD"
5253
metasploit_data_models, 2.0.14, "New BSD"
5354
metasploit_payloads-mettle, 0.1.9, "3-clause (or ""modified"") BSD"
54-
method_source, 0.8.1, MIT
55+
method_source, 0.8.2, MIT
5556
mime-types, 3.1, MIT
5657
mime-types-data, 3.2016.0521, MIT
5758
mini_portile2, 2.1.0, MIT
58-
minitest, 5.10.1, MIT
59+
minitest, 5.10.2, MIT
5960
msgpack, 1.1.0, "Apache 2.0"
6061
multi_json, 1.12.1, MIT
6162
multi_test, 0.1.2, MIT
@@ -64,7 +65,7 @@ nessus_rest, 0.1.6, MIT
6465
net-ssh, 4.1.0, MIT
6566
network_interface, 0.0.1, MIT
6667
nexpose, 6.0.0, BSD
67-
nokogiri, 1.7.1, MIT
68+
nokogiri, 1.7.2, MIT
6869
octokit, 4.7.0, MIT
6970
openssl-ccm, 1.2.1, MIT
7071
openvas-omp, 0.0.4, MIT
@@ -77,57 +78,58 @@ pg_array_parser, 0.0.9, unknown
7778
postgres_ext, 3.0.0, MIT
7879
pry, 0.10.4, MIT
7980
public_suffix, 2.0.5, MIT
80-
rack, 1.6.5, MIT
81+
rack, 1.6.8, MIT
8182
rack-test, 0.6.3, MIT
8283
rails-deprecated_sanitizer, 1.0.3, MIT
8384
rails-dom-testing, 1.0.8, MIT
8485
rails-html-sanitizer, 1.0.3, MIT
8586
railties, 4.2.8, MIT
8687
rake, 12.0.0, MIT
8788
rb-readline, 0.5.4, BSD
88-
recog, 2.1.6, unknown
89+
recog, 2.1.8, unknown
8990
redcarpet, 3.4.0, MIT
9091
rex-arch, 0.1.4, "New BSD"
91-
rex-bin_tools, 0.1.2, "New BSD"
92-
rex-core, 0.1.9, "New BSD"
93-
rex-encoder, 0.1.3, "New BSD"
94-
rex-exploitation, 0.1.13, "New BSD"
95-
rex-java, 0.1.4, "New BSD"
96-
rex-mime, 0.1.4, "New BSD"
97-
rex-nop, 0.1.0, unknown
98-
rex-ole, 0.1.5, "New BSD"
99-
rex-powershell, 0.1.71, "New BSD"
92+
rex-bin_tools, 0.1.3, "New BSD"
93+
rex-core, 0.1.10, "New BSD"
94+
rex-encoder, 0.1.4, "New BSD"
95+
rex-exploitation, 0.1.14, "New BSD"
96+
rex-java, 0.1.5, "New BSD"
97+
rex-mime, 0.1.5, "New BSD"
98+
rex-nop, 0.1.1, "New BSD"
99+
rex-ole, 0.1.6, "New BSD"
100+
rex-powershell, 0.1.72, "New BSD"
100101
rex-random_identifier, 0.1.2, "New BSD"
101-
rex-registry, 0.1.2, "New BSD"
102-
rex-rop_builder, 0.1.2, "New BSD"
103-
rex-socket, 0.1.5, "New BSD"
104-
rex-sslscan, 0.1.3, "New BSD"
105-
rex-struct2, 0.1.1, "New BSD"
106-
rex-text, 0.2.14, "New BSD"
107-
rex-zip, 0.1.2, "New BSD"
102+
rex-registry, 0.1.3, "New BSD"
103+
rex-rop_builder, 0.1.3, "New BSD"
104+
rex-socket, 0.1.6, "New BSD"
105+
rex-sslscan, 0.1.4, "New BSD"
106+
rex-struct2, 0.1.2, "New BSD"
107+
rex-text, 0.2.15, "New BSD"
108+
rex-zip, 0.1.3, "New BSD"
108109
rkelly-remix, 0.0.7, MIT
109110
robots, 0.10.1, MIT
110111
rspec-core, 3.6.0, MIT
111112
rspec-expectations, 3.6.0, MIT
112113
rspec-mocks, 3.6.0, MIT
113114
rspec-rails, 3.6.0, MIT
114115
rspec-support, 3.6.0, MIT
115-
ruby_smb, 0.0.12, "New BSD"
116+
ruby_smb, 0.0.17, "New BSD"
116117
rubyntlm, 0.6.2, MIT
117118
rubyzip, 1.2.1, "Simplified BSD"
118119
sawyer, 0.8.1, MIT
119120
shoulda-matchers, 3.1.1, MIT
120121
signet, 0.7.3, "Apache 2.0"
121122
simplecov, 0.14.1, MIT
122-
simplecov-html, 0.10.0, MIT
123+
simplecov-html, 0.10.1, MIT
124+
slop, 3.6.0, MIT
123125
sqlite3, 1.3.13, "New BSD"
124126
sshkey, 1.9.0, MIT
125127
thor, 0.19.4, MIT
126128
thread_safe, 0.3.6, "Apache 2.0"
127129
timecop, 0.8.1, MIT
128130
tzinfo, 1.2.3, MIT
129131
tzinfo-data, 1.2017.2, MIT
130-
windows_error, 0.1.1, BSD
132+
windows_error, 0.1.2, BSD
131133
xmlrpc, 0.3.0, ruby
132-
xpath, 2.0.0, unknown
134+
xpath, 2.1.0, MIT
133135
yard, 0.9.9, MIT

docker/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ RUN apk update && \
1717
nmap-scripts \
1818
nmap-nselibs \
1919
postgresql-libs \
20-
# needed as long as metasploit-framework.gemspec contains a 'git ls'
21-
git \
2220
ncurses \
2321
libcap \
2422
&& apk add --virtual .ruby-builddeps \

metasploit-framework.gemspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ Gem::Specification.new do |spec|
2424
spec.homepage = 'https://www.metasploit.com'
2525
spec.license = 'BSD-3-clause'
2626

27-
spec.files = `git ls-files`.split($/).reject { |file|
28-
file =~ /^documentation|^data\/gui|^external/
29-
}
27+
if File.directory?(File.join(__FILE__, ".git"))
28+
spec.files = `git ls-files`.split($/).reject { |file|
29+
file =~ /^documentation|^external/
30+
}
31+
end
3032
spec.bindir = '.'
3133
if ENV['CREATE_BINSTUBS']
3234
spec.executables = [
3335
'msfconsole',
3436
'msfd',
3537
'msfrpc',
3638
'msfrpcd',
37-
'msfupdate',
3839
'msfvenom'
3940
]
4041
end

msfupdate

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ while File.symlink?(msfbase)
1313
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
1414
end
1515

16+
require 'backports'
17+
1618
class Msfupdate
1719
attr_reader :stdin
1820
attr_reader :stdout
@@ -84,7 +86,7 @@ class Msfupdate
8486

8587
def validate_args
8688
valid = true
87-
if binary_install? || apt?
89+
if binary_install?
8890
if @git_branch
8991
stderr.puts "[-] ERROR: git-branch is not supported on this installation"
9092
valid = false
@@ -94,7 +96,7 @@ class Msfupdate
9496
valid = false
9597
end
9698
end
97-
if apt? || git?
99+
if git?
98100
if @offline_file
99101
stderr.puts "[-] ERROR: offline-file option is not supported on this installation"
100102
valid = false
@@ -132,12 +134,13 @@ class Msfupdate
132134
end
133135

134136
Dir.chdir(@msfbase_dir) do
135-
if git?
136-
update_git!
137+
if apt?
138+
stderr.puts "[-] ERROR: msfupdate is not supported on Kali Linux."
139+
stderr.puts "[-] Please run 'apt update; apt install metasploit-framework' instead."
137140
elsif binary_install?
138141
update_binary_install!
139-
elsif apt?
140-
update_apt!
142+
elsif git?
143+
update_git!
141144
else
142145
raise "Cannot determine checkout type: `#{@msfbase_dir}'"
143146
end
@@ -267,23 +270,6 @@ class Msfupdate
267270
end
268271
end
269272

270-
def update_apt!
271-
# For more information, see here:
272-
# https://community.rapid7.com/community/metasploit/blog/2013/01/17/metasploit-updates-and-msfupdate
273-
stdout.puts "[*] Checking for updates via the APT repository"
274-
stdout.puts "[*] Note: expect weekly(ish) updates using this method"
275-
system("apt-get", "-qq", "update")
276-
277-
framework_version = apt_upgrade_available('metasploit-framework')
278-
279-
if framework_version.blank?
280-
stdout.puts "[*] No updates available"
281-
else
282-
stdout.puts "[*] Updating to version #{framework_version}"
283-
system("apt-get", "install", "--assume-yes", "metasploit-framework")
284-
end
285-
end
286-
287273
# Adding an upstream enables msfupdate to pull updates from
288274
# Rapid7's metasploit-framework repo instead of the repo
289275
# the user originally cloned or forked.

0 commit comments

Comments
 (0)