diff options
author | makefu <github@syntax-fehler.de> | 2020-10-25 21:35:33 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2020-10-25 21:35:33 +0100 |
commit | f3fa188c02e4d1f8df77a07b762c270a32baa135 (patch) | |
tree | 48bb395f87e9905f9834e20738cd443d1f486636 /pkgs/tools/security/metasploit | |
parent | 5c79b3dda06744a55869cae2cba6873fbbd64394 (diff) |
metasploit: add passthru.updateScript
Diffstat (limited to 'pkgs/tools/security/metasploit')
-rw-r--r-- | pkgs/tools/security/metasploit/default.nix | 12 | ||||
-rwxr-xr-x | pkgs/tools/security/metasploit/update.sh | 17 |
2 files changed, 20 insertions, 9 deletions
diff --git a/pkgs/tools/security/metasploit/default.nix b/pkgs/tools/security/metasploit/default.nix index a51ccde13703f..a2a0a28bbff6c 100644 --- a/pkgs/tools/security/metasploit/default.nix +++ b/pkgs/tools/security/metasploit/default.nix @@ -1,14 +1,5 @@ { stdenv, fetchFromGitHub, makeWrapper, ruby, bundlerEnv }: -# Maintainer notes for updating: -# 1. increment version number in expression and in Gemfile -# 2. run $ nix-shell --command "bundler install && bundix" -# in metasploit in nixpkgs -# 3. run $ sed -i '/[ ]*dependencies =/d' gemset.nix -# 4. run $ nix-build -A metasploit ../../../../ -# 5. update sha256sum in expression -# 6. run step 3 again - let env = bundlerEnv { inherit ruby; @@ -45,6 +36,9 @@ in stdenv.mkDerivation rec { ''; + # run with: nix-shell maintainers/scripts/update.nix --argstr path metasploit + passthru.updateScript = ./update.sh; + meta = with stdenv.lib; { description = "Metasploit Framework - a collection of exploits"; homepage = "https://github.com/rapid7/metasploit-framework/wiki"; diff --git a/pkgs/tools/security/metasploit/update.sh b/pkgs/tools/security/metasploit/update.sh new file mode 100755 index 0000000000000..e4da457c6f574 --- /dev/null +++ b/pkgs/tools/security/metasploit/update.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl bundix git libiconv libpcap libxml2 libxslt pkg-config postgresql ruby.devEnv sqlite xmlstarlet nix-update + +set -eu -o pipefail +cd "$(dirname "$(readlink -f "$0")")" + +latest=$(curl https://github.com/rapid7/metasploit-framework/releases.atom | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v atom:title -n | head -n1) +echo "Updating metasploit to $latest" + +sed -i "s#refs/tags/.*#refs/tags/$latest\"#" Gemfile + +bundler install +bundix +sed -i '/[ ]*dependencies =/d' gemset.nix + +cd "../../../../" +nix-update metasploit --version "$latest" |