27a9800e85
pwndbg is a Python module for gdb. The built-in interpreter is used and pwndbg offers additional routines. Packaging this is tricky because that interpreter needs to be used. Using `python3.withPackages` won't work. By setting `NIX_PYTHONPATH`, the interpreter should pick up pwndbg and its dependencies. If `NIX_PYTHONPATH` does not function we can fall back to `PYTHONPATH`. An example of when that won't work is if pwndbg runs a script of itself in a subshell. `NIX_PYTHONPATH` would be unset, but `PYTHONPATH` not.
52 lines
1.1 KiB
Nix
52 lines
1.1 KiB
Nix
{ stdenv
|
|
, python3
|
|
, fetchFromGitHub
|
|
, makeWrapper
|
|
, gdb
|
|
}:
|
|
|
|
let
|
|
pythonPath = with python3.pkgs; makePythonPath [
|
|
future
|
|
isort
|
|
psutil
|
|
pycparser
|
|
pyelftools
|
|
python-ptrace
|
|
ROPGadget
|
|
six
|
|
unicorn
|
|
pygments
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
|
pname = "pwndbg";
|
|
version = "2019.01.25";
|
|
format = "other";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "pwndbg";
|
|
repo = "pwndbg";
|
|
rev = version;
|
|
sha256 = "0k7n6pcrj62ccag801yzf04a9mj9znghpkbnqwrzz0qn3rs42vgs";
|
|
};
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/share/pwndbg
|
|
cp -r *.py pwndbg $out/share/pwndbg
|
|
chmod +x $out/share/pwndbg/gdbinit.py
|
|
makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg \
|
|
--add-flags "-q -x $out/share/pwndbg/gdbinit.py" \
|
|
--set NIX_PYTHONPATH ${pythonPath}
|
|
'';
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "Exploit Development and Reverse Engineering with GDB Made Easy";
|
|
homepage = http://pwndbg.com;
|
|
license = licenses.mit;
|
|
platforms = platforms.linux;
|
|
maintainers = with maintainers; [ mic92 ];
|
|
};
|
|
}
|