Closed ETeissonniere closed 8 years ago
Thanks for the suggestion. I will be looking into it when available. Might add that in the next version for metasploit if it indeed improves the process.
Hey @xorond here is the modified PKGBUILD, it might be uncomplete but it is a start :smirk:
# Maintainer: ArchStrike <team@archstrike.org>
buildarch=212
pkgname=metasploit
pkgver=4.12.6
pkgrel=1
epoch=1
groups=('archstrike' 'archstrike-exploit' 'archstrike-fuzzers' 'archstrike-scanners')
pkgdesc="An open source platform that supports vulnerability research, exploit development and the creation of custom security tools representing the largest collection of quality-assured exploits"
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
depends_x86_64+=('lib32-libxslt')
depends+=('ruby' 'ruby-bundler' 'git' 'libxslt' 'postgresql-libs' 'sqlite' 'libpcap' 'postgresql')
optdepends=('java-environment: msfgui'
'dradis: dradisis database system')
# Dependencies to build the gems (maybe uncomplete)
makedepends=('sqlite', 'ruby', 'ruby-bundler', 'lippcap', 'postgresql-libs')
url='http://www.metasploit.com'
license=('BSD')
options=('!emptydirs' '!strip')
source=("https://github.com/rapid7/metasploit-framework/archive/$pkgver.tar.gz")
replaces=('metasploit-git')
conflicts=('metasploit-git')
provides=('metasploit-git')
backup=('usr/share/metasploit/log/production.log')
install="$pkgname.install"
sha512sums=('7c387c426394d90d876116c9fef1d44122348abf1e51e2bfe04539da08c7e2983dcb21f55dae95ccda43bac73771e1b98bb5c6505ba623e9417b130d03c85129')
build () {
cd "$pkgname-framework-$pkgver"
# Build the gems
bundle install --deployment
chmod 0644 vendor/bundle/ruby/2.3.0/gems/*/*/*.rb
}
package() {
cd "$pkgname-framework-$pkgver"
# Base directories.
install -dm755 "${pkgdir}/usr/bin"
install -dm755 "${pkgdir}/etc"
install -dm755 "${pkgdir}/usr/share/metasploit"
install -dm755 "${pkgdir}/usr/share/doc/metasploit"
# Shareable.
cp --no-preserve=ownership -a documentation/* "${pkgdir}/usr/share/doc/metasploit"
cp --no-preserve=ownership README.md "${pkgdir}/usr/share/doc/metasploit"
# Source + Bin.
cp -a --no-preserve=ownership * "${pkgdir}/usr/share/metasploit"
install -m644 .rspec "${pkgdir}/usr/share/metasploit"
install -m644 .rubocop.yml "${pkgdir}/usr/share/metasploit"
install -m644 .ruby-gemset "${pkgdir}/usr/share/metasploit"
install -m644 .ruby-version "${pkgdir}/usr/share/metasploit"
install -m644 .simplecov "${pkgdir}/usr/share/metasploit"
install -m644 .travis.yml "${pkgdir}/usr/share/metasploit"
install -m644 .yardopts "${pkgdir}/usr/share/metasploit"
install -m644 .gitmodules "${pkgdir}/usr/share/metasploit"
install -m644 .mailmap "${pkgdir}"/usr/share/metasploit
# Commenting out the .git dir to shrink size. This will cause
# a warning when starting about not being a git dir.
#cp -a --no-preserve=ownership .git "${pkgdir}/usr/share/metasploit"
# Conform to the FHS.
mv "${pkgdir}/usr/share/metasploit/config" "${pkgdir}/etc/metasploit"
ln -s /etc/metasploit "${pkgdir}/usr/share/metasploit/config"
cd ${pkgdir}/usr/share/metasploit
rm msfupdate
install -Dm0666 /dev/null "${pkgdir}"/usr/share/metasploit/log/production.log
cat > "${pkgdir}/usr/bin/msfbinscan" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfbinscan "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfcli" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfcli "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfconsole" <<EOF
#!/bin/sh
if ! [[ -f /usr/share/metasploit/database.yml ]]; then
cd /usr/share/metasploit
ruby ./msfconsole -y msfconsole/database.yml "\$@"
else
cd /usr/share/metasploit
ruby ./msfconsole "\$@"
fi
EOF
cat > "${pkgdir}/usr/bin/msfd" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfd "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfelfscan" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfelfscan "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfencode" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfencode "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfmachscan" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfmachscan "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfpayload" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfpayload "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfpescan" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfpescan "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfrop" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfrop "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfrpc" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfrpc "\$@"
EOF
cat > "${pkgdir}/usr/bin/msfrpcd" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfrpcd "\$@"
EOF
# Commenting out since we are locking out msfupdate
# cat > "${pkgdir}/usr/bin/msfupdate" <<EOF
##!/bin/sh
#ruby /usr/share/metasploit/msfupdate "\$@"
#EOF
cat > "${pkgdir}/usr/bin/msfvenom" <<EOF
#!/bin/sh
cd /usr/share/metasploit
ruby ./msfvenom "\$@"
EOF
chmod +x "${pkgdir}"/usr/bin/*
}
Thanks, we will review it soon enough. We wouldn't want metasploit getting broken so it could take a while for us to test & apply this properly.
Okay @xorond thank. By the way if I can help, ask.
@DeveloppSoft I took a quick look at your PKGBUILD and it seems like it won't install the gems properly in /usr/share/metasploit as it's ran in the ${srcdir}/${pkgname}-framework-${pkgver} directory also it's missing the nokogiri gem. Also we don't need sqlite, libpcap (yours is misspelled, lippcap), and postgresql-libs on makedepends as they are already in the depends array. I am unable to test it right now but these are the issues I see for now. Maybe you can work on these and submit back.
Hi Oguz, I did it quickly without testing :smile:. Anyway I will work on it
@DeveloppSoft Thanks for looking at it we will watch this thread and see what we can do to make it better
Closing for now, please reopen if you have any more input
Sure, I need some time :smirk:
Hey guys, I made a pull -> #153
Hi archstrike, I think we can make minor changes to the mtasploit PKGBUILD. I suggest to build the gems into the build part (using bundle install -deploymen) then, in the install part we install metasploit with the gems. It might speed the install process and make it easier.