diff --git a/dev-ruby/metasploit-payloads/Manifest b/dev-ruby/metasploit-payloads/Manifest index 393650953..1994e47b1 100644 --- a/dev-ruby/metasploit-payloads/Manifest +++ b/dev-ruby/metasploit-payloads/Manifest @@ -1,3 +1,4 @@ DIST metasploit-payloads-1.2.32.gem 11548160 SHA256 2fc5c12db9fce964e0fa734ad1bcdf303cddcbaef22efb2672463560eef716b7 SHA512 785aaf345967f42dbb61ec13a5a562a9454fc80cba8a37674d7bf812b0097c3fc8b28f33fcb5089519f97574ade45d8d7639546c0436eea763d6b4efe401fb42 WHIRLPOOL 538b8e4d4b0f0cee912a21f7ad085ed158b92d0869c6c1c7210fabe77833b53375bb7e4a401ca1d6ff7101d4db9c79113d73265a7b1e6f289e6deb0da0e0d347 DIST metasploit-payloads-1.2.37.gem 11979776 SHA256 8338af2d06e2d39319b9204b4446cfe7959dedca6406d83860a2c8f97aa51181 SHA512 5b9403ffcbc0705185d2aefc0f9f9be31720b634d83f1a8bf0eafdde398525b3b35f5daf30bd5930f545053d3a2b79bfe774971591ed3dcc37b8d4cbf5380dd8 WHIRLPOOL 9a00f40dbd859f60cf17115de0d2f51fcd9eaaab20b2c61e542f0d110ef290a2c09d1265f30bdc3705d5cc41c8f81070451574dd63093a317b5cf7c69c207a7c DIST metasploit-payloads-1.2.40.gem 11980800 SHA256 72392ee2057b92376dabbd18a3dceb01c39466769f71e3792223e634920102a0 SHA512 786247e141a98891b0329bbeb9aa62304988aa4ec67aff9cffe0d1da09c5ae31fe69a6862473b6e3959cf874988cf68c0d8160b439dd79658b6d4d6070d851ba WHIRLPOOL 56e92b088fde4c9aa7308748ce2d64750b354602f8293fb6e7e135525ac6b6502279e5ad87d2d7162baa0c3df38dbb50c81800cc42c744b455a74ae5651a8c55 +DIST metasploit-payloads-1.3.9.gem 11930112 SHA256 44d883f777f844a24928fb4934f5e3aac96e290e3364a8c19f0ab9a745713a1e SHA512 821c4e15572355f9df7e9eddd6eaadfc289a38d6e934d636d9182b189531f7c13df48c0830a29973f1496d3da22bfdc2fe66a391b5c90811444601cca3ce7a8a WHIRLPOOL de0b8098b0e056cc0cd74d63700fa25a88c20d14849cc7d84076d81f4417b68806b3e0a4d0dece62db5d4494871925c64e78423662427bf0c369d9ee01ba6eaf diff --git a/dev-ruby/metasploit-payloads/metasploit-payloads-1.3.9.ebuild b/dev-ruby/metasploit-payloads/metasploit-payloads-1.3.9.ebuild new file mode 100644 index 000000000..b8bb0f66d --- /dev/null +++ b/dev-ruby/metasploit-payloads/metasploit-payloads-1.3.9.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +USE_RUBY="ruby21 ruby22 ruby23 ruby24" + +RUBY_FAKEGEM_TASK_DOC="" + +RUBY_FAKEGEM_EXTRAINSTALL="data" + +inherit ruby-fakegem + +DESCRIPTION="Compiled binaries for Metasploit's Meterpreter" +HOMEPAGE="https://rubygems.org/gems/metasploit-payloads" + +LICENSE="BSD" + +SLOT="${PV}" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="" + +#no tests +RESTRICT="test strip" + +QA_PREBUILT=" + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/meterpreter/msflinker_linux_x86.bin + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/meterpreter/ext_server_sniffer.lso + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/meterpreter/ext_server_networkpug.lso + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/meterpreter/ext_server_stdapi.lso + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/android/libs/armeabi/libndkstager.so + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/android/libs/mips/libndkstager.so + usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/android/libs/x86/libndkstager.so + " + +src_install() { + ruby-ng_src_install + #tell revdep-rebuild to ignore binaries meant for the target + dodir /etc/revdep-rebuild + cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-${PN}-${SLOT} || die + #These dirs contain prebuilt binaries for running on the TARGET not the HOST + SEARCH_DIRS_MASK="/usr/lib*/ruby/gems/*/gems/${PN}-${SLOT}/data/android/libs" + EOF +} diff --git a/dev-ruby/metasploit_payloads-mettle/Manifest b/dev-ruby/metasploit_payloads-mettle/Manifest index 277c6a256..bb444a64f 100644 --- a/dev-ruby/metasploit_payloads-mettle/Manifest +++ b/dev-ruby/metasploit_payloads-mettle/Manifest @@ -1 +1,2 @@ DIST metasploit_payloads-mettle-0.1.10.gem 8394752 SHA256 b6a86683d61ecf27ddef0bc965ad2e150062c3a793513eb5fcef2694ede679cd SHA512 6a4ea02e18d11bbd40fd13e0f2baa149395b1b3e75e9b2b168f00e3c24ff7c8bb376bfce232db55b29dcdd407581e933fd34279fb0cc6cf8a51112093fa504a2 WHIRLPOOL aa91a35593e1c44bc268f67d6263f28a2d28a8deb97b0a3b336461f4dc09b9e9b5d263d5754a3d10fb42ab506353e64f7e5925a07acfb0a98797a4fff05ae893 +DIST metasploit_payloads-mettle-0.2.2.gem 10176512 SHA256 c7faf12418a83026c70422440cae878c7a3809b1d9fc4dc380d65e429316cb7f SHA512 d7dca148895a409a6478da0dfb12db17967d75a2fdd0643759a83cacc8cb596125d59f723b8c9cadde63b2863b97af04ff44f0e50fd1854b485dbb5c44f9e24e WHIRLPOOL fb315573c2bc5a17bbde38da4f2eb9c89ed516a43bdc9d6d004e175b8d3e9e2a316643c5a620b7e6d4690e484d0033d3d2ab9b16f416bfbf861ffbbbec99390b diff --git a/dev-ruby/metasploit_payloads-mettle/metasploit_payloads-mettle-0.2.2.ebuild b/dev-ruby/metasploit_payloads-mettle/metasploit_payloads-mettle-0.2.2.ebuild new file mode 100644 index 000000000..7606a710d --- /dev/null +++ b/dev-ruby/metasploit_payloads-mettle/metasploit_payloads-mettle-0.2.2.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +USE_RUBY="ruby21 ruby22 ruby23 ruby24" + +RUBY_FAKEGEM_TASK_DOC="" + +RUBY_FAKEGEM_EXTRAINSTALL="build" + +inherit ruby-fakegem + +DESCRIPTION="Compiled binaries for Metasploit's next-gen Meterpreter" +HOMEPAGE="https://rubygems.org/gems/metasploit_payloads-mettle" + +LICENSE="BSD" + +SLOT="${PV}" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="" + +#no tests +RESTRICT="test strip" + +QA_PREBUILT=" + usr/lib*/ruby/gems/*/gems/${P}/build/mips-linux-muslsf/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/mips64-linux-muslsf/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/aarch64-linux-musl/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/armv5b-linux-musleabi/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/armv5l-linux-musleabi/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/i486-linux-musl/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/mipsel-linux-muslsf/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/powerpc-linux-muslsf/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/powerpc64le-linux-musl/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/x86_64-linux-musl/bin/mettle.bin + usr/lib*/ruby/gems/*/gems/${P}/build/s390x-linux-musl/bin/mettle + usr/lib*/ruby/gems/*/gems/${P}/build/s390x-linux-musl/bin/mettle.bin + + /usr/lib*/ruby/gems/*/gems/${P}/build/aarch64-linux-musl/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/armv5b-linux-musleabi/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/armv5l-linux-musleabi/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/i486-linux-musl/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/mips-linux-muslsf/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/mips64-linux-muslsf/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/mipsel-linux-muslsf/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/powerpc-linux-muslsf/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/powerpc64le-linux-musl/bin/mettle + /usr/lib*/ruby/gems/*/gems/${P}/build/x86_64-linux-musl/bin/mettle + + " + +src_install() { + ruby-ng_src_install + #tell revdep-rebuild to ignore binaries meant for the target + dodir /etc/revdep-rebuild + cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-${PN}-${SLOT} || die + #These dirs contain prebuilt binaries for running on the TARGET not the HOST + SEARCH_DIRS_MASK="/usr/lib*/ruby/gems/*/gems/${P}/build" + EOF +} diff --git a/dev-ruby/rbnacl-libsodium/Manifest b/dev-ruby/rbnacl-libsodium/Manifest new file mode 100644 index 000000000..2d7266d8d --- /dev/null +++ b/dev-ruby/rbnacl-libsodium/Manifest @@ -0,0 +1 @@ +DIST rbnacl-libsodium-1.0.13.gem 2337280 SHA256 ed05931bc053007445c384a615a24ee05ba997dabdfc3e825301d4402275438c SHA512 d0877fa8fe8fa6ffdc9b2e50bf22a1e035e9999abc100ed08bb8e611fa0f51c177831755d51b3ff36d6d05d1e0b921110759f7f0e036a470a0fc8739e298a4d3 WHIRLPOOL d5e5251cccd495da0b198bd797285158f6c557791afa7a074801744d33e40a345349f9ec972ab0d9b28757e1fbb5802a29b1b43ac23c835ce549a9117b0db36d diff --git a/dev-ruby/rbnacl-libsodium/rbnacl-libsodium-1.0.13.ebuild b/dev-ruby/rbnacl-libsodium/rbnacl-libsodium-1.0.13.ebuild new file mode 100644 index 000000000..b8a6bd1ff --- /dev/null +++ b/dev-ruby/rbnacl-libsodium/rbnacl-libsodium-1.0.13.ebuild @@ -0,0 +1,18 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +USE_RUBY="ruby23 ruby24" + +inherit ruby-fakegem + +DESCRIPTION="rbnacl with bundled libsodium" +HOMEPAGE="https://github.com/cryptosphere/rbnacl-libsodium" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND=" >=dev-ruby/rbnacl-3.0.1 " diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest index b4e02eb5b..b94744ad0 100644 --- a/net-analyzer/metasploit/Manifest +++ b/net-analyzer/metasploit/Manifest @@ -1,2 +1,3 @@ DIST metasploit-4.14.28.tar.gz 23964535 SHA256 f2bc048542d7cbba16308b5a987718428825b5f00df7e5245543598d9d42a169 SHA512 734f38ecba3b37731bd7bb4b07081be1c7bb46f0a7fa8df54a601f534c8b7e85fe0b3f145deac5219c4849086fb96ea5c0acf6d5dff4f3b1192eaa31773b8a9d WHIRLPOOL 8aa10442a7ae3f5bdf831eb2b4d52c4e6007a0b88be3886ec8719d357ab826e3205d7597bb7cb3fba4fbfe656728008057e57c218954767a9b7e5069fc8e869c DIST metasploit-4.15.0.tar.gz 24001400 SHA256 f3a21c3aedaa94c26e61dd22609863123956916a7b7b46c8d76541ce16708c66 SHA512 3e7d6bb0915211bd21d2a9eb23927042a137bcb81acbb1284c59ddb36b7ef29f891224d8421e23877a03229dfbb9462547211f601a3789edaef04826d655a264 WHIRLPOOL d570a1475a4e1da066dfef09fc0178138afed4b3cd80d6ad7d9dd1f4e7422e32033aa0a95092e8ae100a1dbcfad55330e4bb5ee555ad8e41f47321164349c312 +DIST metasploit-4.16.11.tar.gz 24136858 SHA256 13ce7794bec989bcab6868c1f2d2c5f054b5ea0c167a9baf82fb3ed006a053d8 SHA512 5913962b85e3234fe1e75603b4075f9034c317224619b13f898b1fe5197ce1c7c0161344c9323a092be45184d0faa7a31c3da772c316c5a69b44f7ea90f81846 WHIRLPOOL df26c4fdd341f9aa308f9837d6ac19e4715f6bb3048cea7eb49e8211a881c2fbac9269b037f682a92b39294315b1c7c07e5d954c1e249fc11bab11492d7bb0f7 diff --git a/net-analyzer/metasploit/metasploit-4.16.11.ebuild b/net-analyzer/metasploit/metasploit-4.16.11.ebuild new file mode 100644 index 000000000..fdaf3b6e0 --- /dev/null +++ b/net-analyzer/metasploit/metasploit-4.16.11.ebuild @@ -0,0 +1,339 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +#never ever ever have more than one ruby in here +USE_RUBY="ruby23" +inherit eutils ruby-ng + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="https://github.com/rapid7/metasploit-framework.git" + EGIT_CHECKOUT_DIR="${WORKDIR}"/all + inherit git-r3 + KEYWORDS="" + SLOT="9999" +else + ##Tags https://github.com/rapid7/metasploit-framework/releases + MY_PV=${PV/_p/-} + SRC_URI="https://github.com/rapid7/metasploit-framework/archive/${MY_PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm" + RUBY_S="${PN}-framework-${MY_PV}" + inherit versionator + SLOT="$(get_version_component_range 1).$(get_version_component_range 2)" +fi + +DESCRIPTION="Advanced framework for developing, testing, and using vulnerability exploit code" +HOMEPAGE="http://www.metasploit.org/" +LICENSE="BSD" +IUSE="development +java nexpose openvas oracle +pcap test" + +#multiple known bugs with tests reported upstream and ignored +#http://dev.metasploit.com/redmine/issues/8418 - worked around (fix user creation when possible) +RESTRICT="test" + +RUBY_COMMON_DEPEND="virtual/ruby-ssl + >=dev-ruby/activesupport-4.2.6:4.2 + >=dev-ruby/actionpack-4.2.6:4.2 + >=dev-ruby/activerecord-4.2.6:4.2 + dev-ruby/backports + dev-ruby/bcrypt-ruby + dev-ruby/bit-struct + >=dev-ruby/builder-3.0 + dev-ruby/bundler + dev-ruby/dnsruby + dev-ruby/filesize + >=dev-ruby/jsobfu-0.3.0 + dev-ruby/json:* + dev-ruby/kissfft + dev-ruby/metasm:1.0.2 + >=dev-ruby/metasploit_data_models-2.0.0 + dev-ruby/meterpreter_bins:0.0.22 + dev-ruby/metasploit-payloads:1.3.9 + dev-ruby/metasploit_payloads-mettle:0.2.2 + >=dev-ruby/metasploit-credential-2.0.0 + >=dev-ruby/metasploit-concern-2.0.0 + >=dev-ruby/metasploit-model-2.0.0 + dev-ruby/msgpack + dev-ruby/net-ssh:* + dev-ruby/nokogiri + dev-ruby/octokit + dev-ruby/openssl-ccm:1.2.1 + dev-ruby/patch_finder + dev-ruby/pdf-reader + dev-ruby/rbnacl:4 + dev-ruby/rbnacl-libsodium + dev-ruby/bcrypt_pbkdf + >=dev-ruby/recog-2.0.14 + dev-ruby/redcarpet + >=dev-ruby/rkelly-remix-0.0.6 + =dev-ruby/rex-arch-0.1.4 + dev-ruby/rex-bin_tools + dev-ruby/rex-core + dev-ruby/rex-encoder + dev-ruby/rex-exploitation + dev-ruby/rex-java + dev-ruby/rex-mime + dev-ruby/rex-nop + dev-ruby/rex-ole + dev-ruby/rex-powershell + dev-ruby/rex-random_identifier + dev-ruby/rex-registry + dev-ruby/rex-socket + dev-ruby/rex-sslscan + dev-ruby/rex-rop_builder + dev-ruby/rex-struct2 + dev-ruby/rex-text + dev-ruby/rex-zip + dev-ruby/ruby_smb + dev-ruby/sqlite3 + =dev-ruby/pg-0.20.0 + dev-ruby/packetfu:1.1.13 + >=dev-ruby/rubyzip-1.1 + >=dev-ruby/rb-readline-0.5.4 + dev-ruby/robots + dev-ruby/sshkey + dev-ruby/tzinfo:* + dev-ruby/windows_error + dev-ruby/xmlrpc + dev-ruby/xdr + java? ( dev-ruby/rjb ) + nexpose? ( dev-ruby/nexpose ) + openvas? ( dev-ruby/openvas-omp ) + oracle? ( dev-ruby/ruby-oci8 ) + pcap? ( dev-ruby/pcaprub:* + dev-ruby/network_interface ) + development? ( dev-ruby/fivemat + dev-ruby/pry + dev-ruby/redcarpet + dev-ruby/yard + >=dev-ruby/rake-10.0.0 + >=dev-ruby/factory_girl-4.1.0 )" + #lorcon doesn't support ruby21 + #lorcon? ( net-wireless/lorcon[ruby] ) +ruby_add_bdepend "${RUBY_COMMON_DEPEND} + test? ( >=dev-ruby/factory_girl-4.1.0 + dev-ruby/fivemat + dev-ruby/database_cleaner + >=dev-ruby/rspec-2.12 + dev-ruby/shoulda-matchers + dev-ruby/timecop + >=dev-ruby/rake-10.0.0 )" +ruby_add_rdepend "${RUBY_COMMON_DEPEND}" + +COMMON_DEPEND="dev-db/postgresql[server] + >=app-crypt/johntheripper-1.7.9-r1[-minimal] + net-analyzer/nmap" +RDEPEND+=" ${COMMON_DEPEND} + >=app-eselect/eselect-metasploit-0.16" + +RESTRICT="strip" + +QA_PREBUILT=" + usr/lib*/${PN}${SLOT}/data/templates/template_x86_linux.bin + usr/lib*/${PN}${SLOT}/data/templates/template_armle_linux.bin + usr/lib*/${PN}${SLOT}/data/templates/template_x86_solaris.bin + usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux.bin + usr/lib*/${PN}${SLOT}/data/templates/template_x64_linux_dll.bin + usr/lib*/${PN}${SLOT}/data/templates/template_x86_bsd.bin + usr/lib*/${PN}${SLOT}/data/templates/template_x64_bsd.bin + usr/lib*/${PN}${SLOT}/data/templates/template_mipsbe_linux.bin + usr/lib*/${PN}${SLOT}/data/templates/template_mipsle_linux.bin + usr/lib*/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin + usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso + usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso + usr/lib*/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso + usr/lib*/${PN}${SLOT}/data/exploits/CVE-2013-2171.bin + usr/lib*/${PN}${SLOT}/data/exploits/CVE-2014-3153.elf + usr/lib*/${PN}${SLOT}/data/android/libs/x86/libndkstager.so + usr/lib*/${PN}${SLOT}/data/android/libs/mips/libndkstager.so + usr/lib*/${PN}${SLOT}/data/android/libs/armeabi/libndkstager.so + " + +pkg_setup() { + if use test; then + su postgres -c "dropdb msf_test_database" #this is intentionally allowed to fail + su postgres -c "createuser msf_test_user -d -S -R" + if [ $? -ne 0 ]; then + su postgres -c "dropuser msf_test_user" || die + su postgres -c "createuser msf_test_user -d -S -R" || die + fi + su postgres -c "createdb --owner=msf_test_user msf_test_database" || die + fi + ruby-ng_pkg_setup +} + +all_ruby_unpack() { + if [[ ${PV} == "9999" ]] ; then + git-r3_src_unpack + else + default_src_unpack +# mv "${WORKDIR}"/all/msf3/* "${WORKDIR}"/all +# rm -r msf3 + #msf_version=$(grep --color=never "CURRENT_VERSION =" ${S}/spec/lib/msf/core/framework_spec.rb) + #msf_version=${msf_version#*=} + fi +} + +all_ruby_prepare() { + # add psexec patch from pull request 2657 to allow custom exe templates from any files, bypassing most AVs + #epatch "${FILESDIR}/agix_psexec_pull-2657.patch" + eapply_user + + #remove random "cpuinfo" binaries which a only needed to detect which bundled john to run + rm -r data/cpuinfo + + #remove unneeded ruby bundler versioning files + #Gemfile.lock contains the versions tested by the msf team but not the hard requirements + #we regen this file in each_ruby_prepare + rm Gemfile.lock + + #The Gemfile contains real known deps + sed -i "/gem 'fivemat'/s/, '1.2.1'//" Gemfile || die + #use released packetfu + sed -i "s/1.1.13.pre/1.1.13/" metasploit-framework.gemspec || die + #git gems are only for ruby24 support and we are not there yet + sed -i "/git:/d" Gemfile || die + + #now we edit the Gemfile based on use flags + if ! use pcap; then + sed -i -e "/^group :pcap do/,/^end$/d" Gemfile || die + fi + if ! use nexpose; then + sed -i -e "/nexpose/d" metasploit-framework.gemspec || die + fi + #no support for nessus right now + #if ! use nessus; then + sed -i -e "/nessus/d" metasploit-framework.gemspec || die + #fi + if ! use openvas; then + sed -i -e "/openvas-omp/d" metasploit-framework.gemspec || die + fi + #even if we pass --without=blah bundler still calculates the deps and messes us up + if ! use development; then + sed -i -e "/^group :development do/,/^end$/d" Gemfile || die + fi + if ! use test; then + sed -i -e "/^group :test/,/^end$/d" Gemfile || die + fi + if ! use test && ! use development; then + sed -i -e "/^group :development/,/^end$/d" Gemfile || die + fi + #We don't need simplecov + sed -i -e "/^group :coverage/,/^end$/d" Gemfile || die + sed -i -e "s#require 'simplecov'##" spec/spec_helper.rb || die + + #we need to edit the gemspec too, since it tries to call git instead of anything sane + #probably a better way to fix this... if I care at some point + sed -i -e "/^ spec.files/,/^ }/d" metasploit-framework.gemspec || die + + #https://bugs.gentoo.org/show_bug.cgi?id=584522 no tzinfo-data by choice in gentoo + sed -i '/tzinfo-data/d' metasploit-framework.gemspec + + #let's bogart msfupdate + rm msfupdate + echo "#!/bin/sh" > msfupdate + echo "echo \"[*]\"" >> msfupdate + echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> msfupdate + echo "echo \"[*]\"" >> msfupdate + echo "echo \"\"" >> msfupdate + if [[ ${PV} == "9999" ]] ; then + echo "if [ -x /usr/bin/smart-live-rebuild ]; then" >> msfupdate + echo " smart-live-rebuild -f net-analyzer/metasploit" >> msfupdate + echo "else" >> msfupdate + echo " echo \"Please install app-portage/smart-live-rebuild for a better experience.\"" >> msfupdate + echo "emerge --oneshot \"=${CATEGORY}/${PF}\"" >> msfupdate + echo "fi" >> msfupdate + else + echo "echo \"Unable to update tagged version of metasploit.\"" >> msfupdate + echo "echo \"If you want the latest please install and eselect the live version (metasploit9999)\"" >> msfupdate + echo "echo \"emerge metasploit:9999 -vat && eselect metasploit set metasploit9999\"" >> msfupdate + fi + #this is set executable in src_install + + #install our database.yml file before tests are run + cp "${FILESDIR}"/database.yml config/ + +} + +each_ruby_prepare() { + MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle install --local || die + MSF_ROOT="." BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle check || die + + #force all metasploit executables to use desired ruby version + #https://dev.metasploit.com/redmine/issues/8357 + for file in $(ls -1 msf*) + do + #poorly adapted from python.eclass + 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" + done +} + +each_ruby_test() { + #review dev-python/pymongo for ways to make the test compatible with FEATURES=network-sandbox + + #we bogart msfupdate so no point in trying to test it + rm spec/msfupdate_spec.rb || die + #we don't really want to be uploading to virustotal during the tests + rm spec/tools/virustotal_spec.rb || die + + # https://dev.metasploit.com/redmine/issues/8425 + BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:create || die + BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake db:migrate || die + + MSF_DATABASE_CONFIG=config/database.yml BUNDLE_GEMFILE=Gemfile ${RUBY} -S bundle exec rake || die + su postgres -c "dropuser msf_test_user" || die "failed to cleanup msf_test-user" +} + +each_ruby_install() { + #Tests have already been run, we don't need this stuff + rm -r spec || die + rm -r test || die + rm Gemfile.lock || die + + #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. + # should be as simple as copying everything into the target... + dodir /usr/$(get_libdir)/${PN}${SLOT} + cp -R * "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed" + rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README.md + fowners -R root:0 / + +} + +all_ruby_install() { + # do not remove LICENSE, bug #238137 + dodir /usr/share/doc/${PF} + cp -R {documentation,README.md} "${ED}"/usr/share/doc/${PF} || die + dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation + + fperms +x /usr/$(get_libdir)/${PN}${SLOT}/msfupdate + + #tell revdep-rebuild to ignore binaries meant for the target + dodir /etc/revdep-rebuild + cat <<-EOF > "${ED}"/etc/revdep-rebuild/99-metasploit${SLOT} + #These dirs contain prebuilt binaries for running on the TARGET not the HOST + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/meterpreter" + SEARCH_DIRS_MASK="/usr/lib*/${PN}${SLOT}/data/exploits" + EOF +} + +pkg_postinst() { + elog "Before use you should run 'env-update' and '. /etc/profile'" + elog "otherwise you may be missing important environmental variables." + + elog "You need to prepare the database by running:" + elog "emerge --config postgresql" + elog "/etc/init.d/postgresql- start" + elog "emerge --config =metasploit-${PV}" + + "${EROOT}"/usr/bin/eselect metasploit set --use-old ${PN}${SLOT} + + einfo + elog "Adjust /usr/lib/${PN}${SLOT}/config/database.yml if necessary" +} + +pkg_config() { + einfo "If the following fails, it is likely because you forgot to start/config postgresql first" + su postgres -c "createuser msf_user -D -S -R" + su postgres -c "createdb --owner=msf_user msf_database" +} diff --git a/profiles/pentoo/base/package.accept_keywords/dev-ruby b/profiles/pentoo/base/package.accept_keywords/dev-ruby index 0fee32b6f..fea6e056b 100644 --- a/profiles/pentoo/base/package.accept_keywords/dev-ruby +++ b/profiles/pentoo/base/package.accept_keywords/dev-ruby @@ -54,6 +54,9 @@ dev-ruby/i18n:0.7 ~dev-ruby/http_configuration-1.0.4 #required by metasploit-9999 +dev-ruby/rbnacl:4 +dev-ruby/rbnacl-libsodium +dev-ruby/bcrypt_pbkdf =dev-ruby/faraday-0.12* dev-ruby/rjb ~dev-ruby/backports-3.8.0