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 000000000..72c72599d --- /dev/null +++ b/app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2020 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=7 + +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="!" +} + +describe_set_options() { + echo " : 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.17 b/app-eselect/eselect-metasploit/files/msfloader-0.17 new file mode 100644 index 000000000..3eac8856e --- /dev/null +++ b/app-eselect/eselect-metasploit/files/msfloader-0.17 @@ -0,0 +1,18 @@ +#!/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}" + +#ensure Gemfile.lock is up to date +if ! BUNDLE_GEMFILE=/usr/lib/metasploit/Gemfile ${ruby} -S bundle check > /dev/null 2>&1; then + echo "Something went wrong, please open a bug for metasploit on https://github.com/pentoo/pentoo-overlay/issues" + exit 1 +fi + +#ready to go +BUNDLE_GEMFILE=/usr/lib/metasploit/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 000000000..d097e6cdf --- /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 000000000..9651d67f0 --- /dev/null +++ b/app-eselect/eselect-metasploit/files/msfrpcd.initd @@ -0,0 +1,22 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +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 000000000..4b6b68191 --- /dev/null +++ b/app-eselect/eselect-metasploit/metadata.xml @@ -0,0 +1,10 @@ + + + + +zerochaos@gentoo.org +Rick Farina + + + +