at master 2.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 debugger, 6 fetchPypi, 7 capstone, 8 colored-traceback, 9 intervaltree, 10 mako, 11 packaging, 12 paramiko, 13 psutil, 14 pyelftools, 15 pygments, 16 pyserial, 17 pysocks, 18 python-dateutil, 19 requests, 20 ropgadget, 21 rpyc, 22 setuptools, 23 six, 24 sortedcontainers, 25 unicorn, 26 unix-ar, 27 zstandard, 28 installShellFiles, 29}: 30 31let 32 debuggerName = lib.strings.getName debugger; 33in 34buildPythonPackage rec { 35 pname = "pwntools"; 36 version = "4.14.1"; 37 pyproject = true; 38 39 src = fetchPypi { 40 inherit pname version; 41 hash = "sha256-YPBJdtFyISDRi51QVTQIoCRmS1z4iPNvJYr8pL8DXKw="; 42 }; 43 44 postPatch = '' 45 # Upstream hardcoded the check for the command `gdb-multiarch`; 46 # Forcefully use the provided debugger as `gdb`. 47 sed -i 's/gdb-multiarch/${debuggerName}/' pwnlib/gdb.py 48 49 # Disable update checks 50 substituteInPlace pwnlib/update.py \ 51 --replace-fail 'disabled = False' 'disabled = True' 52 ''; 53 54 nativeBuildInputs = [ installShellFiles ]; 55 56 build-system = [ setuptools ]; 57 58 pythonRemoveDeps = [ 59 "pip" 60 "unicorn" 61 ]; 62 63 propagatedBuildInputs = [ 64 capstone 65 colored-traceback 66 intervaltree 67 mako 68 packaging 69 paramiko 70 psutil 71 pyelftools 72 pygments 73 pyserial 74 pysocks 75 python-dateutil 76 requests 77 ropgadget 78 rpyc 79 six 80 sortedcontainers 81 unicorn 82 unix-ar 83 zstandard 84 ]; 85 86 doCheck = false; # no setuptools tests for the package 87 88 postInstall = '' 89 installShellCompletion --cmd pwn \ 90 --bash extra/bash_completion.d/pwn \ 91 --zsh extra/zsh_completion/_pwn 92 ''; 93 94 postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 95 mkdir -p "$out/bin" 96 makeWrapper "${debugger}/bin/${debuggerName}" "$out/bin/pwntools-gdb" 97 ''; 98 99 pythonImportsCheck = [ "pwn" ]; 100 101 meta = with lib; { 102 description = "CTF framework and exploit development library"; 103 homepage = "https://pwntools.com"; 104 changelog = "https://github.com/Gallopsled/pwntools/releases/tag/${version}"; 105 license = licenses.mit; 106 maintainers = with maintainers; [ 107 bennofs 108 kristoff3r 109 pamplemousse 110 ]; 111 }; 112}