diff options
author | Richard Farina <zerochaos@gentoo.org> | 2013-12-15 15:23:49 +0000 |
---|---|---|
committer | Richard Farina <zerochaos@gentoo.org> | 2013-12-15 15:23:49 +0000 |
commit | b3ea7d178a339b4358234ac0049ae903d5dd25ef (patch) | |
tree | 68636f90489c9a488521f15589735f5bc022e686 /app-admin | |
parent | Add missing unittest2 dep (only in older version), bug #494012. (diff) | |
download | historical-b3ea7d178a339b4358234ac0049ae903d5dd25ef.tar.gz historical-b3ea7d178a339b4358234ac0049ae903d5dd25ef.tar.bz2 historical-b3ea7d178a339b4358234ac0049ae903d5dd25ef.zip |
initial commit of eselect-metasploit for slotted metasploit support, imported from the pentoo overlay
Package-Manager: portage-2.2.7/cvs/Linux x86_64
Manifest-Sign-Key: 0xDD11F94A
Diffstat (limited to 'app-admin')
-rw-r--r-- | app-admin/eselect-metasploit/ChangeLog | 12 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/Manifest | 27 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/eselect-metasploit-0.11.ebuild | 36 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/files/91metasploit | 5 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/files/metasploit.eselect-0.11 | 204 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/files/msfrpcd.confd | 16 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/files/msfrpcd.initd | 22 | ||||
-rw-r--r-- | app-admin/eselect-metasploit/metadata.xml | 10 |
8 files changed, 332 insertions, 0 deletions
diff --git a/app-admin/eselect-metasploit/ChangeLog b/app-admin/eselect-metasploit/ChangeLog new file mode 100644 index 000000000000..adc8e01f8b9b --- /dev/null +++ b/app-admin/eselect-metasploit/ChangeLog @@ -0,0 +1,12 @@ +# ChangeLog for app-admin/eselect-metasploit +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-metasploit/ChangeLog,v 1.1 2013/12/15 15:23:44 zerochaos Exp $ + +*eselect-metasploit-0.11 (15 Dec 2013) + + 15 Dec 2013; Rick Farina <zerochaos@gentoo.org> + +eselect-metasploit-0.11.ebuild, +files/91metasploit, + +files/metasploit.eselect-0.11, +files/msfrpcd.confd, +files/msfrpcd.initd, + +metadata.xml: + initial commit of eselect-metasploit for slotted metasploit support, imported + from the pentoo overlay diff --git a/app-admin/eselect-metasploit/Manifest b/app-admin/eselect-metasploit/Manifest new file mode 100644 index 000000000000..a8bcbc0da697 --- /dev/null +++ b/app-admin/eselect-metasploit/Manifest @@ -0,0 +1,27 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +AUX 91metasploit 203 SHA256 0b91f07ac952798368c8565c3dafd959683df8f5c7dfc6b01cf6ff0ed208c00d SHA512 84c85a5f5885ebfd54eeeba10688eb19cc2f1799424b14fc24e579fdf812713fb70220bd097a3c42e1bd29bf7fa421b688facc8ca5ed07bcd1d7480c080f7da8 WHIRLPOOL e6404e978c5d5d74c182740ce0e14dc45c979affb4119dcc2dfba8f72fd9ea0e12ff50b37b009313794d426df2d04b1dc4f02e3ea913f01474c93880fbb1f0ef +AUX metasploit.eselect-0.11 4974 SHA256 90c700993f8db51f45b1bc8aa89442de9ddb023ca509ae970bac998152acb64c SHA512 7e748fbdfe2cdb3e55324d9455901c40d76e075a2732691dd6d02ef9fc4a9d22f04799b0f74d17632175b5024ced53a70d29fe90ce8f8a23c1e169491236916a WHIRLPOOL a0185942ec5c9854e5ccf55f8b8ce3759b15c430ec787a57b773cbc5c1b04ca6d6f3da4d40a6c23386534dc77ee641dabee97814f561fab9774eb09c80195fd5 +AUX msfrpcd.confd 370 SHA256 8b437413fb2e1d26161ce4232cb7d44cfd41d0923d18a82ac984a89a89c887f2 SHA512 88a52427233bc82dc36d8f627edee84ba6675cddcc4539bb3a28cfe6fd7fba673875d62a150dfa5314756f11a6b1a95453966b31a2ae1f9820c6ef936d463f90 WHIRLPOOL 2b704c60d06fc03ed1d65eecffd38e402342a3b4c5bb6d6817e0ed7c745944dfa38358bca5dfe5ae24cc0e0f9375cefd6b046f3630ec3c9650569b86679e52d8 +AUX msfrpcd.initd 595 SHA256 8ed133c85877a8509c85703b738e0286d56c57620b251f98eaffa33e31ad64dd SHA512 62f5c7ae84078e76cbdaa4dccb3fa67871491c53ce7faa07fb75c05c91b25d6812adac90ad6868759b79d9382548bff4383760d604789a12c6537cadb5977873 WHIRLPOOL 1b27b7600ae097e0d4e9717d709d87bab103bcaa76ff852e2179a0d33888bfab04751ac865a9e54f6bb2e292d670098a1005a44e61001bbd0d6b674da6a1e36d +EBUILD eselect-metasploit-0.11.ebuild 928 SHA256 fc50fac149ce050b5406cd3e18ff7c9be64ad2a4e48c2f438ab2d4286991bfa9 SHA512 08f8910ff872dc135b2ce7bff4350552540b26994485cb0a8558a4b17c304eb4e82a33fdb64c5d9cb9d15ffd2e2d5b2a3a43a30b596acf8b1dd3dfd4fd1fb9da WHIRLPOOL b7bf70d1cbe290e6013e9cfea51feb8c76d12c7c610f20a19da7e0c2790cb43e35f49ed187b5245fd39a6ae5b540abaf07e48ef66b85136c42853e53d5919508 +MISC ChangeLog 579 SHA256 a8873ca4647f556112fd85109d01b864f8df1828e85e780ae1f6f6ae6200c940 SHA512 8fc475a568a03ab3fee2875cc16e82efa0a40dd6010b947e06a7424cccdde776267210dbbead3eaaa570d2bae2ff59a8a745f2019342560fe44f3c246243ee76 WHIRLPOOL f7fd615d4cd3c6b7020aedb2a37b23eb15ab446c8f6136ce169cf2b483c60f974c3631444dbcd76665f7ca6470013d0d3363cad640fe7f0b359b660e6af98a85 +MISC metadata.xml 274 SHA256 fcdb6e69f3adb718ed543a83635badf4e360a57c550760997c4c5f8ea5c7193a SHA512 8b3d3358fe15d41a5bae960eb75727923c05bab81f63ab6cbab1134e9f49fe69c7e710edf051765950c57a2ef0025207d5f7c129b2bdccfca5be3ec042cf458e WHIRLPOOL 152e28545dc06eb18012d2545644b8bd223c546d10524a7c879573fb1ad265d75ff1ae8e3a95ee6777dbff155ff4ab6795841a884d3dd722579fa8ed5fa6bb49 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (GNU/Linux) + +iQIcBAEBCgAGBQJSrcn1AAoJEKXdFCfdEflKwQQP/3Tdj9HLxlHEIayGKAGR5c+Y +a71ZUKylRfbcJoQJWwhfR52Xkj0P8UgYKC9XwazsdoF2KQc26AjHe70yl3JDwfVM +tU1uK+38bdBRsaVfxixve0PpBYMGOqnQLVoJtU9ufWYkruNM/84krg9Hd/yfcoM1 +z+cpUGpBzn8Vrc1o8kqro6Cwjr6QViKD1jdFsyAruWFJZkllu8GwUmyoPdV9FcL3 +joaw4QQDKVm7szOABby1g+C/pLoTsJxWcR2iqGHGnpZy+4kZ3OUg0Q3RNXZXZXtH +ETaMu389ODK37LJfNYrzlBwfg0ZUOmO/8KtM0dZY1gHznuNyCB/IVPyWAzGNjxli +AnFSQVDDDDJ3OPbxIwDMMXsleYp3Ru11TIS5cnEq7HNfkxBWZCbnOEbbjjj5bwY9 +DTvlMnGBrN72o9fCbD/ubvkb9YW4uY6EZYNfDvl4JyT0VqvO02usgSFZqcZqAuHo +I5bSz4yAnbT++3mR8ZoVwmtZ9JclWNhm1bp5Q9mUntlmA9X/uWBihbJLqsZu0ZhW +NHvmh1PxrpdxHR6/pm8JaKp4rtqGFLt/88kSAKoif09pxwbIFHfcSxlNCkgUiAKj +1O9fDTQPPgBNHGGdmgsI8iGiqL9F3hK9yUqP/yGecN3ssimmsaRquBHXa6vbdMOe +3VxVMRibgF3k8yTZpNJS +=R4UB +-----END PGP SIGNATURE----- diff --git a/app-admin/eselect-metasploit/eselect-metasploit-0.11.ebuild b/app-admin/eselect-metasploit/eselect-metasploit-0.11.ebuild new file mode 100644 index 000000000000..743d06b6da1f --- /dev/null +++ b/app-admin/eselect-metasploit/eselect-metasploit-0.11.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-metasploit/eselect-metasploit-0.11.ebuild,v 1.1 2013/12/15 15:23:44 zerochaos Exp $ + +EAPI=5 + +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-${PV}" metasploit.eselect +} + +pkg_postinst() { + elog "To switch between installed slots, execute as root:" + elog " # eselect metasploit set [slot number]" +} diff --git a/app-admin/eselect-metasploit/files/91metasploit b/app-admin/eselect-metasploit/files/91metasploit new file mode 100644 index 000000000000..01934bc5ea5b --- /dev/null +++ b/app-admin/eselect-metasploit/files/91metasploit @@ -0,0 +1,5 @@ +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" diff --git a/app-admin/eselect-metasploit/files/metasploit.eselect-0.11 b/app-admin/eselect-metasploit/files/metasploit.eselect-0.11 new file mode 100644 index 000000000000..2d76d6c5d69b --- /dev/null +++ b/app-admin/eselect-metasploit/files/metasploit.eselect-0.11 @@ -0,0 +1,204 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2005-2013 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" +#SVN_DATE='$Date: 2013/12/15 15:23:44 $' +#VERSION=$(svn_date_to_version "${SVN_DATE}") + +###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 + unlink /usr/bin/$(echo ${i} | awk -F'/' '{print $5}') + 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 ${i} /usr/bin/$(echo ${i} | awk -F'/' '{print $5}') + done + 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 ${i} /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" + 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-admin/eselect-metasploit/files/msfrpcd.confd b/app-admin/eselect-metasploit/files/msfrpcd.confd new file mode 100644 index 000000000000..d097e6cdfb71 --- /dev/null +++ b/app-admin/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-admin/eselect-metasploit/files/msfrpcd.initd b/app-admin/eselect-metasploit/files/msfrpcd.initd new file mode 100644 index 000000000000..7c5cfef42c2d --- /dev/null +++ b/app-admin/eselect-metasploit/files/msfrpcd.initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-metasploit/files/msfrpcd.initd,v 1.1 2013/12/15 15:23:44 zerochaos Exp $ + +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-admin/eselect-metasploit/metadata.xml b/app-admin/eselect-metasploit/metadata.xml new file mode 100644 index 000000000000..4b6b68191d89 --- /dev/null +++ b/app-admin/eselect-metasploit/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer> +<email>zerochaos@gentoo.org</email> +<name>Rick Farina</name> +</maintainer> +<longdescription lang="en"> +</longdescription> +</pkgmetadata> |