summaryrefslogtreecommitdiff
path: root/app-eselect/eselect-metasploit
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /app-eselect/eselect-metasploit
reinit the tree, so we can have metadata
Diffstat (limited to 'app-eselect/eselect-metasploit')
-rw-r--r--app-eselect/eselect-metasploit/Manifest9
-rw-r--r--app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild40
-rw-r--r--app-eselect/eselect-metasploit/files/91metasploit8
-rw-r--r--app-eselect/eselect-metasploit/files/metasploit.eselect-0.13207
-rw-r--r--app-eselect/eselect-metasploit/files/msfloader-0.1641
-rw-r--r--app-eselect/eselect-metasploit/files/msfrpcd.confd16
-rw-r--r--app-eselect/eselect-metasploit/files/msfrpcd.initd21
-rw-r--r--app-eselect/eselect-metasploit/metadata.xml8
8 files changed, 350 insertions, 0 deletions
diff --git a/app-eselect/eselect-metasploit/Manifest b/app-eselect/eselect-metasploit/Manifest
new file mode 100644
index 000000000000..2a0374f9fa9e
--- /dev/null
+++ b/app-eselect/eselect-metasploit/Manifest
@@ -0,0 +1,9 @@
+AUX 91metasploit 301 SHA256 40def76822cd8e068b53b64af00eb46cf0246afda58356c94ef7c30bb742344c SHA512 60c1633dba13a5614649f51e9c4b79dde9944bac3c81dba26b5e97d3589985ba66d05c73093b68bef2af150932d534fc3d17c223de1c68a13b266ba219c55f9b WHIRLPOOL cd8122211b5069c9bc91403b35bd05318ea49955c4d19c9774a6fceadb005e13a670a7a8c10346b12bd5de01c675d0baf89ff6e6fce599bde043f69e11d02ef3
+AUX metasploit.eselect-0.13 5200 SHA256 51d19a3af7bf03198a558a1fbce32bde3e852883f917c6047faf45030e847589 SHA512 73d94d02995f3328a61e566d9d6da58c062393a4b8ae48f57c4fa09fe2e3d06e4b9a5dd069c6504cb77a0dcd924e4a13c83857bb8a640d0d7568c99ae0e6655c WHIRLPOOL eb7c2f51f18bfa5168ed5b67e0eab1069b8706f06d096cc5f9c40c6add7f5d249003e370ade1238108732ecf02f2ff0d567451a8009fdbc0136fafbe426ae1c5
+AUX msfloader-0.16 1156 SHA256 e7cef38a60d3a2abaa0dac02e4d19be5cf9ae5c63dbe46b7d9c06e360311165f SHA512 8b16f37892fa59df912c6a67413b505f1e192c88d57635ba0f91d768c4a55ab856471ce78f4f21c990d0b250736bdae8129a70b7459e9a82ce291fe631e1361d WHIRLPOOL e968c3cafc3e037eb5ab849dd4db516bdae60c7c431a7455dcf81bdf27604dcdec37b809e5035ae7f6498de354c75e748b6a48d711db523d1adc868041ed3534
+AUX msfrpcd.confd 370 SHA256 8b437413fb2e1d26161ce4232cb7d44cfd41d0923d18a82ac984a89a89c887f2 SHA512 88a52427233bc82dc36d8f627edee84ba6675cddcc4539bb3a28cfe6fd7fba673875d62a150dfa5314756f11a6b1a95453966b31a2ae1f9820c6ef936d463f90 WHIRLPOOL 2b704c60d06fc03ed1d65eecffd38e402342a3b4c5bb6d6817e0ed7c745944dfa38358bca5dfe5ae24cc0e0f9375cefd6b046f3630ec3c9650569b86679e52d8
+AUX msfrpcd.initd 470 SHA256 e7ab81b7fdadc8309341b71d496fe221e36ddbee0692280b98bd01dede0e1d9c SHA512 315eff30ff8826f87243d100f9a7fa28e7e4689bb4593bdc4fa0a4f8fa1216556e8921f39c912bb544c7304c84a6421e6289f8aca177ae401989f35e2b8fe441 WHIRLPOOL 230ba3a44e3b784c6c0b432c68581014b1670a3afda15a0ffe193bee5c7c9e3989b464ccc06523a91829b0adc69803c5b07461ffd3c80e231e006f2f17022b6e
+EBUILD eselect-metasploit-0.16.ebuild 912 SHA256 2e039b464ed3d1e693f5cf1e74ca9ebd35a809b555b281e67241293dc035d728 SHA512 970d64ffbe097e3cf18f08df0fe63826d21b24c0929635ec236fcb5cbed760e965ff7e20573297bb84583e51388a7ac08eaf4fac2d4fa46f098bcbddc71de0c6 WHIRLPOOL 32b86d6c8d090fb820cc303110e8e45b2919865c0c334765766aeb457312ff7528c0811f9372158ab8f53c11dbfabb60d9d381ac506b1cc1debbdc9d5ac6b055
+MISC ChangeLog 2587 SHA256 2dd64db9a7b027440e51f0d92e030e65c509cb9cbfca148244cb84ab1942636c SHA512 9c0bd91b4114e21f239837b4576366bd8ccf6d2753b08fc71c809dbadf31c81af1f8da3bc01671a298d42f163aefeedb222ee44ec871d136648e90b4da7eb5e2 WHIRLPOOL aece0af921fe15416a74bbeb54b0e8e4891141357b330d3ae2b3452a95a11bc326496c5cf9cca29ef4258eeead57b5edb785f3cb7323f36a94fddf9118a70dc9
+MISC ChangeLog-2015 2664 SHA256 57472808054602a08a8ff229584766fbdaeb1acda38ec0e692caeca550650634 SHA512 8b5bac79eb1100786dde6b8f11616a56850516ac3c54baa91cd118bbe1cfa397fa332347f454c22fba5b2d9e156d440a6247b4ec8a53b6791864602fd12c742e WHIRLPOOL d7e84674c0034938e8eb5946493ca4b0bf9abd7381133599f1b30245e28240998106afc87f34390f7d193a27786b5ea95aa1511aa4c55ffbb5a178bdf7bc52fc
+MISC metadata.xml 241 SHA256 50b9f6c8946f5d421e8feb8ffbf48238d8b8b018e315f322548b47a89d80b32c SHA512 d308ccef737c1776c2d77c0761996ef272a5866f5d9ceeda4dd4ceede851a145f76281a29b4c4b154e5b10f1d57c9344010bfcf75ba52fb3f1b34a58e3c2053f WHIRLPOOL 5436d62e0cda11ff7a49a8bc1b2c7400a58ad347709d48be3f462530bac689e9e9e6340580b5ccec717498a010c4d2f16ecd5f35ab04356858e7c540ac3b1da3
diff --git a/app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild b/app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild
new file mode 100644
index 000000000000..4746a34aa7d3
--- /dev/null
+++ b/app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit multilib
+
+DESCRIPTION="eselect module for metasploit"
+HOMEPAGE="http://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.13" metasploit.eselect
+
+ newbin "${FILESDIR}"/msfloader-${PV} 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/91metasploit b/app-eselect/eselect-metasploit/files/91metasploit
new file mode 100644
index 000000000000..ce58b5043ddd
--- /dev/null
+++ b/app-eselect/eselect-metasploit/files/91metasploit
@@ -0,0 +1,8 @@
+MSF_DATABASE_CONFIG=/usr/lib/metasploit/config/database.yml
+
+# needed because MSF ships an old version of metasm
+# which isn't compatible with the new one
+MSF_LOCAL_LIB="/usr/lib/metasploit/lib/metasm"
+
+# needed because MSF doesn't know where it is since the alzheimer's
+MSF_ROOT=/usr/lib/metasploit
diff --git a/app-eselect/eselect-metasploit/files/metasploit.eselect-0.13 b/app-eselect/eselect-metasploit/files/metasploit.eselect-0.13
new file mode 100644
index 000000000000..be4f780e935d
--- /dev/null
+++ b/app-eselect/eselect-metasploit/files/metasploit.eselect-0.13
@@ -0,0 +1,207 @@
+# -*-eselect-*- vim: ft=eselect
+# Copyright 2005-2015 Gentoo Foundation
+# 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, get_libdir from php.eselect with --use-old from opencl.eselect
+#all modified randomly until it worked, entropy is wonderful
+###/WARNING
+
+inherit multilib
+
+get_libdir() {
+ local dir
+ if has lib64 $(list_libdirs); then
+ echo lib64
+ return
+ fi
+ echo lib
+}
+
+MSFPATH="/usr/$(get_libdir)/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/$(get_libdir)/${target} ]]; then
+ ln -s "${target}" "${EROOT}${MSFPATH}"
+ for i in $(qlist metasploit | grep /usr/$(get_libdir)/${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/$(get_libdir)/${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
+}
diff --git a/app-eselect/eselect-metasploit/files/msfloader-0.16 b/app-eselect/eselect-metasploit/files/msfloader-0.16
new file mode 100644
index 000000000000..231275a9b1f6
--- /dev/null
+++ b/app-eselect/eselect-metasploit/files/msfloader-0.16
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#todo:
+#add in optional auto starting/stopping of postgres
+
+#read the desired version of ruby from the eselected version of msf
+header="$(head -n1 /usr/lib/metasploit/msfconsole)"
+ruby="${header:2}"
+
+#normally msf makes this dir, however, this script runs first
+if [ ! -d ~/.msf4 ]; then
+ mkdir ~/.msf4
+fi
+
+#we cannot control if msf* exits normally so always start with cleanup
+if [ -f ~/.msf4/Gemfile ]; then
+ rm ~/.msf4/Gemfile
+fi
+if ls -A ~/.msf4/*.gemspec > /dev/zero 2>&1; then
+ rm ~/.msf4/*.gemspec
+fi
+
+#fetch the latest Gemfile and gemspecsfrom the selected version of msf
+cp /usr/lib/metasploit/Gemfile ~/.msf4/
+if ls -A /usr/lib/metasploit/*.gemspec > /dev/zero 2>&1; then
+ cp /usr/lib/metasploit/*.gemspec ~/.msf4/
+fi
+
+#ensure Gemfile.lock is up to date
+BUNDLE_GEMFILE=~/.msf4/Gemfile ${ruby} -S bundle check > /dev/null 2>&1
+if [ "$?" != "0" ]; then
+ if [ -f ~/.msf4/Gemfile.lock ]; then
+ rm ~/.msf4/Gemfile.lock
+ else
+ echo "Something went wrong, please open a bug for metasploit on https://bugs.gentoo.org"
+ fi
+fi
+
+#ready to go
+BUNDLE_GEMFILE=~/.msf4/Gemfile ${ruby} -S bundle exec /usr/lib/metasploit/$(basename $0) "$@"
+#profit
diff --git a/app-eselect/eselect-metasploit/files/msfrpcd.confd b/app-eselect/eselect-metasploit/files/msfrpcd.confd
new file mode 100644
index 000000000000..d097e6cdfb71
--- /dev/null
+++ b/app-eselect/eselect-metasploit/files/msfrpcd.confd
@@ -0,0 +1,16 @@
+# Config file for /etc/init.d/metasploit
+
+# Bind to the following IP instead of the loopback address
+IPADDR=127.0.0.1
+
+# Bind to the following TCP port instead of default 55555
+PORT=55553
+
+# Use the following username instead of msf
+USER="msf"
+
+# Use the following password instead of msf
+PASS="secure"
+
+# All options
+MSF_OPTS="-U $USER -P $PASS -S -a $IPADDR -p $PORT"
diff --git a/app-eselect/eselect-metasploit/files/msfrpcd.initd b/app-eselect/eselect-metasploit/files/msfrpcd.initd
new file mode 100644
index 000000000000..8963eef82bf4
--- /dev/null
+++ b/app-eselect/eselect-metasploit/files/msfrpcd.initd
@@ -0,0 +1,21 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+VERSION=
+PIDFILE=/var/run/msfrpcd${VERSION}.pid
+
+start() {
+ ebegin "Starting msfrpcd"
+ start-stop-daemon --start --quiet --background \
+ --exec /usr/bin/msfrpcd \
+ --pidfile ${PIDFILE} \
+ --make-pidfile -- -f ${MSF_OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping msfrpcd"
+ start-stop-daemon --stop --quiet -s 9 --pidfile ${PIDFILE}
+ eend $?
+}
diff --git a/app-eselect/eselect-metasploit/metadata.xml b/app-eselect/eselect-metasploit/metadata.xml
new file mode 100644
index 000000000000..0bd171786a1f
--- /dev/null
+++ b/app-eselect/eselect-metasploit/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="person">
+<email>zerochaos@gentoo.org</email>
+<name>Rick Farina</name>
+</maintainer>
+</pkgmetadata>