2021-10-01 09:20:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, ruby
|
|
|
|
, bundlerEnv
|
2021-12-06 16:07:01 +00:00
|
|
|
, python3
|
2021-10-01 09:20:50 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
env = bundlerEnv {
|
|
|
|
inherit ruby;
|
|
|
|
name = "metasploit-bundler-env";
|
|
|
|
gemdir = ./.;
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "metasploit-framework";
|
2021-12-25 05:07:40 +00:00
|
|
|
version = "6.1.21";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rapid7";
|
|
|
|
repo = "metasploit-framework";
|
|
|
|
rev = version;
|
2021-12-25 05:07:40 +00:00
|
|
|
sha256 = "sha256-43abc6XUmLZZ+KuaAqyT/fJT+79JWKeRRA41NJOWoPY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [ (python3.withPackages (ps: [ ps.requests ])) ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
dontPatchELF = true; # stay away from exploit executables
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{bin,share/msf}
|
|
|
|
|
|
|
|
cp -r * $out/share/msf
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
grep -rl "^#\!.*python2$" $out/share/msf | xargs -d '\n' rm
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
(
|
|
|
|
cd $out/share/msf/
|
|
|
|
for i in msf*; do
|
|
|
|
makeWrapper ${env}/bin/bundle $out/bin/$i \
|
|
|
|
--add-flags "exec ${ruby}/bin/ruby $out/share/msf/$i"
|
|
|
|
done
|
|
|
|
)
|
|
|
|
|
2021-10-04 12:37:57 +00:00
|
|
|
makeWrapper ${env}/bin/bundle $out/bin/msf-pattern_create \
|
|
|
|
--add-flags "exec ${ruby}/bin/ruby $out/share/msf/tools/exploit/pattern_create.rb"
|
|
|
|
|
|
|
|
makeWrapper ${env}/bin/bundle $out/bin/msf-pattern_offset \
|
|
|
|
--add-flags "exec ${ruby}/bin/ruby $out/share/msf/tools/exploit/pattern_offset.rb"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
# run with: nix-shell maintainers/scripts/update.nix --argstr path metasploit
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Metasploit Framework - a collection of exploits";
|
|
|
|
homepage = "https://github.com/rapid7/metasploit-framework/wiki";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.bsd3;
|
2021-10-11 16:52:03 +00:00
|
|
|
maintainers = with maintainers; [ fab makefu ];
|
2021-05-28 09:39:13 +00:00
|
|
|
mainProgram = "msfconsole";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|