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
|
2023-03-15 16:39:30 +00:00
|
|
|
, mako
|
2020-08-20 17:08:02 +00:00
|
|
|
, 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 {
|
|
|
|
pname = "pwntools";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "4.11.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-qF8ed380P5HiIdF14VI9AG7vHIEGwQ/S4zgoC6snP6Y=";
|
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 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 = [
|
2023-03-15 16:39:30 +00:00
|
|
|
mako
|
2020-08-20 17:08:02 +00:00
|
|
|
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
|
|
|
description = "CTF framework and exploit development library";
|
2023-05-24 13:37:59 +00:00
|
|
|
homepage = "https://pwntools.com";
|
|
|
|
changelog = "https://github.com/Gallopsled/pwntools/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|