public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-metasploit/, app-eselect/eselect-metasploit/files/
@ 2020-07-02 10:24 Mikle Kolyada
  0 siblings, 0 replies; 2+ messages in thread
From: Mikle Kolyada @ 2020-07-02 10:24 UTC (permalink / raw
  To: gentoo-commits

commit:     f13acbb05d582cb0caa21e984f78821a01f81cda
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  2 10:23:44 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Thu Jul  2 10:24:11 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f13acbb0

app-eselect/eselect-metasploit: remove last-rited pkg

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 .../eselect-metasploit-0.16.ebuild                 |  40 ----
 .../eselect-metasploit-0.17.ebuild                 |  40 ----
 app-eselect/eselect-metasploit/files/91metasploit  |   8 -
 .../files/metasploit.eselect-0.13                  | 207 ---------------------
 .../files/metasploit.eselect-0.17                  | 197 --------------------
 .../eselect-metasploit/files/msfloader-0.16        |  41 ----
 app-eselect/eselect-metasploit/files/msfrpcd.confd |  16 --
 app-eselect/eselect-metasploit/files/msfrpcd.initd |  21 ---
 app-eselect/eselect-metasploit/metadata.xml        |   8 -
 9 files changed, 578 deletions(-)

diff --git a/app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild b/app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild
deleted file mode 100644
index 3af96b65608..00000000000
--- a/app-eselect/eselect-metasploit/eselect-metasploit-0.16.ebuild
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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.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/eselect-metasploit-0.17.ebuild b/app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild
deleted file mode 100644
index 1d5193b5460..00000000000
--- a/app-eselect/eselect-metasploit/eselect-metasploit-0.17.ebuild
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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/91metasploit b/app-eselect/eselect-metasploit/files/91metasploit
deleted file mode 100644
index ce58b5043dd..00000000000
--- a/app-eselect/eselect-metasploit/files/91metasploit
+++ /dev/null
@@ -1,8 +0,0 @@
-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
deleted file mode 100644
index be4f780e935..00000000000
--- a/app-eselect/eselect-metasploit/files/metasploit.eselect-0.13
+++ /dev/null
@@ -1,207 +0,0 @@
-# -*-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/metasploit.eselect-0.17 b/app-eselect/eselect-metasploit/files/metasploit.eselect-0.17
deleted file mode 100644
index f27023354b5..00000000000
--- a/app-eselect/eselect-metasploit/files/metasploit.eselect-0.17
+++ /dev/null
@@ -1,197 +0,0 @@
-# -*-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
-}

diff --git a/app-eselect/eselect-metasploit/files/msfloader-0.16 b/app-eselect/eselect-metasploit/files/msfloader-0.16
deleted file mode 100644
index 6c617165c58..00000000000
--- a/app-eselect/eselect-metasploit/files/msfloader-0.16
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/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 gemspecs from 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
deleted file mode 100644
index d097e6cdfb7..00000000000
--- a/app-eselect/eselect-metasploit/files/msfrpcd.confd
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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
deleted file mode 100644
index 8963eef82bf..00000000000
--- a/app-eselect/eselect-metasploit/files/msfrpcd.initd
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/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
deleted file mode 100644
index 0bd171786a1..00000000000
--- a/app-eselect/eselect-metasploit/metadata.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?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>


^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-metasploit/, app-eselect/eselect-metasploit/files/
@ 2019-06-12 20:10 Rick Farina
  0 siblings, 0 replies; 2+ messages in thread
From: Rick Farina @ 2019-06-12 20:10 UTC (permalink / raw
  To: gentoo-commits

commit:     3002c3d0893c0c0f333d60eeb6d4a41e5fcb127a
Author:     Rick Farina <zerochaos <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 20:10:40 2019 +0000
Commit:     Rick Farina <zerochaos <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 20:10:52 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3002c3d0

app-eselect/eselect-metasploit: fix lib dir

get_libdir and other hacks were being used despite the ebuild installing
to /usr/lib and not /usr/$(get_libdir) now.  This was hidden by profile
17.0 but found by a user on 17.1

Package-Manager: Portage-2.3.67, Repoman-2.3.14
Signed-off-by: Rick Farina <zerochaos <AT> gentoo.org>

 .../eselect-metasploit-0.17.ebuild                 |  40 +++++
 .../files/metasploit.eselect-0.17                  | 197 +++++++++++++++++++++
 2 files changed, 237 insertions(+)

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 00000000000..1d5193b5460
--- /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 00000000000..f27023354b5
--- /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
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-02 10:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-02 10:24 [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-metasploit/, app-eselect/eselect-metasploit/files/ Mikle Kolyada
  -- strict thread matches above, loose matches on Subject: below --
2019-06-12 20:10 Rick Farina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox