about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/misc/pwndbg/default.nix
blob: 8f27609ababe7286b82e7491b4966eb614c8ffdf (plain) (blame)
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
{ stdenv
, fetchFromGitHub
, makeWrapper
, gdb
, future
, isort
, psutil
, pycparser
, pyelftools
, python-ptrace
, ROPGadget
, six
, unicorn
, pygments
, }:

stdenv.mkDerivation rec {
  name = "pwndbg-${version}";
  version = "2019.01.25";

  src = fetchFromGitHub {
    owner = "pwndbg";
    repo = "pwndbg";
    rev = version;
    sha256 = "0k7n6pcrj62ccag801yzf04a9mj9znghpkbnqwrzz0qn3rs42vgs";
  };

  nativeBuildInputs = [ makeWrapper ];

  propagatedBuildInputs = [
    future
    isort
    psutil
    pycparser
    pyelftools
    python-ptrace
    ROPGadget
    six
    unicorn
    pygments
  ];

  installPhase = ''
    mkdir -p $out/share/pwndbg
    cp -r *.py pwndbg $out/share/pwndbg
    makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg \
      --add-flags "-q -x $out/share/pwndbg/gdbinit.py"
  '';

  preFixup = ''
    sed -i "/import sys/a import sys; sys.path[0:0] = '$PYTHONPATH'.split(':')" \
      $out/share/pwndbg/gdbinit.py
  '';

  meta = with stdenv.lib; {
    description = "Exploit Development and Reverse Engineering with GDB Made Easy";
    homepage = http://pwndbg.com;
    license = licenses.mit;
    platforms = platforms.linux;
    maintainers = with maintainers; [ mic92 ];
  };
}