2021-01-25 08:26:54 +00:00
|
|
|
{ lib
|
2020-07-26 15:48:03 +01:00
|
|
|
, buildPythonPackage
|
2020-08-20 18:14:44 +01:00
|
|
|
, debugger
|
2020-07-26 15:48:03 +01:00
|
|
|
, fetchPypi
|
|
|
|
, Mako
|
|
|
|
, packaging
|
|
|
|
, pysocks
|
|
|
|
, pygments
|
|
|
|
, ROPGadget
|
|
|
|
, capstone
|
2021-05-15 01:34:33 +01:00
|
|
|
, colored-traceback
|
2020-07-26 15:48:03 +01:00
|
|
|
, paramiko
|
|
|
|
, pip
|
|
|
|
, psutil
|
|
|
|
, pyelftools
|
|
|
|
, pyserial
|
|
|
|
, dateutil
|
|
|
|
, requests
|
2021-05-15 01:34:33 +01:00
|
|
|
, rpyc
|
2020-07-26 15:48:03 +01:00
|
|
|
, tox
|
|
|
|
, unicorn
|
|
|
|
, intervaltree
|
2021-05-06 21:05:27 +01:00
|
|
|
, installShellFiles
|
2020-07-26 15:48:03 +01:00
|
|
|
}:
|
2017-10-29 00:39:03 +01:00
|
|
|
|
2021-05-13 18:27:27 +01:00
|
|
|
let
|
|
|
|
debuggerName = lib.strings.getName debugger;
|
|
|
|
in
|
2017-10-29 00:39:03 +01:00
|
|
|
buildPythonPackage rec {
|
2021-05-15 01:34:33 +01:00
|
|
|
version = "4.5.0";
|
2017-10-29 00:39:03 +01:00
|
|
|
pname = "pwntools";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-05-15 01:34:33 +01:00
|
|
|
sha256 = "sha256-IWHMorSASG/po8ib1whS3xPuoUUlD0tbbWI35DI2SIY=";
|
2017-10-29 00:39:03 +01:00
|
|
|
};
|
|
|
|
|
2020-07-26 15:48:03 +01:00
|
|
|
postPatch = ''
|
2021-05-13 18:27:27 +01:00
|
|
|
# Upstream has set an upper bound on unicorn because of https://github.com/Gallopsled/pwntools/issues/1538,
|
|
|
|
# but since that is a niche use case and it requires extra work to get unicorn 1.0.2rc3 to work we relax
|
|
|
|
# the bound here. Check if this is still necessary when updating!
|
2020-07-26 15:48:03 +01:00
|
|
|
sed -i 's/unicorn>=1.0.2rc1,<1.0.2rc4/unicorn>=1.0.2rc1/' setup.py
|
2021-05-13 18:27:27 +01:00
|
|
|
|
|
|
|
# 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
|
2020-07-26 15:48:03 +01:00
|
|
|
'';
|
|
|
|
|
2021-05-06 21:05:27 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2020-07-26 15:48:03 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
Mako
|
|
|
|
packaging
|
|
|
|
pysocks
|
|
|
|
pygments
|
|
|
|
ROPGadget
|
|
|
|
capstone
|
2021-05-15 01:34:33 +01:00
|
|
|
colored-traceback
|
2020-07-26 15:48:03 +01:00
|
|
|
paramiko
|
|
|
|
pip
|
|
|
|
psutil
|
|
|
|
pyelftools
|
|
|
|
pyserial
|
|
|
|
dateutil
|
|
|
|
requests
|
2021-05-15 01:34:33 +01:00
|
|
|
rpyc
|
2020-07-26 15:48:03 +01:00
|
|
|
tox
|
|
|
|
unicorn
|
|
|
|
intervaltree
|
|
|
|
];
|
2017-10-29 00:39:03 +01:00
|
|
|
|
2017-12-17 18:38:18 +00:00
|
|
|
doCheck = false; # no setuptools tests for the package
|
2017-10-29 00:39:03 +01:00
|
|
|
|
2021-05-06 21:05:27 +01:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --bash extra/bash_completion.d/shellcraft
|
|
|
|
'';
|
|
|
|
|
2020-08-20 18:14:44 +01:00
|
|
|
postFixup = ''
|
|
|
|
mkdir -p "$out/bin"
|
2021-05-13 18:27:27 +01:00
|
|
|
makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb"
|
2020-08-20 18:14:44 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-10-29 00:39:03 +01:00
|
|
|
homepage = "http://pwntools.com";
|
|
|
|
description = "CTF framework and exploit development library";
|
|
|
|
license = licenses.mit;
|
2020-08-20 18:14:44 +01:00
|
|
|
maintainers = with maintainers; [ bennofs kristoff3r pamplemousse ];
|
2017-10-29 00:39:03 +01:00
|
|
|
};
|
|
|
|
}
|