Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/metasploit/, net-analyzer/metasploit/files/
Date: Tue, 05 May 2020 08:06:04
Message-Id: 1588665944.af8f89d9b9f87bff0d3d3176437b3766a0439f4b.graaff@gentoo
1 commit: af8f89d9b9f87bff0d3d3176437b3766a0439f4b
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 5 07:50:12 2020 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Tue May 5 08:05:44 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af8f89d9
7
8 net-analyzer/metasploit: remove masked package
9
10 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
11
12 net-analyzer/metasploit/Manifest | 1 -
13 net-analyzer/metasploit/files/database.yml | 34 --
14 net-analyzer/metasploit/metadata.xml | 18 --
15 .../metasploit/metasploit-4.17.21-r6.ebuild | 353 ---------------------
16 net-analyzer/metasploit/metasploit-9999.ebuild | 348 --------------------
17 5 files changed, 754 deletions(-)
18
19 diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest
20 deleted file mode 100644
21 index 09d5598966e..00000000000
22 --- a/net-analyzer/metasploit/Manifest
23 +++ /dev/null
24 @@ -1 +0,0 @@
25 -DIST metasploit-4.17.21.tar.gz 28812125 BLAKE2B 15ff8ccac99d783b7b9cd20d6512df551b3143b4947d2f347b2558d1bafd2861d41fe6b051034c75cd25030ad85d26f261ffe9149dd27d551f92f17fcc0b4075 SHA512 00763f515bc6b556d4dbe15a7c58fac3c7febb64fb339fd5c05ad2b18b5b55bdf8815daca35f24bb22bea3d376db4f4610918730d813079e5ac3f8d5ad16d2d9
26
27 diff --git a/net-analyzer/metasploit/files/database.yml b/net-analyzer/metasploit/files/database.yml
28 deleted file mode 100644
29 index 403191669cc..00000000000
30 --- a/net-analyzer/metasploit/files/database.yml
31 +++ /dev/null
32 @@ -1,34 +0,0 @@
33 -#
34 -# The tests currently use the development user
35 -# https://dev.metasploit.com/redmine/issues/8418
36 -#
37 -
38 -development:
39 - adapter: "postgresql"
40 - database: "msf_test_database"
41 - username: "msf_test_user"
42 - password: "secure"
43 - port: 5432
44 - host: "localhost"
45 - pool: 256
46 - timeout: 5
47 -
48 -production:
49 - adapter: "postgresql"
50 - database: "msf_database"
51 - username: "msf_user"
52 - password: "secure"
53 - port: 5432
54 - host: "localhost"
55 - pool: 256
56 - timeout: 5
57 -
58 -test:
59 - adapter: "postgresql"
60 - database: "msf_test_database"
61 - username: "msf_test_user"
62 - password: "secure"
63 - port: 5432
64 - host: "localhost"
65 - pool: 256
66 - timeout: 5
67
68 diff --git a/net-analyzer/metasploit/metadata.xml b/net-analyzer/metasploit/metadata.xml
69 deleted file mode 100644
70 index 1edaa58c665..00000000000
71 --- a/net-analyzer/metasploit/metadata.xml
72 +++ /dev/null
73 @@ -1,18 +0,0 @@
74 -<?xml version="1.0" encoding="UTF-8"?>
75 -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
76 -<pkgmetadata>
77 - <maintainer type="person">
78 - <email>zerochaos@g.o</email>
79 - <name>Rick Farina</name>
80 - <description>Very delicate package, ask before you touch please</description>
81 - </maintainer>
82 - <use>
83 - <flag name="development">Install dependencies needed for metasploit and exploit development</flag>
84 - <flag name="nexpose">Enable the plugin to integrate with nexpose</flag>
85 - <flag name="oracle">Enable restricted oracle modules which have additional deps</flag>
86 - <flag name="pcap">Enable libpcap for packet sniffing</flag>
87 - </use>
88 - <upstream>
89 - <remote-id type="github">rapid7/metasploit-framework</remote-id>
90 - </upstream>
91 -</pkgmetadata>
92
93 diff --git a/net-analyzer/metasploit/metasploit-4.17.21-r6.ebuild b/net-analyzer/metasploit/metasploit-4.17.21-r6.ebuild
94 deleted file mode 100644
95 index f06d33d3ee2..00000000000
96 --- a/net-analyzer/metasploit/metasploit-4.17.21-r6.ebuild
97 +++ /dev/null
98 @@ -1,353 +0,0 @@
99 -# Copyright 1999-2019 Gentoo Authors
100 -# Distributed under the terms of the GNU General Public License v2
101 -
102 -EAPI="6"
103 -
104 -#never ever ever have more than one ruby in here
105 -USE_RUBY="ruby24"
106 -inherit eutils ruby-ng
107 -
108 -if [[ ${PV} == "9999" ]] ; then
109 - EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
110 - EGIT_BRANCH="4.x"
111 - EGIT_CHECKOUT_DIR="${WORKDIR}"/all
112 - inherit git-r3
113 - KEYWORDS="~arm"
114 - SLOT="9999"
115 -else
116 - ##Tags https://github.com/rapid7/metasploit-framework/releases
117 - MY_PV=${PV/_p/-}
118 - SRC_URI="https://github.com/rapid7/metasploit-framework/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
119 - KEYWORDS="~amd64 ~arm ~x86"
120 - RUBY_S="${PN}-framework-${MY_PV}"
121 - inherit eapi7-ver
122 - SLOT="$(ver_cut 1).$(ver_cut 2)"
123 -fi
124 -
125 -DESCRIPTION="Advanced framework for developing, testing, and using vulnerability exploit code"
126 -HOMEPAGE="http://www.metasploit.org/"
127 -LICENSE="BSD"
128 -IUSE="development +java nexpose oracle +pcap test"
129 -
130 -#multiple known bugs with tests reported upstream and ignored
131 -#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible)
132 -RESTRICT="strip test"
133 -
134 -#grep spec.add_runtime_dependency metasploit-framework.gemspec | sort
135 -RUBY_COMMON_DEPEND="virtual/ruby-ssl
136 - >=dev-ruby/actionpack-4.2.6:4.2
137 - >=dev-ruby/activerecord-4.2.6:4.2
138 - >=dev-ruby/activesupport-4.2.6:4.2
139 - dev-ruby/backports
140 - dev-ruby/bcrypt-ruby
141 - dev-ruby/bcrypt_pbkdf
142 - dev-ruby/bit-struct
143 - dev-ruby/bundler
144 - dev-ruby/dnsruby
145 - dev-ruby/faker:0
146 - dev-ruby/faraday
147 - dev-ruby/filesize:*
148 - dev-ruby/jsobfu:*
149 - dev-ruby/json:*
150 - dev-ruby/metasm:*
151 - dev-ruby/metasploit-concern
152 - <dev-ruby/metasploit-credential-3.0.0
153 - <dev-ruby/metasploit_data_models-3.0.0
154 - dev-ruby/metasploit-model
155 - dev-ruby/metasploit-payloads:1.3.53
156 - dev-ruby/metasploit_payloads-mettle:0.4.2
157 - dev-ruby/mqtt
158 - dev-ruby/msgpack
159 - dev-ruby/net-ssh:*
160 - dev-ruby/ed25519
161 - dev-ruby/nokogiri
162 - dev-ruby/octokit
163 - dev-ruby/openssl-ccm:1.2.1
164 - dev-ruby/packetfu:1.1.13
165 - dev-ruby/patch_finder
166 - dev-ruby/pdf-reader:*
167 - ~dev-ruby/pg-0.21.0
168 - dev-ruby/railties:*
169 - dev-ruby/rb-readline
170 - dev-ruby/recog:*
171 - dev-ruby/redcarpet
172 - dev-ruby/rex-arch
173 - dev-ruby/rex-bin_tools
174 - dev-ruby/rex-core
175 - dev-ruby/rex-encoder
176 - dev-ruby/rex-exploitation
177 - dev-ruby/rex-java
178 - dev-ruby/rex-mime
179 - dev-ruby/rex-nop
180 - dev-ruby/rex-ole
181 - <dev-ruby/rex-powershell-0.1.78
182 - dev-ruby/rex-random_identifier
183 - dev-ruby/rex-registry
184 - dev-ruby/rex-rop_builder
185 - dev-ruby/rex-socket
186 - dev-ruby/rex-sslscan
187 - dev-ruby/rex-struct2
188 - dev-ruby/rex-text
189 - dev-ruby/rex-zip
190 - dev-ruby/ruby-macho
191 - dev-ruby/rubyntlm
192 - dev-ruby/ruby_smb:*
193 - dev-ruby/rubyzip:*
194 - dev-ruby/sqlite3
195 - dev-ruby/sshkey
196 - dev-ruby/tzinfo:*
197 - dev-ruby/windows_error
198 - dev-ruby/xdr:2.0.0
199 - dev-ruby/xmlrpc
200 - java? ( dev-ruby/rjb )
201 - nexpose? ( dev-ruby/nexpose )
202 - oracle? ( dev-ruby/ruby-oci8 )
203 - pcap? ( dev-ruby/pcaprub:*
204 - dev-ruby/network_interface )
205 - development? ( dev-ruby/fivemat
206 - dev-ruby/pry
207 - dev-ruby/redcarpet
208 - dev-ruby/yard
209 - >=dev-ruby/rake-10.0.0
210 - >=dev-ruby/factory_girl-4.1.0 )"
211 - #lorcon doesn't support ruby21
212 - #lorcon? ( net-wireless/lorcon[ruby] )
213 -ruby_add_bdepend "${RUBY_COMMON_DEPEND}
214 - test? ( >=dev-ruby/factory_girl-4.1.0
215 - dev-ruby/fivemat
216 - dev-ruby/database_cleaner
217 - >=dev-ruby/rspec-2.12
218 - dev-ruby/shoulda-matchers
219 - dev-ruby/timecop
220 - >=dev-ruby/rake-10.0.0 )"
221 -ruby_add_rdepend "${RUBY_COMMON_DEPEND}"
222 -
223 -COMMON_DEPEND="dev-db/postgresql[server]
224 - || ( app-crypt/johntheripper-jumbo >=app-crypt/johntheripper-1.7.9-r1[-minimal(-)] )
225 - net-analyzer/nmap"
226 -RDEPEND+=" ${COMMON_DEPEND}
227 - >=app-eselect/eselect-metasploit-0.16"
228 -
229 -QA_PREBUILT="
230 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux.bin
231 - usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux.bin
232 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_solaris.bin
233 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux.bin
234 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux_dll.bin
235 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_bsd.bin
236 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_bsd.bin
237 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
238 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
239 - usr/lib*/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
240 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
241 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
242 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
243 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
244 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2014-3153.elf
245 - usr/lib*/${PN}${SLOT}/data/exploits/mysql/lib_mysqludf_sys_32.so
246 - usr/lib*/${PN}${SLOT}/data/exploits/*
247 - usr/lib*/${PN}${SLOT}/data/android/libs/x86/libndkstager.so
248 - usr/lib*/${PN}${SLOT}/data/android/libs/mips/libndkstager.so
249 - usr/lib*/${PN}${SLOT}/data/android/libs/armeabi/libndkstager.so
250 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux_dll.bin
251 - usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux_dll.bin
252 - usr/lib*/${PN}${SLOT}/data/templates/template_aarch64_linux.bin
253 - "
254 -
255 -pkg_setup() {
256 - if use test; then
257 - su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
258 - su postgres -c "createuser msf_test_user -d -S -R"
259 - if [ $? -ne 0 ]; then
260 - su postgres -c "dropuser msf_test_user" || die
261 - su postgres -c "createuser msf_test_user -d -S -R" || die
262 - fi
263 - su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
264 - fi
265 - ruby-ng_pkg_setup
266 -}
267 -
268 -all_ruby_unpack() {
269 - if [[ ${PV} == "9999" ]] ; then
270 - git-r3_src_unpack
271 - else
272 - default_src_unpack
273 -# mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
274 -# rm -r msf3
275 - #msf_version=$(grep --color=never "CURRENT_VERSION =" ${S}/spec/lib/msf/core/framework_spec.rb)
276 - #msf_version=${msf_version#*=}
277 - fi
278 -}
279 -
280 -all_ruby_prepare() {
281 - # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
282 - #epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
283 - eapply_user
284 -
285 - #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
286 - rm -r data/cpuinfo
287 -
288 - #remove unneeded ruby bundler versioning files
289 - #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
290 - #we regen this file in each_ruby_prepare
291 - rm Gemfile.lock
292 -
293 - #The Gemfile contains real known deps
294 - sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die
295 - #use released packetfu
296 - sed -i "s/1.1.13.pre/1.1.13/" metasploit-framework.gemspec || die
297 - #use the stable pg
298 - #https://github.com/rapid7/metasploit-framework/issues/10234
299 - sed -i "s/dependency 'pg', '0.20.0'/dependency 'pg', '0.21.0'/" metasploit-framework.gemspec || die
300 - #git gems are only for ruby24 support and we are not there yet
301 - sed -i "/git:/d" Gemfile || die
302 -
303 - #now we edit the Gemfile based on use flags
304 - if ! use pcap; then
305 - sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
306 - fi
307 - if ! use nexpose; then
308 - sed -i -e "/nexpose/d" metasploit-framework.gemspec || die
309 - fi
310 - #no support for nessus right now
311 - #if ! use nessus; then
312 - sed -i -e "/nessus/d" metasploit-framework.gemspec || die
313 - #fi
314 -
315 - #OpenVAS support dropped on net-analyzer/metasploit. Bug:692076
316 - #openvas-omp is deprecated and masked for removal. Bug:692076
317 - #Remove openvas-omp in gemspec. Bug:698762
318 - sed -i -e "/openvas-omp/d" metasploit-framework.gemspec || die
319 -
320 - #even if we pass --without=blah bundler still calculates the deps and messes us up
321 - if ! use development; then
322 - sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
323 - fi
324 - if ! use test; then
325 - sed -i -e "/^group :test/,/^end$/d" Gemfile || die
326 - fi
327 - if ! use test && ! use development; then
328 - sed -i -e "/^group :development/,/^end$/d" Gemfile || die
329 - fi
330 - #We don't need simplecov
331 - sed -i -e "/^group :coverage/,/^end$/d" Gemfile || die
332 - sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
333 -
334 - #we need to edit the gemspec too, since it tries to call git instead of anything sane
335 - #probably a better way to fix this... if I care at some point
336 - sed -i -e "/^ spec.files/,/^ }/d" metasploit-framework.gemspec || die
337 -
338 - #https://bugs.gentoo.org/show_bug.cgi?id=584522 no tzinfo-data by choice in gentoo
339 - sed -i '/tzinfo-data/d' metasploit-framework.gemspec
340 -
341 - #fails without faraday in Gemfile.lock
342 - #despite activesupport(?) needing it, it doesn't end up there :-(
343 - sed -i "/'activesupport'/a \ \ spec.add_runtime_dependency 'faraday'" metasploit-framework.gemspec
344 -
345 - #let's bogart msfupdate
346 - rm msfupdate
347 - echo "#!/bin/sh" > msfupdate
348 - echo "echo \"[*]\"" >> msfupdate
349 - echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate
350 - echo "echo \"[*]\"" >> msfupdate
351 - echo "echo \"\"" >> msfupdate
352 - if [[ ${PV} == "9999" ]] ; then
353 - echo "if [ -x /usr/bin/smart-live-rebuild ]; then" >> msfupdate
354 - echo " smart-live-rebuild -f net-analyzer/metasploit" >> msfupdate
355 - echo "else" >> msfupdate
356 - echo " echo \"Please install app-portage/smart-live-rebuild for a better experience.\"" >> msfupdate
357 - echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
358 - echo "fi" >> msfupdate
359 - else
360 - echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
361 - echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
362 - echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate
363 - fi
364 - #this is set executable in src_install
365 -
366 - #install our database.yml file before tests are run
367 - cp "${FILESDIR}"/database.yml config/
368 -
369 -}
370 -
371 -each_ruby_prepare() {
372 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle install --local || die
373 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle check || die
374 -
375 - #force all metasploit executables to use desired ruby version
376 - #https://dev.metasploit.com/redmine/issues/8357
377 - for file in $(ls -1 msf*)
378 - do
379 - #poorly adapted from python.eclass
380 - sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?ruby\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${RUBY}:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
381 - done
382 -}
383 -
384 -each_ruby_test() {
385 - #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox
386 -
387 - #we bogart msfupdate so no point in trying to test it
388 - rm spec/msfupdate_spec.rb || die
389 - #we don't really want to be uploading to virustotal during the tests
390 - rm spec/tools/virustotal_spec.rb || die
391 -
392 - # https://dev.metasploit.com/redmine/issues/8425
393 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:create || die
394 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:migrate || die
395 -
396 - MSF_DATABASE_CONFIG=config/database.yml BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake || die
397 - su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
398 -}
399 -
400 -each_ruby_install() {
401 - #Tests have already been run, we don't need this stuff
402 - rm -r spec || die
403 - rm -r test || die
404 - rm Gemfile.lock || die
405 -
406 - #I'm 99% sure that this will only work for as long as we only support one ruby version. Creativity will be needed if we wish to support multiple.
407 - # should be as simple as copying everything into the target...
408 - dodir /usr/lib/${PN}${SLOT}
409 - cp -R * "${ED}"/usr/lib/${PN}${SLOT} || die "Copy files failed"
410 - rm -Rf "${ED}"/usr/lib/${PN}${SLOT}/documentation "${ED}"/usr/lib${PN}${SLOT}/README.md
411 - fowners -R root:0 /
412 -
413 -}
414 -
415 -all_ruby_install() {
416 - # do not remove LICENSE, bug #238137
417 - dodir /usr/share/doc/${PF}
418 - cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
419 - ln -s "../../share/doc/${PF}/documentation" "${ED}/usr/lib/${PN}${SLOT}/documentation"
420 -
421 - fperms +x /usr/lib/${PN}${SLOT}/msfupdate
422 -
423 - #tell revdep-rebuild to ignore binaries meant for the target
424 - dodir /etc/revdep-rebuild
425 - cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
426 - #These dirs contain prebuilt binaries for running on the TARGET not the HOST
427 - SEARCH_DIRS_MASK="/usr/lib/${PN}${SLOT}/data/meterpreter"
428 - SEARCH_DIRS_MASK="/usr/lib/${PN}${SLOT}/data/exploits"
429 - EOF
430 -}
431 -
432 -pkg_postinst() {
433 - elog "Before use you should run 'env-update' and '. /etc/profile'"
434 - elog "otherwise you may be missing important environmental variables."
435 -
436 - elog "You need to prepare the database by running:"
437 - elog "emerge --config postgresql"
438 - elog "/etc/init.d/postgresql-<version> start"
439 - elog "emerge --config =metasploit-${PV}"
440 -
441 - "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
442 -
443 - einfo
444 - elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
445 -}
446 -
447 -pkg_config() {
448 - einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
449 - su postgres -c "createuser msf_user -D -S -R"
450 - su postgres -c "createdb --owner=msf_user msf_database"
451 -}
452
453 diff --git a/net-analyzer/metasploit/metasploit-9999.ebuild b/net-analyzer/metasploit/metasploit-9999.ebuild
454 deleted file mode 100644
455 index 54db9b0d61c..00000000000
456 --- a/net-analyzer/metasploit/metasploit-9999.ebuild
457 +++ /dev/null
458 @@ -1,348 +0,0 @@
459 -# Copyright 1999-2019 Gentoo Authors
460 -# Distributed under the terms of the GNU General Public License v2
461 -
462 -EAPI="6"
463 -
464 -#never ever ever have more than one ruby in here
465 -USE_RUBY="ruby24"
466 -inherit eutils ruby-ng
467 -
468 -if [[ ${PV} == "9999" ]] ; then
469 - EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
470 - EGIT_BRANCH="4.x"
471 - EGIT_CHECKOUT_DIR="${WORKDIR}"/all
472 - inherit git-r3
473 - KEYWORDS=""
474 - SLOT="9999"
475 -else
476 - ##Tags https://github.com/rapid7/metasploit-framework/releases
477 - MY_PV=${PV/_p/-}
478 - SRC_URI="https://github.com/rapid7/metasploit-framework/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
479 - KEYWORDS="~amd64 ~x86"
480 - RUBY_S="${PN}-framework-${MY_PV}"
481 - inherit eapi7-ver
482 - SLOT="$(ver_cut 1).$(ver_cut 2)"
483 -fi
484 -
485 -DESCRIPTION="Advanced framework for developing, testing, and using vulnerability exploit code"
486 -HOMEPAGE="http://www.metasploit.org/"
487 -LICENSE="BSD"
488 -IUSE="development +java nexpose oracle +pcap test"
489 -
490 -#multiple known bugs with tests reported upstream and ignored
491 -#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible)
492 -RESTRICT="strip test"
493 -
494 -#grep spec.add_runtime_dependency metasploit-framework.gemspec | sort
495 -RUBY_COMMON_DEPEND="virtual/ruby-ssl
496 - >=dev-ruby/actionpack-4.2.6:4.2
497 - >=dev-ruby/activerecord-4.2.6:4.2
498 - >=dev-ruby/activesupport-4.2.6:4.2
499 - dev-ruby/backports
500 - dev-ruby/bcrypt-ruby
501 - dev-ruby/bcrypt_pbkdf
502 - dev-ruby/bit-struct
503 - dev-ruby/bundler
504 - dev-ruby/dnsruby
505 - dev-ruby/faker:0
506 - dev-ruby/filesize:*
507 - dev-ruby/jsobfu:*
508 - dev-ruby/json:*
509 - dev-ruby/metasm:*
510 - dev-ruby/metasploit-concern
511 - <dev-ruby/metasploit-credential-3.0.0
512 - <dev-ruby/metasploit_data_models-3.0.0
513 - dev-ruby/metasploit-model
514 - dev-ruby/metasploit-payloads:1.3.53
515 - dev-ruby/metasploit_payloads-mettle:0.4.2
516 - dev-ruby/mqtt
517 - dev-ruby/msgpack
518 - dev-ruby/net-ssh:*
519 - dev-ruby/ed25519
520 - dev-ruby/nokogiri
521 - dev-ruby/octokit
522 - dev-ruby/openssl-ccm:1.2.1
523 - dev-ruby/packetfu:1.1.13
524 - dev-ruby/patch_finder
525 - dev-ruby/pdf-reader:*
526 - ~dev-ruby/pg-0.21.0
527 - dev-ruby/railties:*
528 - dev-ruby/rb-readline
529 - dev-ruby/recog:*
530 - dev-ruby/redcarpet
531 - dev-ruby/rex-arch
532 - dev-ruby/rex-bin_tools
533 - dev-ruby/rex-core
534 - dev-ruby/rex-encoder
535 - dev-ruby/rex-exploitation
536 - dev-ruby/rex-java
537 - dev-ruby/rex-mime
538 - dev-ruby/rex-nop
539 - dev-ruby/rex-ole
540 - <dev-ruby/rex-powershell-0.1.78
541 - dev-ruby/rex-random_identifier
542 - dev-ruby/rex-registry
543 - dev-ruby/rex-rop_builder
544 - dev-ruby/rex-socket
545 - dev-ruby/rex-sslscan
546 - dev-ruby/rex-struct2
547 - dev-ruby/rex-text
548 - dev-ruby/rex-zip
549 - dev-ruby/ruby-macho
550 - dev-ruby/rubyntlm
551 - dev-ruby/ruby_smb:*
552 - dev-ruby/rubyzip:*
553 - dev-ruby/sqlite3
554 - dev-ruby/sshkey
555 - dev-ruby/tzinfo:*
556 - dev-ruby/windows_error
557 - dev-ruby/xdr:2.0.0
558 - dev-ruby/xmlrpc
559 - java? ( dev-ruby/rjb )
560 - nexpose? ( dev-ruby/nexpose )
561 - oracle? ( dev-ruby/ruby-oci8 )
562 - pcap? ( dev-ruby/pcaprub:*
563 - dev-ruby/network_interface )
564 - development? ( dev-ruby/fivemat
565 - dev-ruby/pry
566 - dev-ruby/redcarpet
567 - dev-ruby/yard
568 - >=dev-ruby/rake-10.0.0
569 - >=dev-ruby/factory_girl-4.1.0 )"
570 - #lorcon doesn't support ruby21
571 - #lorcon? ( net-wireless/lorcon[ruby] )
572 -ruby_add_bdepend "${RUBY_COMMON_DEPEND}
573 - test? ( >=dev-ruby/factory_girl-4.1.0
574 - dev-ruby/fivemat
575 - dev-ruby/database_cleaner
576 - >=dev-ruby/rspec-2.12
577 - dev-ruby/shoulda-matchers
578 - dev-ruby/timecop
579 - >=dev-ruby/rake-10.0.0 )"
580 -ruby_add_rdepend "${RUBY_COMMON_DEPEND}"
581 -
582 -COMMON_DEPEND="dev-db/postgresql[server]
583 - || ( app-crypt/johntheripper-jumbo >=app-crypt/johntheripper-1.7.9-r1[-minimal(-)] )
584 - net-analyzer/nmap"
585 -RDEPEND+=" ${COMMON_DEPEND}
586 - >=app-eselect/eselect-metasploit-0.16"
587 -
588 -QA_PREBUILT="
589 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux.bin
590 - usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux.bin
591 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_solaris.bin
592 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux.bin
593 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux_dll.bin
594 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_bsd.bin
595 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_bsd.bin
596 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
597 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
598 - usr/lib*/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
599 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
600 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
601 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
602 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
603 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2014-3153.elf
604 - usr/lib*/${PN}${SLOT}/data/exploits/mysql/lib_mysqludf_sys_32.so
605 - usr/lib*/${PN}${SLOT}/data/exploits/*
606 - usr/lib*/${PN}${SLOT}/data/android/libs/x86/libndkstager.so
607 - usr/lib*/${PN}${SLOT}/data/android/libs/mips/libndkstager.so
608 - usr/lib*/${PN}${SLOT}/data/android/libs/armeabi/libndkstager.so
609 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux_dll.bin
610 - usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux_dll.bin
611 - usr/lib*/${PN}${SLOT}/data/templates/template_aarch64_linux.bin
612 - "
613 -
614 -pkg_setup() {
615 - if use test; then
616 - su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
617 - su postgres -c "createuser msf_test_user -d -S -R"
618 - if [ $? -ne 0 ]; then
619 - su postgres -c "dropuser msf_test_user" || die
620 - su postgres -c "createuser msf_test_user -d -S -R" || die
621 - fi
622 - su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
623 - fi
624 - ruby-ng_pkg_setup
625 -}
626 -
627 -all_ruby_unpack() {
628 - if [[ ${PV} == "9999" ]] ; then
629 - git-r3_src_unpack
630 - else
631 - default_src_unpack
632 -# mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
633 -# rm -r msf3
634 - #msf_version=$(grep --color=never "CURRENT_VERSION =" ${S}/spec/lib/msf/core/framework_spec.rb)
635 - #msf_version=${msf_version#*=}
636 - fi
637 -}
638 -
639 -all_ruby_prepare() {
640 - # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
641 - #epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
642 - eapply_user
643 -
644 - #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
645 - rm -r data/cpuinfo
646 -
647 - #remove unneeded ruby bundler versioning files
648 - #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
649 - #we regen this file in each_ruby_prepare
650 - rm Gemfile.lock
651 -
652 - #The Gemfile contains real known deps
653 - sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die
654 - #use released packetfu
655 - sed -i "s/1.1.13.pre/1.1.13/" metasploit-framework.gemspec || die
656 - #use the stable pg
657 - #https://github.com/rapid7/metasploit-framework/issues/10234
658 - sed -i "s/dependency 'pg', '0.20.0'/dependency 'pg', '0.21.0'/" metasploit-framework.gemspec || die
659 - #git gems are only for ruby24 support and we are not there yet
660 - sed -i "/git:/d" Gemfile || die
661 -
662 - #now we edit the Gemfile based on use flags
663 - if ! use pcap; then
664 - sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
665 - fi
666 - if ! use nexpose; then
667 - sed -i -e "/nexpose/d" metasploit-framework.gemspec || die
668 - fi
669 - #no support for nessus right now
670 - #if ! use nessus; then
671 - sed -i -e "/nessus/d" metasploit-framework.gemspec || die
672 - #fi
673 -
674 - #OpenVAS support dropped on net-analyzer/metasploit. Bug:692076
675 - #openvas-omp is deprecated and masked for removal. Bug:692076
676 - #Remove openvas-omp in gemspec. Bug:698762
677 - sed -i -e "/openvas-omp/d" metasploit-framework.gemspec || die
678 -
679 - #even if we pass --without=blah bundler still calculates the deps and messes us up
680 - if ! use development; then
681 - sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
682 - fi
683 - if ! use test; then
684 - sed -i -e "/^group :test/,/^end$/d" Gemfile || die
685 - fi
686 - if ! use test && ! use development; then
687 - sed -i -e "/^group :development/,/^end$/d" Gemfile || die
688 - fi
689 - #We don't need simplecov
690 - sed -i -e "/^group :coverage/,/^end$/d" Gemfile || die
691 - sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
692 -
693 - #we need to edit the gemspec too, since it tries to call git instead of anything sane
694 - #probably a better way to fix this... if I care at some point
695 - sed -i -e "/^ spec.files/,/^ }/d" metasploit-framework.gemspec || die
696 -
697 - #https://bugs.gentoo.org/show_bug.cgi?id=584522 no tzinfo-data by choice in gentoo
698 - sed -i '/tzinfo-data/d' metasploit-framework.gemspec
699 -
700 - #let's bogart msfupdate
701 - rm msfupdate
702 - echo "#!/bin/sh" > msfupdate
703 - echo "echo \"[*]\"" >> msfupdate
704 - echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate
705 - echo "echo \"[*]\"" >> msfupdate
706 - echo "echo \"\"" >> msfupdate
707 - if [[ ${PV} == "9999" ]] ; then
708 - echo "if [ -x /usr/bin/smart-live-rebuild ]; then" >> msfupdate
709 - echo " smart-live-rebuild -f net-analyzer/metasploit" >> msfupdate
710 - echo "else" >> msfupdate
711 - echo " echo \"Please install app-portage/smart-live-rebuild for a better experience.\"" >> msfupdate
712 - echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
713 - echo "fi" >> msfupdate
714 - else
715 - echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
716 - echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
717 - echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate
718 - fi
719 - #this is set executable in src_install
720 -
721 - #install our database.yml file before tests are run
722 - cp "${FILESDIR}"/database.yml config/
723 -
724 -}
725 -
726 -each_ruby_prepare() {
727 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle install --local || die
728 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle check || die
729 -
730 - #force all metasploit executables to use desired ruby version
731 - #https://dev.metasploit.com/redmine/issues/8357
732 - for file in $(ls -1 msf*)
733 - do
734 - #poorly adapted from python.eclass
735 - sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?ruby\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${RUBY}:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
736 - done
737 -}
738 -
739 -each_ruby_test() {
740 - #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox
741 -
742 - #we bogart msfupdate so no point in trying to test it
743 - rm spec/msfupdate_spec.rb || die
744 - #we don't really want to be uploading to virustotal during the tests
745 - rm spec/tools/virustotal_spec.rb || die
746 -
747 - # https://dev.metasploit.com/redmine/issues/8425
748 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:create || die
749 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:migrate || die
750 -
751 - MSF_DATABASE_CONFIG=config/database.yml BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake || die
752 - su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
753 -}
754 -
755 -each_ruby_install() {
756 - #Tests have already been run, we don't need this stuff
757 - rm -r spec || die
758 - rm -r test || die
759 - rm Gemfile.lock || die
760 -
761 - #I'm 99% sure that this will only work for as long as we only support one ruby version. Creativity will be needed if we wish to support multiple.
762 - # should be as simple as copying everything into the target...
763 - dodir /usr/lib/${PN}${SLOT}
764 - cp -R * "${ED}"/usr/lib/${PN}${SLOT} || die "Copy files failed"
765 - rm -Rf "${ED}"/usr/lib/${PN}${SLOT}/documentation "${ED}"/usr/lib/${PN}${SLOT}/README.md
766 - fowners -R root:0 /
767 -
768 -}
769 -
770 -all_ruby_install() {
771 - # do not remove LICENSE, bug #238137
772 - dodir /usr/share/doc/${PF}
773 - cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
774 - ln -s "../../share/doc/${PF}/documentation" "${ED}/usr/lib/${PN}${SLOT}/documentation"
775 -
776 - fperms +x /usr/lib/${PN}${SLOT}/msfupdate
777 -
778 - #tell revdep-rebuild to ignore binaries meant for the target
779 - dodir /etc/revdep-rebuild
780 - cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
781 - #These dirs contain prebuilt binaries for running on the TARGET not the HOST
782 - SEARCH_DIRS_MASK="/usr/lib/${PN}${SLOT}/data/meterpreter"
783 - SEARCH_DIRS_MASK="/usr/lib/${PN}${SLOT}/data/exploits"
784 - EOF
785 -}
786 -
787 -pkg_postinst() {
788 - elog "Before use you should run 'env-update' and '. /etc/profile'"
789 - elog "otherwise you may be missing important environmental variables."
790 -
791 - elog "You need to prepare the database by running:"
792 - elog "emerge --config postgresql"
793 - elog "/etc/init.d/postgresql-<version> start"
794 - elog "emerge --config =metasploit-${PV}"
795 -
796 - "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
797 -
798 - einfo
799 - elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
800 -}
801 -
802 -pkg_config() {
803 - einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
804 - su postgres -c "createuser msf_user -D -S -R"
805 - su postgres -c "createdb --owner=msf_user msf_database"
806 -}