84 lines
2.1 KiB
Nix
84 lines
2.1 KiB
Nix
{ pkgs,
|
|
fetchFromGitHub,
|
|
fetchurl,
|
|
writeScript,
|
|
python3Packages,
|
|
stdenv,
|
|
stdenvNoCC,
|
|
}: let
|
|
src = stdenvNoCC.mkDerivation {
|
|
pname = "pppwn-python";
|
|
version = "1.0";
|
|
src = fetchFromGitHub {
|
|
owner = "TheOfficialFloW";
|
|
repo = "PPPwn";
|
|
rev = "fb4ab5ffa97e083775ccad3a95e2348fc6b53e1c";
|
|
hash = "sha256-jSxF8Ara5Iu26X9k89bpB/5ogUwgXreJueDGuLIlbgo=";
|
|
};
|
|
setup = ./setup.py;
|
|
installPhase = ''
|
|
mkdir $out
|
|
cp -r $src/* $out/.
|
|
cp $setup $out/setup.py
|
|
'';
|
|
};
|
|
python = with python3Packages;
|
|
buildPythonApplication {
|
|
pname = "pppwn-python";
|
|
version = "1.0";
|
|
|
|
propagatedBuildInputs = [scapy];
|
|
|
|
inherit src;
|
|
# buildPhase = "ls -l $src";
|
|
};
|
|
goldhen = fetchurl {
|
|
url = "https://github.com/GoldHEN/GoldHEN/releases/download/2.4b18/GoldHEN_v2.4b18.7z";
|
|
hash = "sha256-0MhMefZd9a/HmgDFePM6sapwrrnCBfHniYldx9T8o40=";
|
|
};
|
|
exploits = stdenv.mkDerivation {
|
|
pname = "pppwn-exploits";
|
|
version = "1.0";
|
|
inherit src goldhen;
|
|
nativeBuildInputs = with pkgs; [p7zip];
|
|
freebsd = fetchFromGitHub {
|
|
owner = "OpenOrbis";
|
|
repo = "freebsd-headers";
|
|
rev = "master";
|
|
hash = "sha256-a92e9vZIuPCH4DbnPGdYg/flwVZPvhKdIrbff7cZA1U=";
|
|
};
|
|
buildPhase = ''
|
|
cp -r $src/* .
|
|
cp -r $freebsd/* freebsd-headers
|
|
ls -l
|
|
ls -l freebsd-headers
|
|
make -C stage1 FW=960 clean && make -C stage1 FW=960
|
|
make -C stage2 FW=960 clean && make -C stage2 FW=960
|
|
'';
|
|
installPhase = ''
|
|
7z x -y $goldhen
|
|
7z x -y pppnw_stage2/stage2_v1.03.7z
|
|
mkdir -p $out/stage2
|
|
cp -r stage1 $out
|
|
cp -r stage2_9.60.bin $out/stage2/stage2.bin
|
|
'';
|
|
};
|
|
in stdenv.mkDerivation {
|
|
pname = "pppwn";
|
|
version = "1.0";
|
|
inherit src python;
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp $python/bin/pppwn.py $out/bin/.
|
|
cp $src/offsets.py $out/bin/.
|
|
cat << EOF >> $out/bin/pppwn
|
|
#!${pkgs.bash}/bin/bash
|
|
$out/bin/pppwn.py \
|
|
--stage1=${exploits}/stage1/stage1.bin \
|
|
--stage2=${exploits}/stage2/stage2.bin \
|
|
--fw=960 \
|
|
"\$@"
|
|
EOF
|
|
chmod +x $out/bin/pppwn
|
|
'';
|
|
}
|