2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2022-11-02 22:02:43 +00:00
|
|
|
, stdenv
|
2020-08-20 17:08:02 +00:00
|
|
|
, buildPythonPackage
|
2020-09-25 04:45:31 +00:00
|
|
|
, debugger
|
2020-08-20 17:08:02 +00:00
|
|
|
, fetchPypi
|
|
|
|
, Mako
|
|
|
|
, packaging
|
|
|
|
, pysocks
|
|
|
|
, pygments
|
2021-12-06 16:07:01 +00:00
|
|
|
, ropgadget
|
2020-08-20 17:08:02 +00:00
|
|
|
, capstone
|
2021-05-20 23:08:51 +00:00
|
|
|
, colored-traceback
|
2020-08-20 17:08:02 +00:00
|
|
|
, paramiko
|
|
|
|
, pip
|
|
|
|
, psutil
|
|
|
|
, pyelftools
|
|
|
|
, pyserial
|
2021-07-04 02:40:35 +00:00
|
|
|
, python-dateutil
|
2020-08-20 17:08:02 +00:00
|
|
|
, requests
|
2021-05-20 23:08:51 +00:00
|
|
|
, rpyc
|
2020-08-20 17:08:02 +00:00
|
|
|
, tox
|
|
|
|
, unicorn
|
|
|
|
, intervaltree
|
2021-05-20 23:08:51 +00:00
|
|
|
, installShellFiles
|
2020-08-20 17:08:02 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
let
|
|
|
|
debuggerName = lib.strings.getName debugger;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonPackage rec {
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "4.8.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pwntools";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-04-27 09:35:20 +00:00
|
|
|
sha256 = "sha256-QgUuLYg3EOTh2gQekWdabXGftOXvLdJFyyhT2hEmkpA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
postPatch = ''
|
2021-05-20 23:08:51 +00: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-08-20 17:08:02 +00:00
|
|
|
sed -i 's/unicorn>=1.0.2rc1,<1.0.2rc4/unicorn>=1.0.2rc1/' setup.py
|
2021-05-20 23:08:51 +00: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-08-20 17:08:02 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
Mako
|
|
|
|
packaging
|
|
|
|
pysocks
|
|
|
|
pygments
|
2021-12-06 16:07:01 +00:00
|
|
|
ropgadget
|
2020-08-20 17:08:02 +00:00
|
|
|
capstone
|
2021-05-20 23:08:51 +00:00
|
|
|
colored-traceback
|
2020-08-20 17:08:02 +00:00
|
|
|
paramiko
|
|
|
|
pip
|
|
|
|
psutil
|
|
|
|
pyelftools
|
|
|
|
pyserial
|
2021-07-04 02:40:35 +00:00
|
|
|
python-dateutil
|
2020-08-20 17:08:02 +00:00
|
|
|
requests
|
2021-05-20 23:08:51 +00:00
|
|
|
rpyc
|
2020-08-20 17:08:02 +00:00
|
|
|
tox
|
|
|
|
unicorn
|
|
|
|
intervaltree
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = false; # no setuptools tests for the package
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --bash extra/bash_completion.d/shellcraft
|
|
|
|
'';
|
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
postFixup = lib.optionalString (!stdenv.isDarwin) ''
|
2020-09-25 04:45:31 +00:00
|
|
|
mkdir -p "$out/bin"
|
2021-05-20 23:08:51 +00:00
|
|
|
makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb"
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://pwntools.com";
|
|
|
|
description = "CTF framework and exploit development library";
|
|
|
|
license = licenses.mit;
|
2020-09-25 04:45:31 +00:00
|
|
|
maintainers = with maintainers; [ bennofs kristoff3r pamplemousse ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|