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";
|
2022-12-28 21:21:41 +00:00
|
|
|
version = "6.2.32";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rapid7";
|
|
|
|
repo = "metasploit-framework";
|
|
|
|
rev = version;
|
2022-12-28 21:21:41 +00:00
|
|
|
sha256 = "sha256-uadIhrmrvdxzp4PchPHOy9beODME0hhgNqEqGqxyAZ8=";
|
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";
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://docs.metasploit.com/";
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|