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