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/
Date: Tue, 09 Apr 2019 05:54:00
Message-Id: 1554789184.e09933a189ca1fb27c41b9777b589be9ae0f5401.graaff@gentoo
1 commit: e09933a189ca1fb27c41b9777b589be9ae0f5401
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 16 18:56:12 2019 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 9 05:53:04 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e09933a1
7
8 net-analyzer/metasploit: cleanup ruby23-only version
9
10 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>
11 Package-Manager: Portage-2.3.51, Repoman-2.3.11
12
13 net-analyzer/metasploit/Manifest | 1 -
14 .../metasploit/metasploit-4.14.16-r2.ebuild | 335 ---------------------
15 2 files changed, 336 deletions(-)
16
17 diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest
18 index 0c21a598802..09d5598966e 100644
19 --- a/net-analyzer/metasploit/Manifest
20 +++ b/net-analyzer/metasploit/Manifest
21 @@ -1,2 +1 @@
22 -DIST metasploit-4.14.16.tar.gz 23726763 BLAKE2B ab2d3f10c948db394643f2bcd9b08822f16133ef81abe7048b6c4e49bf635abded40d7359b9787f7f955ba6eccfdb81ff6372d24dd2acd732ba9f16cb41ca8b4 SHA512 882968e68ff5adf10426f6e8480f3eac7cd9b289c1e641a91e537d31a434858f2c47b4f7b5bf23fcfc22eceecd2527eedb7eac3e9a8ad4a212187762b1b9aab2
23 DIST metasploit-4.17.21.tar.gz 28812125 BLAKE2B 15ff8ccac99d783b7b9cd20d6512df551b3143b4947d2f347b2558d1bafd2861d41fe6b051034c75cd25030ad85d26f261ffe9149dd27d551f92f17fcc0b4075 SHA512 00763f515bc6b556d4dbe15a7c58fac3c7febb64fb339fd5c05ad2b18b5b55bdf8815daca35f24bb22bea3d376db4f4610918730d813079e5ac3f8d5ad16d2d9
24
25 diff --git a/net-analyzer/metasploit/metasploit-4.14.16-r2.ebuild b/net-analyzer/metasploit/metasploit-4.14.16-r2.ebuild
26 deleted file mode 100644
27 index fb8f4c563b8..00000000000
28 --- a/net-analyzer/metasploit/metasploit-4.14.16-r2.ebuild
29 +++ /dev/null
30 @@ -1,335 +0,0 @@
31 -# Copyright 1999-2018 Gentoo Authors
32 -# Distributed under the terms of the GNU General Public License v2
33 -
34 -EAPI="6"
35 -
36 -#never ever ever have more than one ruby in here
37 -USE_RUBY="ruby23"
38 -inherit eutils ruby-ng
39 -
40 -if [[ ${PV} == "9999" ]] ; then
41 - EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git"
42 - EGIT_CHECKOUT_DIR="${WORKDIR}"/all
43 - inherit git-r3
44 - KEYWORDS=""
45 - SLOT="9999"
46 -else
47 - ##Tags https://github.com/rapid7/metasploit-framework/releases
48 - MY_PV=${PV/_p/-}
49 - SRC_URI="https://github.com/rapid7/metasploit-framework/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
50 - KEYWORDS="~amd64 ~arm"
51 - RUBY_S="${PN}-framework-${MY_PV}"
52 - inherit eapi7-ver
53 - SLOT="$(ver_cut 1).$(ver_cut 2)"
54 -fi
55 -
56 -DESCRIPTION="Advanced framework for developing, testing, and using vulnerability exploit code"
57 -HOMEPAGE="http://www.metasploit.org/"
58 -LICENSE="BSD"
59 -IUSE="development +java nexpose openvas oracle +pcap test"
60 -
61 -#multiple known bugs with tests reported upstream and ignored
62 -#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible)
63 -RESTRICT="test"
64 -
65 -RUBY_COMMON_DEPEND="virtual/ruby-ssl
66 - >=dev-ruby/activesupport-4.2.6:4.2
67 - >=dev-ruby/actionpack-4.2.6:4.2
68 - >=dev-ruby/activerecord-4.2.6:4.2
69 - dev-ruby/bcrypt-ruby
70 - dev-ruby/bit-struct
71 - >=dev-ruby/builder-3.0
72 - dev-ruby/bundler
73 - dev-ruby/filesize:*
74 - >=dev-ruby/jsobfu-0.3.0:*
75 - dev-ruby/json:*
76 - dev-ruby/kissfft
77 - dev-ruby/metasm:1.0.2
78 - >=dev-ruby/metasploit_data_models-2.0.0
79 - dev-ruby/meterpreter_bins:0.0.22
80 - dev-ruby/metasploit-payloads:1.2.24
81 - dev-ruby/metasploit_payloads-mettle:0.1.9
82 - >=dev-ruby/metasploit-credential-2.0.0
83 - >=dev-ruby/metasploit-concern-2.0.0
84 - >=dev-ruby/metasploit-model-2.0.0
85 - dev-ruby/msgpack
86 - dev-ruby/net-ssh:*
87 - dev-ruby/nokogiri
88 - dev-ruby/octokit
89 - dev-ruby/openssl-ccm:1.2.1
90 - dev-ruby/patch_finder
91 - >=dev-ruby/recog-2.0.14
92 - dev-ruby/redcarpet
93 - >=dev-ruby/rkelly-remix-0.0.6
94 - dev-ruby/rex-arch
95 - dev-ruby/rex-bin_tools
96 - dev-ruby/rex-core
97 - dev-ruby/rex-encoder
98 - dev-ruby/rex-exploitation
99 - dev-ruby/rex-java
100 - dev-ruby/rex-mime
101 - dev-ruby/rex-nop
102 - dev-ruby/rex-ole
103 - dev-ruby/rex-powershell
104 - dev-ruby/rex-random_identifier
105 - dev-ruby/rex-registry
106 - dev-ruby/rex-socket
107 - dev-ruby/rex-sslscan
108 - dev-ruby/rex-rop_builder
109 - dev-ruby/rex-struct2
110 - dev-ruby/rex-text
111 - dev-ruby/rex-zip
112 - dev-ruby/ruby_smb:*
113 - dev-ruby/sqlite3
114 - >=dev-ruby/pg-0.11:*
115 - dev-ruby/packetfu:1.1.13
116 - >=dev-ruby/rubyzip-1.1
117 - >=dev-ruby/rb-readline-0.5.4
118 - dev-ruby/robots
119 - dev-ruby/sshkey
120 - dev-ruby/tzinfo:*
121 - dev-ruby/windows_error
122 - dev-ruby/xmlrpc
123 - java? ( dev-ruby/rjb )
124 - nexpose? ( dev-ruby/nexpose )
125 - openvas? ( dev-ruby/openvas-omp )
126 - oracle? ( dev-ruby/ruby-oci8 )
127 - pcap? ( dev-ruby/pcaprub:*
128 - dev-ruby/network_interface )
129 - development? ( dev-ruby/fivemat
130 - dev-ruby/pry
131 - dev-ruby/redcarpet
132 - dev-ruby/yard
133 - >=dev-ruby/rake-10.0.0
134 - >=dev-ruby/factory_girl-4.1.0 )"
135 - #lorcon doesn't support ruby21
136 - #lorcon? ( net-wireless/lorcon[ruby] )
137 -ruby_add_bdepend "${RUBY_COMMON_DEPEND}
138 - test? ( >=dev-ruby/factory_girl-4.1.0
139 - dev-ruby/fivemat
140 - dev-ruby/database_cleaner
141 - >=dev-ruby/rspec-2.12
142 - dev-ruby/shoulda-matchers
143 - dev-ruby/timecop
144 - >=dev-ruby/rake-10.0.0 )"
145 -ruby_add_rdepend "${RUBY_COMMON_DEPEND}"
146 -
147 -COMMON_DEPEND="dev-db/postgresql[server]
148 - || ( app-crypt/johntheripper-jumbo >=app-crypt/johntheripper-1.7.9-r1[-minimal] )
149 - net-analyzer/nmap"
150 -RDEPEND+=" ${COMMON_DEPEND}
151 - >=app-eselect/eselect-metasploit-0.16"
152 -
153 -RESTRICT="strip"
154 -
155 -QA_PREBUILT="
156 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux.bin
157 - usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux.bin
158 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_solaris.bin
159 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux.bin
160 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux_dll.bin
161 - usr/lib*/${PN}${SLOT}/data/templates/template_x86_bsd.bin
162 - usr/lib*/${PN}${SLOT}/data/templates/template_x64_bsd.bin
163 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin
164 - usr/lib*/${PN}${SLOT}/data/templates/template_mipsle_linux.bin
165 - usr/lib*/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin
166 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
167 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
168 - usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso
169 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin
170 - usr/lib*/${PN}${SLOT}/data/exploits/CVE-2014-3153.elf
171 - usr/lib*/${PN}${SLOT}/data/android/libs/x86/libndkstager.so
172 - usr/lib*/${PN}${SLOT}/data/android/libs/mips/libndkstager.so
173 - usr/lib*/${PN}${SLOT}/data/android/libs/armeabi/libndkstager.so
174 - "
175 -
176 -pkg_setup() {
177 - if use test; then
178 - su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail
179 - su postgres -c "createuser msf_test_user -d -S -R"
180 - if [ $? -ne 0 ]; then
181 - su postgres -c "dropuser msf_test_user" || die
182 - su postgres -c "createuser msf_test_user -d -S -R" || die
183 - fi
184 - su postgres -c "createdb --owner=msf_test_user msf_test_database" || die
185 - fi
186 - ruby-ng_pkg_setup
187 -}
188 -
189 -all_ruby_unpack() {
190 - if [[ ${PV} == "9999" ]] ; then
191 - git-r3_src_unpack
192 - else
193 - default_src_unpack
194 -# mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all
195 -# rm -r msf3
196 - #msf_version=$(grep --color=never "CURRENT_VERSION =" ${S}/spec/lib/msf/core/framework_spec.rb)
197 - #msf_version=${msf_version#*=}
198 - fi
199 -}
200 -
201 -all_ruby_prepare() {
202 - # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs
203 - #epatch "${FILESDIR}/agix_psexec_pull-2657.patch"
204 - eapply_user
205 -
206 - #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run
207 - rm -r data/cpuinfo
208 -
209 - #remove unneeded ruby bundler versioning files
210 - #Gemfile.lock contains the versions tested by the msf team but not the hard requirements
211 - #we regen this file in each_ruby_prepare
212 - rm Gemfile.lock
213 -
214 - #The Gemfile contains real known deps
215 - sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die
216 - #use released packetfu
217 - sed -i "s/1.1.13.pre/1.1.13/" metasploit-framework.gemspec || die
218 - #git gems are only for ruby24 support and we are not there yet
219 - sed -i "/git:/d" Gemfile || die
220 -
221 - #now we edit the Gemfile based on use flags
222 - if ! use pcap; then
223 - sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die
224 - fi
225 - if ! use nexpose; then
226 - sed -i -e "/nexpose/d" metasploit-framework.gemspec || die
227 - fi
228 - #no support for nessus right now
229 - #if ! use nessus; then
230 - sed -i -e "/nessus/d" metasploit-framework.gemspec || die
231 - #fi
232 - if ! use openvas; then
233 - sed -i -e "/openvas-omp/d" metasploit-framework.gemspec || die
234 - fi
235 - #even if we pass --without=blah bundler still calculates the deps and messes us up
236 - if ! use development; then
237 - sed -i -e "/^group :development do/,/^end$/d" Gemfile || die
238 - fi
239 - if ! use test; then
240 - sed -i -e "/^group :test/,/^end$/d" Gemfile || die
241 - fi
242 - if ! use test && ! use development; then
243 - sed -i -e "/^group :development/,/^end$/d" Gemfile || die
244 - fi
245 - #We don't need simplecov
246 - sed -i -e "/^group :coverage/,/^end$/d" Gemfile || die
247 - sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die
248 -
249 - #we need to edit the gemspec too, since it tries to call git instead of anything sane
250 - #probably a better way to fix this... if I care at some point
251 - sed -i -e "/^ spec.files/,/^ }/d" metasploit-framework.gemspec || die
252 -
253 - #https://bugs.gentoo.org/show_bug.cgi?id=584522 no tzinfo-data by choice in gentoo
254 - sed -i '/tzinfo-data/d' metasploit-framework.gemspec
255 -
256 - #avoid specifically versioned rex-arch
257 - sed -i -e "/rex-arch/ s/, '0.1.4'//" metasploit-framework.gemspec || die
258 -
259 - #let's bogart msfupdate
260 - rm msfupdate
261 - echo "#!/bin/sh" > msfupdate
262 - echo "echo \"[*]\"" >> msfupdate
263 - echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate
264 - echo "echo \"[*]\"" >> msfupdate
265 - echo "echo \"\"" >> msfupdate
266 - if [[ ${PV} == "9999" ]] ; then
267 - echo "if [ -x /usr/bin/smart-live-rebuild ]; then" >> msfupdate
268 - echo " smart-live-rebuild -f net-analyzer/metasploit" >> msfupdate
269 - echo "else" >> msfupdate
270 - echo " echo \"Please install app-portage/smart-live-rebuild for a better experience.\"" >> msfupdate
271 - echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate
272 - echo "fi" >> msfupdate
273 - else
274 - echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate
275 - echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate
276 - echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate
277 - fi
278 - #this is set executable in src_install
279 -
280 - #install our database.yml file before tests are run
281 - cp "${FILESDIR}"/database.yml config/
282 -
283 -}
284 -
285 -each_ruby_prepare() {
286 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle install --local || die
287 - MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle check || die
288 -
289 - #force all metasploit executables to use desired ruby version
290 - #https://dev.metasploit.com/redmine/issues/8357
291 - for file in $(ls -1 msf*)
292 - do
293 - #poorly adapted from python.eclass
294 - 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"
295 - done
296 -}
297 -
298 -each_ruby_test() {
299 - #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox
300 -
301 - #we bogart msfupdate so no point in trying to test it
302 - rm spec/msfupdate_spec.rb || die
303 - #we don't really want to be uploading to virustotal during the tests
304 - rm spec/tools/virustotal_spec.rb || die
305 -
306 - # https://dev.metasploit.com/redmine/issues/8425
307 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:create || die
308 - BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:migrate || die
309 -
310 - MSF_DATABASE_CONFIG=config/database.yml BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake || die
311 - su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user"
312 -}
313 -
314 -each_ruby_install() {
315 - #Tests have already been run, we don't need this stuff
316 - rm -r spec || die
317 - rm -r test || die
318 - rm Gemfile.lock || die
319 -
320 - #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.
321 - # should be as simple as copying everything into the target...
322 - dodir /usr/$(get_libdir)/${PN}${SLOT}
323 - cp -R * "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
324 - rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md
325 - fowners -R root:0 /
326 -
327 -}
328 -
329 -all_ruby_install() {
330 - # do not remove LICENSE, bug #238137
331 - dodir /usr/share/doc/${PF}
332 - cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die
333 - ln -s "../../share/doc/${PF}/documentation" "${ED}/usr/$(get_libdir)/${PN}${SLOT}/documentation"
334 -
335 - fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate
336 -
337 - #tell revdep-rebuild to ignore binaries meant for the target
338 - dodir /etc/revdep-rebuild
339 - cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT}
340 - #These dirs contain prebuilt binaries for running on the TARGET not the HOST
341 - SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter"
342 - SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits"
343 - EOF
344 -}
345 -
346 -pkg_postinst() {
347 - elog "Before use you should run 'env-update' and '. /etc/profile'"
348 - elog "otherwise you may be missing important environmental variables."
349 -
350 - elog "You need to prepare the database by running:"
351 - elog "emerge --config postgresql"
352 - elog "/etc/init.d/postgresql-<version> start"
353 - elog "emerge --config =metasploit-${PV}"
354 -
355 - "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT}
356 -
357 - einfo
358 - elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary"
359 -}
360 -
361 -pkg_config() {
362 - einfo "If the following fails, it is likely because you forgot to start/config postgresql first"
363 - su postgres -c "createuser msf_user -D -S -R"
364 - su postgres -c "createdb --owner=msf_user msf_database"
365 -}