1{ lib 2, stdenv 3, buildPythonPackage 4, debugger 5, fetchPypi 6, mako 7, packaging 8, pysocks 9, pygments 10, ropgadget 11, capstone 12, colored-traceback 13, paramiko 14, pip 15, psutil 16, pyelftools 17, pyserial 18, python-dateutil 19, requests 20, rpyc 21, tox 22, unicorn 23, intervaltree 24, installShellFiles 25}: 26 27let 28 debuggerName = lib.strings.getName debugger; 29in 30buildPythonPackage rec { 31 pname = "pwntools"; 32 version = "4.11.1"; 33 34 src = fetchPypi { 35 inherit pname version; 36 hash = "sha256-7hnjX721t0YzKcJ75R+tEfUI6E9bxMYXUEtI56GDZP0="; 37 }; 38 39 postPatch = '' 40 # Upstream hardcoded the check for the command `gdb-multiarch`; 41 # Forcefully use the provided debugger, as `gdb` (hence `pwndbg`) is built with multiarch in `nixpkgs`. 42 sed -i 's/gdb-multiarch/${debuggerName}/' pwnlib/gdb.py 43 ''; 44 45 nativeBuildInputs = [ 46 installShellFiles 47 ]; 48 49 propagatedBuildInputs = [ 50 mako 51 packaging 52 pysocks 53 pygments 54 ropgadget 55 capstone 56 colored-traceback 57 paramiko 58 pip 59 psutil 60 pyelftools 61 pyserial 62 python-dateutil 63 requests 64 rpyc 65 tox 66 unicorn 67 intervaltree 68 ]; 69 70 doCheck = false; # no setuptools tests for the package 71 72 postInstall = '' 73 installShellCompletion --bash extra/bash_completion.d/shellcraft 74 ''; 75 76 postFixup = lib.optionalString (!stdenv.isDarwin) '' 77 mkdir -p "$out/bin" 78 makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb" 79 ''; 80 81 meta = with lib; { 82 description = "CTF framework and exploit development library"; 83 homepage = "https://pwntools.com"; 84 changelog = "https://github.com/Gallopsled/pwntools/releases/tag/${version}"; 85 license = licenses.mit; 86 maintainers = with maintainers; [ bennofs kristoff3r pamplemousse ]; 87 }; 88}