summaryrefslogtreecommitdiff
path: root/app-eselect/eselect-metasploit
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-06-16 21:23:20 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-06-16 21:23:20 +0100
commitfab849d1daed0ba7f2ac497d07985c3dbb692543 (patch)
tree10baa743a5340b42ad538dd19d48669ccac209b1 /app-eselect/eselect-metasploit
parent73c318acdaf6f8309d68bd266051e6dd1f1bd787 (diff)
gentoo resync : 16.06.2019
Diffstat (limited to 'app-eselect/eselect-metasploit')
-rw-r--r--app-eselect/eselect-metasploit/Manifest2
-rw-r--r--app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild40
-rw-r--r--app-eselect/eselect-metasploit/files/metasploit.eselect-0.17197
3 files changed, 239 insertions, 0 deletions
diff --git a/app-eselect/eselect-metasploit/Manifest b/app-eselect/eselect-metasploit/Manifest
index 451ee4544a99..112cb3ea4d5e 100644
--- a/app-eselect/eselect-metasploit/Manifest
+++ b/app-eselect/eselect-metasploit/Manifest
@@ -1,7 +1,9 @@
AUX 91metasploit 301 BLAKE2B b5dc4ea9b50299ee88135f4aac951f4407da990faa6f1bff796fcd16d7a15a114dfbea1082f63e5b869d1f66eb869b55ce5c33ea1816282852b5da72870037a8 SHA512 60c1633dba13a5614649f51e9c4b79dde9944bac3c81dba26b5e97d3589985ba66d05c73093b68bef2af150932d534fc3d17c223de1c68a13b266ba219c55f9b
AUX metasploit.eselect-0.13 5200 BLAKE2B 1b58496e503e6a877e1314b6ed5092a43886bb015f74cbb6d980dd2b8140ecc7871ac33fbb150f55b62014cc9d1187e6c0fb1464b92817254ac1a123baad4d59 SHA512 73d94d02995f3328a61e566d9d6da58c062393a4b8ae48f57c4fa09fe2e3d06e4b9a5dd069c6504cb77a0dcd924e4a13c83857bb8a640d0d7568c99ae0e6655c
+AUX metasploit.eselect-0.17 5010 BLAKE2B bc78d7182d1413371b1975e27cf36e3be66b77085580f0ab34a49921b13236472fda97d4b0ba05fc1bcca1af63c523daca4ca6318f9b62af5439e7af54400e0c SHA512 71b4379e8ab80a163ff8c05757439ce7d3b9d4f4f09c7492d34dc6c059aaba5bf363cbc3143865194a79c95999eb1424c7bbe5b617cc8307a59edef9255c2be5
AUX msfloader-0.16 1157 BLAKE2B 0a9efd17e5a76a707b1b534aa52574e731f01d4de09f587bb19313833fe87a5973297be4cb97935a730b02df45c5d4c6f649a7935d365104e4caeb1238ac84ef SHA512 d228374e861e81e4f3371a6479c20b683a55e51e1d0249721ef5c465138e36c4dd205866d057c027c3ca6fcb1c79d3ff75790b73ed47d1e6af3b9d9186472386
AUX msfrpcd.confd 370 BLAKE2B b692c006e181927c4dba7f159f4fcf85e316004ad09a4ffc107189d186837924b3ad64ad614e9e45742dedcf53a046e36096e5fb6bc60b99ad2104a96c1a4371 SHA512 88a52427233bc82dc36d8f627edee84ba6675cddcc4539bb3a28cfe6fd7fba673875d62a150dfa5314756f11a6b1a95453966b31a2ae1f9820c6ef936d463f90
AUX msfrpcd.initd 470 BLAKE2B 760f4d87365c1cc4c23a305710eaa96447a8c3ac87a4c02133542b4a051f4b669f828f5cdeecbfac7e29f3a6f41febfe35296264804ffd4ce111a1d8bb63d2d5 SHA512 315eff30ff8826f87243d100f9a7fa28e7e4689bb4593bdc4fa0a4f8fa1216556e8921f39c912bb544c7304c84a6421e6289f8aca177ae401989f35e2b8fe441
EBUILD eselect-metasploit-0.16.ebuild 910 BLAKE2B b41839cff3fb9f5f1c296940c93da292092eecead5caf0683d4c163a7e771d3df6761e834a186099f87b7c19dd35637fe557d5f149f2d48931a5b7875f187127 SHA512 b1b63d1193fbfc64e592251559df1ecd238e36fd89b8bb2fa9e1081a183b32b738516e80da668014bd7e7b9f5a69411120c1a5e2f0a5c197b875ad02bc9f55c8
+EBUILD eselect-metasploit-0.17.ebuild 909 BLAKE2B 8fb92539d1ccb308987fc8cab8383f0582af10d1ccdd639f635d3c522700e21cfe9382e740f3009ff999fdfa2d3c17a931e79a5730a11ac9f0cd57723e84b2fd SHA512 e61383392bef398a80dc3c002a4dfd905606facbb7fa728ce8107e0b0fb33672114a8084692e7cf4272be0b3804d5639292b79d1b0aa2e9cc6ee21c7582da63c
MISC metadata.xml 241 BLAKE2B 31d2e88c810d3facda6587f93bdc429e66b6ed90dc2c019dac1ece6da620b74dc4db8907a25d6559ff7a027f6b267774016686a56c5a5e67da4fbfa3cae7be6e SHA512 d308ccef737c1776c2d77c0761996ef272a5866f5d9ceeda4dd4ceede851a145f76281a29b4c4b154e5b10f1d57c9344010bfcf75ba52fb3f1b34a58e3c2053f
diff --git a/app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild b/app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild
new file mode 100644
index 000000000000..1d5193b54601
--- /dev/null
+++ b/app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit multilib
+
+DESCRIPTION="eselect module for metasploit"
+HOMEPAGE="https://www.pentoo.ch/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND="app-admin/eselect
+ !<net-analyzer/metasploit-4.6"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}
+
+src_install() {
+ #force to use the outdated bundled version of metasm
+ doenvd "${FILESDIR}"/91metasploit
+
+ newinitd "${FILESDIR}"/msfrpcd.initd msfrpcd
+ newconfd "${FILESDIR}"/msfrpcd.confd msfrpcd
+
+ insinto /usr/share/eselect/modules
+ newins "${FILESDIR}/metasploit.eselect-0.17" metasploit.eselect
+
+ newbin "${FILESDIR}"/msfloader-0.16 msfloader
+}
+
+pkg_postinst() {
+ "${EROOT}"/usr/bin/eselect metasploit set --use-old 1
+ elog "To switch between installed slots, execute as root:"
+ elog " # eselect metasploit set [slot number]"
+}
diff --git a/app-eselect/eselect-metasploit/files/metasploit.eselect-0.17 b/app-eselect/eselect-metasploit/files/metasploit.eselect-0.17
new file mode 100644
index 000000000000..f27023354b54
--- /dev/null
+++ b/app-eselect/eselect-metasploit/files/metasploit.eselect-0.17
@@ -0,0 +1,197 @@
+# -*-eselect-*- vim: ft=eselect
+# Copyright 2005-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2 or later
+# $
+
+DESCRIPTION="Control which metaploit version is active"
+MAINTAINER="zerochaos@pentoo.ch"
+
+###WARNING: don't even think of using this insanity for a reference (but it works,mostly)
+#base idea from kernel.eselect with --use-old from opencl.eselect
+#all modified randomly until it worked, entropy is wonderful
+###/WARNING
+
+
+MSFPATH="/usr/lib/metasploit"
+
+# find a list of metasploit symlink targets and sort them
+find_targets() {
+ local f
+ for f in "${EROOT}${MSFPATH}"[[:digit:]]*; do
+ [[ -d ${f} ]] && basename "${f}"
+ done | LC_ALL=C sort
+}
+
+# remove the metasploit symlink
+remove_symlink() {
+ for i in $(qlist metasploit | grep $(canonicalise "${EROOT}${MSFPATH}")/msf)
+ do
+ if [ -L /usr/bin/$(echo ${i} | awk -F'/' '{print $5}') ]; then
+ unlink /usr/bin/$(echo ${i} | awk -F'/' '{print $5}') || die -q "failed to unlink ${i}"
+ fi
+ done
+ if [ -L ${EROOT}${MSFPATH} ]; then
+ unlink "${EROOT}${MSFPATH}" || die -q "failed to unlink ${EROOT}${MSFPATH}"
+ elif [ -e ${EROOT}${MSFPATH} ]; then
+ die -q "${EROOT}${MSFPATH} exists but is not a symlink"
+ fi
+}
+
+# set the metasploit symlink
+set_symlink() {
+ local target=$1
+
+ if is_number "${target}"; then
+ local targets=( $(find_targets) )
+ target=${targets[target-1]}
+ fi
+
+ if [[ -z ${target} ]]; then
+ die -q "Target \"$1\" doesn't appear to be valid!"
+ elif [[ -d ${EROOT}/usr/lib/${target} ]]; then
+ ln -s "${target}" "${EROOT}${MSFPATH}"
+ for i in $(qlist metasploit | grep /usr/lib/${target}/msf)
+ do
+ ln -s /usr/bin/msfloader /usr/bin/$(echo ${i} | awk -F'/' '{print $5}')
+ done
+ #this elif looks like it is trying to support setting by slot only,
+ #but that isn't supported by the rest of the script... fix or remove?
+ elif [[ -d ${EROOT}${MSFPATH}${target} ]]; then
+ ln -s "metasploit${target}" "${EROOT}${MSFPATH}"
+ for i in $(qlist metasploit | grep /usr/lib/${target}/msf)
+ do
+ ln -s /usr/bin/msfloader /usr/bin/$(echo ${i} | awk -F'/' '{print $5}')
+ done
+ else
+ die -q "Target \"$1\" doesn't appear to be valid!"
+ fi
+}
+
+# wrapper to safely set the symlink
+set_symlink_safe() {
+ if [[ -L ${EROOT}${MSFPATH} ]]; then
+ # existing symlink
+ remove_symlink || die -q "Couldn't remove existing symlink"
+ set_symlink "$1" || die -q "Couldn't set a new symlink"
+ #um, why is there an env-update here?
+ env-update
+ elif [[ -e ${EROOT}${MSFPATH} ]]; then
+ # we have something strange
+ die -q "${EROOT}${MSFPATH} exists but is not a symlink"
+ else
+ set_symlink "$1" || die -q "Couldn't set a new symlink"
+ fi
+}
+
+### show action ###
+
+describe_show() {
+ echo "Show the current metasploit symlink"
+}
+
+do_show() {
+ write_list_start "Current metasploit symlink:"
+ if [[ -L ${EROOT}${MSFPATH} ]]; then
+ local metasploit=$(canonicalise "${EROOT}${MSFPATH}")
+ write_kv_list_entry "${metasploit%/}" ""
+ else
+ write_kv_list_entry "(unset)" ""
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List available metasploit symlink targets"
+}
+
+do_list() {
+ local i targets=( $(find_targets) )
+
+ write_list_start "Available metasploit symlink targets:"
+ for (( i = 0; i < ${#targets[@]}; i++ )); do
+ [[ ${targets[i]} = \
+ $(basename "$(canonicalise "${EROOT}${MSFPATH}")") ]] \
+ && targets[i]=$(highlight_marker "${targets[i]}")
+ done
+ write_numbered_list -m "(none found)" "${targets[@]}"
+}
+
+### set action ###
+
+describe_set() {
+ echo "Set a new metasploit symlink target"
+}
+
+describe_set_parameters() {
+ echo "<target>"
+}
+
+describe_set_options() {
+ echo "<target> : Target name or number (from 'list' action)"
+ echo "--use-old : If an implementation is already set, use that one instead"
+}
+
+do_set() {
+ local action="error"
+ local current=$(basename "$(canonicalise "${EROOT}${MSFPATH}")")
+ local available=( $(find_targets) )
+ local new
+ local opt
+
+ while [[ ${#@} -gt 0 ]] ; do
+ opt=$1
+ shift
+ case ${opt} in
+ --use-old)
+ if [[ -n "${current}" ]] && has "${current}" "${available[@]}"; then
+ action="old-implementation"
+ fi
+ ;;
+ metasploit*)
+ if [[ "${action}" != "old-implementation" ]] ; then
+ action="set-implementation"
+ fi
+
+ if has ${opt} ${available[@]}; then
+ new="${opt}"
+ else
+ echo "You need to emerge ${opt} before you try to eselect it"
+ fi
+ ;;
+ *)
+ if [[ "${action}" != "old-implementation" ]] ; then
+ action="set-implementation"
+ fi
+
+ if is_number ${opt} ; then
+ #targets=( $(get_implementations) )
+ new=${available[opt - 1]}
+ if [[ -z ${new} ]] ; then
+ die -q "Unrecognized option: ${opt}"
+ fi
+ else
+ die -q "Unrecognized option: ${opt}"
+ fi
+ ;;
+ esac
+ done
+
+ case ${action} in
+ old-implementation)
+ set_symlink_safe ${current}
+ return $?
+ ;;
+ set-implementation)
+ if [[ -n ${new} ]] ; then
+ set_symlink_safe ${new}
+ return $?
+ else
+ die -q "Please specify an implementation to set"
+ fi
+ ;;
+ *)
+ die -q "Invalid usage of set action."
+ ;;
+ esac
+}