2021-09-27 10:28:20 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, ruby
|
|
|
|
, bundlerEnv
|
2021-10-19 22:52:58 +02:00
|
|
|
, python3
|
2021-09-27 10:28:20 +02:00
|
|
|
}:
|
2017-05-14 22:52:58 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
env = bundlerEnv {
|
|
|
|
inherit ruby;
|
|
|
|
name = "metasploit-bundler-env";
|
|
|
|
gemdir = ./.;
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "metasploit-framework";
|
2021-12-11 12:50:36 +01:00
|
|
|
version = "6.1.19";
|
2015-06-15 14:11:05 +02:00
|
|
|
|
2017-05-14 22:52:58 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rapid7";
|
|
|
|
repo = "metasploit-framework";
|
|
|
|
rev = version;
|
2021-12-11 12:50:36 +01:00
|
|
|
sha256 = "sha256-AGSvUtkl2yiMpe5Clc0puG5MN1v5GlwH5XbJPvGPToA=";
|
2015-06-15 14:11:05 +02:00
|
|
|
};
|
|
|
|
|
2021-02-07 10:17:39 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2021-10-19 22:52:58 +02:00
|
|
|
buildInputs = [ (python3.withPackages (ps: [ ps.requests ])) ];
|
2017-05-14 22:52:58 +02:00
|
|
|
|
2019-07-23 12:32:11 +02:00
|
|
|
dontPatchELF = true; # stay away from exploit executables
|
2015-06-15 14:11:05 +02:00
|
|
|
|
|
|
|
installPhase = ''
|
2017-05-14 22:52:58 +02:00
|
|
|
mkdir -p $out/{bin,share/msf}
|
2015-06-15 14:11:05 +02:00
|
|
|
|
|
|
|
cp -r * $out/share/msf
|
|
|
|
|
2021-10-19 22:52:58 +02:00
|
|
|
grep -rl "^#\!.*python2$" $out/share/msf | xargs -d '\n' rm
|
|
|
|
|
2017-09-27 17:32:54 +02: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-09-30 21:09:38 +02: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"
|
2015-06-15 14:11:05 +02:00
|
|
|
'';
|
|
|
|
|
2020-10-25 21:35:33 +01:00
|
|
|
# run with: nix-shell maintainers/scripts/update.nix --argstr path metasploit
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2015-06-15 14:11:05 +02:00
|
|
|
description = "Metasploit Framework - a collection of exploits";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/rapid7/metasploit-framework/wiki";
|
2017-05-14 22:52:58 +02:00
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.bsd3;
|
2021-10-08 17:51:29 +02:00
|
|
|
maintainers = with maintainers; [ fab makefu ];
|
2021-05-23 23:39:20 +02:00
|
|
|
mainProgram = "msfconsole";
|
2015-06-15 14:11:05 +02:00
|
|
|
};
|
|
|
|
}
|