2018-08-16 17:31:40 +00:00
|
|
|
{ stdenv, bundlerEnv, ruby, fetchFromGitHub, nodejs }:
|
2017-09-21 00:09:17 +00:00
|
|
|
# nix-shell --command "bundler install && bundix" in the clone, copy gemset.nix, Gemfile and Gemfile.lock
|
|
|
|
let
|
|
|
|
gems = bundlerEnv {
|
|
|
|
name = "beef-env";
|
|
|
|
inherit ruby;
|
|
|
|
gemdir = ./.;
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
2018-08-16 17:31:40 +00:00
|
|
|
name = "beef-2018-09-21";
|
2017-09-21 00:09:17 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "beefproject";
|
|
|
|
repo = "beef";
|
2018-08-16 17:31:40 +00:00
|
|
|
rev = "d237c95";
|
|
|
|
sha256 = "1mykbjwjcbd2a18wycaf35hi3b9rmvqz1jnk2v55sd4c39f0jpf2";
|
2017-09-21 00:09:17 +00:00
|
|
|
};
|
2018-08-16 17:31:40 +00:00
|
|
|
prePatch = ''
|
|
|
|
ls -alhtr
|
|
|
|
'';
|
|
|
|
patches = [ ./db-in-homedir.patch ];
|
2017-09-21 00:09:17 +00:00
|
|
|
buildInputs = [gems ruby];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{bin,share/beef}
|
|
|
|
|
|
|
|
cp -r * $out/share/beef
|
|
|
|
# set the default db path, unfortunately setting to /tmp does not seem to work
|
|
|
|
# sed -i 's#db_file: .*#db_file: "/tmp/beef.db"#' $out/share/beef/config.yaml
|
|
|
|
|
|
|
|
bin=$out/bin/beef
|
|
|
|
cat > $bin <<EOF
|
|
|
|
#!/bin/sh -e
|
2018-08-16 17:31:40 +00:00
|
|
|
PATH=$PATH:${nodejs}/bin/
|
2017-09-21 00:09:17 +00:00
|
|
|
exec ${gems}/bin/bundle exec ${ruby}/bin/ruby $out/share/beef/beef "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $bin
|
|
|
|
'';
|
|
|
|
|
2018-08-16 17:31:40 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://beefproject.com/;
|
|
|
|
description = "The Browser Exploitation Framework";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ makefu ];
|
|
|
|
};
|
2017-09-21 00:09:17 +00:00
|
|
|
|
|
|
|
}
|