about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-03-23 07:46:15 +0100
committerGitHub <noreply@github.com>2022-03-23 07:46:15 +0100
commit4df9ab418f68d1ae340b33dfe7411f12b3e6218f (patch)
tree66a34e27bf0393a5a849eb764fb0e1d5f8268d01
parent744e1a6ee6e4520f7185f35513d76e48d6b23456 (diff)
parent2cd15bbbedba8fb1ae2b008331aefe6804d4075c (diff)
Merge pull request #164985 from Freax13/init-gef
-rw-r--r--maintainers/maintainer-list.nix7
-rw-r--r--pkgs/development/tools/misc/gef/default.nix77
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 85 insertions, 1 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index ef76a3043beff..4a66ffa1eafb8 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -4241,7 +4241,12 @@
     githubId = 119691;
     name = "Michael Gough";
   };
-
+  freax13 = {
+    email = "erbse.13@gmx.de";
+    github = "freax13";
+    githubId = 14952658;
+    name = "Tom Dohrmann";
+  };
   fredeb = {
     email = "im@fredeb.dev";
     github = "fredeeb";
diff --git a/pkgs/development/tools/misc/gef/default.nix b/pkgs/development/tools/misc/gef/default.nix
new file mode 100644
index 0000000000000..0352ebc7cf327
--- /dev/null
+++ b/pkgs/development/tools/misc/gef/default.nix
@@ -0,0 +1,77 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, makeWrapper
+, gdb
+, python3
+, file
+, ps
+, git
+, coreutils
+}:
+
+let
+  pythonPath = with python3.pkgs; makePythonPath [
+    keystone-engine
+    unicorn
+    capstone
+    ropper
+  ];
+
+in stdenv.mkDerivation rec {
+  pname = "gef";
+  version = "2022.01";
+
+  src = fetchFromGitHub {
+    owner = "hugsy";
+    repo = "gef";
+    rev = version;
+    sha256 = "sha256-Ot0OYMbXFGCzJdmDHD+LoZRDShCbYJ+IGzLTcU2Rfd4=";
+  };
+
+  dontBuild = true;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/share/gef
+    cp gef.py $out/share/gef
+    makeWrapper ${gdb}/bin/gdb $out/bin/gef \
+      --add-flags "-q -x $out/share/gef/gef.py" \
+      --set NIX_PYTHONPATH ${pythonPath} \
+      --prefix PATH : ${lib.makeBinPath [ python3 file ps ]}
+  '';
+
+  checkInputs = [
+    gdb
+    file
+    ps
+    git
+    python3
+    python3.pkgs.pytest
+    python3.pkgs.pytest-xdist
+    python3.pkgs.keystone-engine
+    python3.pkgs.unicorn
+    python3.pkgs.capstone
+    python3.pkgs.ropper
+  ];
+  checkPhase = ''
+    # Skip some tests that require network access.
+    sed -i '/def test_cmd_shellcode_get(self):/i \ \ \ \ @unittest.skip(reason="not available in sandbox")' tests/runtests.py
+    sed -i '/def test_cmd_shellcode_search(self):/i \ \ \ \ @unittest.skip(reason="not available in sandbox")' tests/runtests.py
+
+    # Patch the path to /bin/ls.
+    sed -i 's+/bin/ls+${coreutils}/bin/ls+g' tests/runtests.py
+
+    # Run the tests.
+    make test
+  '';
+
+  meta = with lib; {
+    description = "A modern experience for GDB with advanced debugging features for exploit developers & reverse engineers";
+    homepage = "https://github.com/hugsy/gef";
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ freax13 ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index be22edcb2d9c1..9edf54d9f32a5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5783,6 +5783,8 @@ with pkgs;
 
   gdmap = callPackage ../tools/system/gdmap { };
 
+  gef = callPackage ../development/tools/misc/gef { };
+
   gelasio = callPackage ../data/fonts/gelasio { };
 
   gemget = callPackage ../tools/networking/gemget {};