472aeafc57
GitOrigin-RevId: c31898adf5a8ed202ce5bea9f347b1c6871f32d1
103 lines
2 KiB
Nix
103 lines
2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
debugger,
|
|
fetchPypi,
|
|
capstone,
|
|
colored-traceback,
|
|
intervaltree,
|
|
mako,
|
|
packaging,
|
|
paramiko,
|
|
psutil,
|
|
pyelftools,
|
|
pygments,
|
|
pyserial,
|
|
pysocks,
|
|
python-dateutil,
|
|
requests,
|
|
ropgadget,
|
|
rpyc,
|
|
setuptools,
|
|
six,
|
|
sortedcontainers,
|
|
unicorn,
|
|
unix-ar,
|
|
zstandard,
|
|
installShellFiles,
|
|
}:
|
|
|
|
let
|
|
debuggerName = lib.strings.getName debugger;
|
|
in
|
|
buildPythonPackage rec {
|
|
pname = "pwntools";
|
|
version = "4.13.1";
|
|
pyproject = true;
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
hash = "sha256-szInJftQMdwwll44VQc2CNmr900qv5enLGfUSq3843w=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# Upstream hardcoded the check for the command `gdb-multiarch`;
|
|
# Forcefully use the provided debugger, as `gdb` (hence `pwndbg`) is built with multiarch in `nixpkgs`.
|
|
sed -i 's/gdb-multiarch/${debuggerName}/' pwnlib/gdb.py
|
|
'';
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
pythonRemoveDeps = [ "pip" ];
|
|
|
|
propagatedBuildInputs = [
|
|
capstone
|
|
colored-traceback
|
|
intervaltree
|
|
mako
|
|
packaging
|
|
paramiko
|
|
psutil
|
|
pyelftools
|
|
pygments
|
|
pyserial
|
|
pysocks
|
|
python-dateutil
|
|
requests
|
|
ropgadget
|
|
rpyc
|
|
six
|
|
sortedcontainers
|
|
unicorn
|
|
unix-ar
|
|
zstandard
|
|
];
|
|
|
|
doCheck = false; # no setuptools tests for the package
|
|
|
|
postInstall = ''
|
|
installShellCompletion --bash extra/bash_completion.d/shellcraft
|
|
'';
|
|
|
|
postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
mkdir -p "$out/bin"
|
|
makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb"
|
|
'';
|
|
|
|
pythonImportsCheck = [ "pwn" ];
|
|
|
|
meta = with lib; {
|
|
description = "CTF framework and exploit development library";
|
|
homepage = "https://pwntools.com";
|
|
changelog = "https://github.com/Gallopsled/pwntools/releases/tag/${version}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [
|
|
bennofs
|
|
kristoff3r
|
|
pamplemousse
|
|
];
|
|
};
|
|
}
|