Merge pull request #302057 from msanft/pwndbg/2024.02.14

pwndbg: 2022.12.19 -> 2024.02.14
This commit is contained in:
Jörg Thalheim 2024-04-08 11:32:46 +02:00 committed by GitHub
commit bc79709dee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 171 additions and 65 deletions

View File

@ -0,0 +1,58 @@
{ lib
, stdenv
, python3
, fetchFromGitHub
, makeWrapper
, gdb
}:
let
pwndbg-py = python3.pkgs.pwndbg;
pythonPath = python3.pkgs.makePythonPath [ pwndbg-py ];
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
]);
in
stdenv.mkDerivation rec {
pname = "pwndbg";
version = lib.getVersion pwndbg-py;
format = "other";
inherit (pwndbg-py) src;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/share/pwndbg
cp gdbinit.py $out/share/pwndbg
chmod +x $out/share/pwndbg/gdbinit.py
# Don't require an in-package venv
touch $out/share/pwndbg/.skip-venv
makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg \
--add-flags "-q -x $out/share/pwndbg/gdbinit.py" \
--prefix PATH : ${binPath} \
--set PYTHONPATH ${pythonPath} \
runHook postInstall
'';
meta = with lib; {
description = "Exploit Development and Reverse Engineering with GDB Made Easy";
mainProgram = "pwndbg";
homepage = "https://github.com/pwndbg/pwndbg";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ mic92 patryk4815 msanft ];
# not supported on aarch64-darwin see: https://inbox.sourceware.org/gdb/3185c3b8-8a91-4beb-a5d5-9db6afb93713@Spark/
broken = stdenv.isDarwin && stdenv.isAarch64;
};
}

View File

@ -0,0 +1,29 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, poetry-core
}:
buildPythonPackage rec {
pname = "gdb-pt-dump";
version = "0-unstable-2024-04-01";
pyproject = true;
src = fetchFromGitHub {
owner = "martinradev";
repo = "gdb-pt-dump";
rev = "50227bda0b6332e94027f811a15879588de6d5cb";
hash = "sha256-yiP3KY1oDwhy9DmNQEht/ryys9vpgkFS+EJcSA6R+cI=";
};
build-system = [ poetry-core ];
pythonImportsCheck = [ "pt" ];
meta = with lib; {
description = "GDB script to enhance debugging of a QEMU-based virtual machine";
homepage = "https://github.com/martinradev/gdb-pt-dump";
license = licenses.mit;
maintainers = with maintainers; [ msanft ];
};
}

View File

@ -0,0 +1,80 @@
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, capstone
, future
, ipython
, psutil
, pwntools
, pycparser
, pyelftools
, pygments
, requests
, rpyc
, sortedcontainers
, tabulate
, typing-extensions
, unicorn
, gdb-pt-dump
, poetry-core
, pythonRelaxDepsHook
}:
let
# The newest gdb-pt-dump is incompatible with pwndbg 2024.02.14.
# See https://github.com/martinradev/gdb-pt-dump/issues/29
gdb-pt-dump' = gdb-pt-dump.overrideAttrs (oldAttrs: {
version = "0-unstable-2023-11-11";
src = fetchFromGitHub {
inherit (oldAttrs.src) owner repo;
rev = "89ea252f6efc5d75eacca16fc17ff8966a389690";
hash = "sha256-i+SAcZ/kgfKstJnkyCVMh/lWtrJJOHTYoJH4tVfYHrE=";
};
# This revision relies on the package being imported from within GDB, which
# won't work with pythonImportsCheck.
pythonImportsCheck = [ ];
});
in
buildPythonPackage rec {
pname = "pwndbg";
version = "2024.02.14";
pyproject = true;
src = fetchFromGitHub {
owner = "pwndbg";
repo = "pwndbg";
rev = version;
hash = "sha256-/pDo2J5EtpWWCurD7H34AlTlQi7WziIRRxHxGm3K2yk=";
};
nativeBuildInputs = [ poetry-core pythonRelaxDepsHook ];
pythonRelaxDeps = true;
propagatedBuildInputs = [
capstone
future
ipython
psutil
pwntools
pycparser
pyelftools
pygments
requests
rpyc
sortedcontainers
tabulate
typing-extensions
unicorn
gdb-pt-dump'
];
meta = {
description = "Exploit Development and Reverse Engineering with GDB Made Easy";
homepage = "https://pwndbg.re";
changelog = "https://github.com/pwndbg/pwndbg/releases/tag/${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ msanft ];
};
}

View File

@ -1,63 +0,0 @@
{ lib
, stdenv
, python3
, fetchFromGitHub
, makeWrapper
, gdb
}:
let
pythonPath = with python3.pkgs; makePythonPath [
capstone
future
psutil
pwntools
pycparser
pyelftools
pygments
unicorn
rpyc
];
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
]);
in stdenv.mkDerivation rec {
pname = "pwndbg";
version = "2022.12.19";
format = "other";
src = fetchFromGitHub {
owner = "pwndbg";
repo = "pwndbg";
rev = version;
sha256 = "sha256-pyY2bMasd6GaJZZjLF48SvkKUBw3XfVa0g3Q0LiEi4k=";
fetchSubmodules = true;
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/share/pwndbg
cp -r *.py pwndbg gdb-pt-dump $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" \
--prefix PATH : ${binPath} \
--set NIX_PYTHONPATH ${pythonPath}
'';
meta = with lib; {
description = "Exploit Development and Reverse Engineering with GDB Made Easy";
mainProgram = "pwndbg";
homepage = "https://github.com/pwndbg/pwndbg";
license = licenses.mit;
platforms = platforms.all;
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;
};
}

View File

@ -12249,8 +12249,6 @@ with pkgs;
pwnat = callPackage ../tools/networking/pwnat { };
pwndbg = callPackage ../development/tools/misc/pwndbg { };
pwninit = callPackage ../development/tools/misc/pwninit {
inherit (darwin.apple_sdk.frameworks) Security;
};

View File

@ -4614,6 +4614,8 @@ self: super: with self; {
gdata = callPackage ../development/python-modules/gdata { };
gdb-pt-dump = callPackage ../development/python-modules/gdb-pt-dump { };
gdcm = toPythonModule (pkgs.gdcm.override {
inherit (self) python;
enablePython = true;
@ -10393,6 +10395,8 @@ self: super: with self; {
pwlf = callPackage ../development/python-modules/pwlf { };
pwndbg = callPackage ../development/python-modules/pwndbg { };
pwntools = callPackage ../development/python-modules/pwntools {
debugger = pkgs.gdb;
};