mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-06 08:25:01 +01:00
eselect-metasploit: add versatility to insanity
This commit is contained in:
parent
e7b31323f2
commit
6e928f32a7
3 changed files with 47 additions and 18 deletions
|
|
@ -1,18 +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}"
|
|
||||||
|
|
||||||
#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
|
|
||||||
47
app-eselect/eselect-metasploit/files/msfloader-0.18
Normal file
47
app-eselect/eselect-metasploit/files/msfloader-0.18
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/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}"
|
||||||
|
|
||||||
|
if [ -f "/usr/lib/metasploit/Gemfile.lock" ]; then
|
||||||
|
GEMFILE=/usr/lib/metasploit/Gemfile
|
||||||
|
else
|
||||||
|
GEMFILE="~/.msf4/Gemfile"
|
||||||
|
|
||||||
|
#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
|
||||||
|
fi
|
||||||
|
|
||||||
|
#ensure Gemfile.lock is up to date
|
||||||
|
if ! BUNDLE_GEMFILE="${GEMFILE}" ${ruby} -S bundle check > /dev/null 2>&1; then
|
||||||
|
if [ -f "~/.msf4/Gemfile.lock" ]; then
|
||||||
|
rm "~/.msf4/Gemfile.lock"
|
||||||
|
else
|
||||||
|
echo "Something went wrong, please open a bug for metasploit on https://github.com/pentoo/pentoo-overlay/issues"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#ready to go
|
||||||
|
BUNDLE_GEMFILE="${GEMFILE}" ${ruby} -S bundle exec /usr/lib/metasploit/$(basename $0) "$@"
|
||||||
|
#profit
|
||||||
Loading…
Reference in a new issue