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