1{ lib 2, buildPythonPackage 3, debugger 4, fetchPypi 5, Mako 6, packaging 7, pysocks 8, pygments 9, ROPGadget 10, capstone 11, colored-traceback 12, paramiko 13, pip 14, psutil 15, pyelftools 16, pyserial 17, python-dateutil 18, requests 19, rpyc 20, tox 21, unicorn 22, intervaltree 23, installShellFiles 24}: 25 26let 27 debuggerName = lib.strings.getName debugger; 28in 29buildPythonPackage rec { 30 version = "4.7.0"; 31 pname = "pwntools"; 32 33 src = fetchPypi { 34 inherit pname version; 35 sha256 = "sha256-dDiOKGdeehkp92PfWhzsaj1YlkEEm2z0drscVuxQqI4="; 36 }; 37 38 postPatch = '' 39 # Upstream has set an upper bound on unicorn because of https://github.com/Gallopsled/pwntools/issues/1538, 40 # but since that is a niche use case and it requires extra work to get unicorn 1.0.2rc3 to work we relax 41 # the bound here. Check if this is still necessary when updating! 42 sed -i 's/unicorn>=1.0.2rc1,<1.0.2rc4/unicorn>=1.0.2rc1/' setup.py 43 44 # Upstream hardcoded the check for the command `gdb-multiarch`; 45 # Forcefully use the provided debugger, as `gdb` (hence `pwndbg`) is built with multiarch in `nixpkgs`. 46 sed -i 's/gdb-multiarch/${debuggerName}/' pwnlib/gdb.py 47 ''; 48 49 nativeBuildInputs = [ 50 installShellFiles 51 ]; 52 53 propagatedBuildInputs = [ 54 Mako 55 packaging 56 pysocks 57 pygments 58 ROPGadget 59 capstone 60 colored-traceback 61 paramiko 62 pip 63 psutil 64 pyelftools 65 pyserial 66 python-dateutil 67 requests 68 rpyc 69 tox 70 unicorn 71 intervaltree 72 ]; 73 74 doCheck = false; # no setuptools tests for the package 75 76 postInstall = '' 77 installShellCompletion --bash extra/bash_completion.d/shellcraft 78 ''; 79 80 postFixup = '' 81 mkdir -p "$out/bin" 82 makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb" 83 ''; 84 85 meta = with lib; { 86 homepage = "http://pwntools.com"; 87 description = "CTF framework and exploit development library"; 88 license = licenses.mit; 89 maintainers = with maintainers; [ bennofs kristoff3r pamplemousse ]; 90 }; 91}