nixpkgs/pkgs/development/tools/misc/pwndbg/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.7 KiB
Nix
Raw Normal View History

2021-11-19 02:13:01 +03:00
{ lib
, stdenv
, python3
2018-12-01 14:01:45 +03:00
, fetchFromGitHub
, makeWrapper
, gdb
}:
2018-04-06 10:21:43 +03:00
let
pythonPath = with python3.pkgs; makePythonPath [
2022-12-21 18:03:55 +03:00
capstone
2018-04-06 10:21:43 +03:00
future
psutil
2022-12-21 18:03:55 +03:00
pwntools
2018-04-06 10:21:43 +03:00
pycparser
pyelftools
pygments
2022-12-21 18:03:55 +03:00
unicorn
rpyc
2018-04-06 10:21:43 +03:00
];
2022-12-21 18:03:55 +03:00
binPath = lib.makeBinPath ([
python3.pkgs.pwntools # ref: https://github.com/pwndbg/pwndbg/blob/2022.12.19/pwndbg/wrappers/checksec.py#L8
] ++ lib.optionals stdenv.isLinux [
python3.pkgs.ropper # ref: https://github.com/pwndbg/pwndbg/blob/2022.12.19/pwndbg/commands/ropper.py#L30
python3.pkgs.ropgadget # ref: https://github.com/pwndbg/pwndbg/blob/2022.12.19/pwndbg/commands/rop.py#L32
2022-12-21 18:03:55 +03:00
]);
2018-04-06 10:21:43 +03:00
in stdenv.mkDerivation rec {
pname = "pwndbg";
2022-12-21 18:03:55 +03:00
version = "2022.12.19";
format = "other";
src = fetchFromGitHub {
owner = "pwndbg";
repo = "pwndbg";
rev = version;
2022-12-21 18:03:55 +03:00
sha256 = "sha256-pyY2bMasd6GaJZZjLF48SvkKUBw3XfVa0g3Q0LiEi4k=";
fetchSubmodules = true;
};
nativeBuildInputs = [ makeWrapper ];
2018-04-06 10:21:43 +03:00
installPhase = ''
mkdir -p $out/share/pwndbg
2022-12-21 18:03:55 +03:00
cp -r *.py pwndbg gdb-pt-dump $out/share/pwndbg
chmod +x $out/share/pwndbg/gdbinit.py
2018-04-06 10:21:43 +03:00
makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg \
--add-flags "-q -x $out/share/pwndbg/gdbinit.py" \
2022-12-21 18:03:55 +03:00
--prefix PATH : ${binPath} \
--set NIX_PYTHONPATH ${pythonPath}
2018-04-06 10:21:43 +03:00
'';
meta = with lib; {
2018-04-06 10:21:43 +03:00
description = "Exploit Development and Reverse Engineering with GDB Made Easy";
homepage = "https://github.com/pwndbg/pwndbg";
2018-04-06 10:21:43 +03:00
license = licenses.mit;
2021-03-12 08:23:08 +03:00
platforms = platforms.all;
2022-12-21 18:03:55 +03:00
maintainers = with maintainers; [ mic92 patryk4815 ];
# not supported on aarch64-darwin see: https://inbox.sourceware.org/gdb/3185c3b8-8a91-4beb-a5d5-9db6afb93713@Spark/
broken = stdenv.isDarwin && stdenv.isAarch64;
2018-04-06 10:21:43 +03:00
};
}