1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
{ 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.12.0";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-MgKFvZJmFS/bo7gd46MeYaJQdmRVB6ONhfNOGxWZjrE=";
};
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 ];
};
}
|