depot/third_party/nixpkgs/pkgs/development/python-modules/pwntools/default.nix
Default email 5e7c2d6cef Project import generated by Copybara.
GitOrigin-RevId: f99e5f03cc0aa231ab5950a15ed02afec45ed51a
2023-10-09 21:29:22 +02:00

88 lines
1.7 KiB
Nix

{ lib
, stdenv
, buildPythonPackage
, debugger
, fetchPypi
, mako
, packaging
, pysocks
, pygments
, ropgadget
, capstone
, colored-traceback
, paramiko
, pip
, psutil
, pyelftools
, pyserial
, python-dateutil
, requests
, rpyc
, tox
, unicorn
, intervaltree
, installShellFiles
}:
let
debuggerName = lib.strings.getName debugger;
in
buildPythonPackage rec {
pname = "pwntools";
version = "4.11.0";
src = fetchPypi {
inherit pname version;
hash = "sha256-qF8ed380P5HiIdF14VI9AG7vHIEGwQ/S4zgoC6snP6Y=";
};
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
];
propagatedBuildInputs = [
mako
packaging
pysocks
pygments
ropgadget
capstone
colored-traceback
paramiko
pip
psutil
pyelftools
pyserial
python-dateutil
requests
rpyc
tox
unicorn
intervaltree
];
doCheck = false; # no setuptools tests for the package
postInstall = ''
installShellCompletion --bash extra/bash_completion.d/shellcraft
'';
postFixup = lib.optionalString (!stdenv.isDarwin) ''
mkdir -p "$out/bin"
makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb"
'';
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 ];
};
}