commit 0d777da07335c0b768ffa64bf069afaeb4fe7fb0 Author: Jeeves Date: Mon Oct 28 11:18:43 2024 -0600 init diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..212292c --- /dev/null +++ b/default.nix @@ -0,0 +1,2 @@ +{ pkgs ? import {} }: + pkgs.callPackage ./derivation.nix {} diff --git a/derivation.nix b/derivation.nix new file mode 100644 index 0000000..c0200cb --- /dev/null +++ b/derivation.nix @@ -0,0 +1,84 @@ +{ 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 + ''; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a57c4de --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1730129772, + "narHash": "sha256-/GVE8ugT5SWBbmOqaTjG3685Z6jCQVALkrIKqxZbIlI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "800ffc56a2db95c9fb24c4a75be9803e9f8d8465", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4e59752 --- /dev/null +++ b/flake.nix @@ -0,0 +1,15 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.default = import ./default.nix { inherit pkgs; }; + # packages.default = pkgs.writeShellScriptBin "pppwn" + # "${self.packages.${system}.pppwn}/bin/pppwn.py \"$@\""; + }); +} diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..ffab437 --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from setuptools import setup, find_packages + +setup(name='pppwn', + version='1.0', + # Modules to import from other scripts: + packages=find_packages(), + # Executables + scripts=["pppwn.py", "offsets.py"], + )