From 4e3898b79a5d8b4008d370b6518d6c5cec1a1977 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Mon, 26 Dec 2022 19:52:43 +1100 Subject: [PATCH] ghidra-extensions.ghidraninja-ghidra-scripts: init at unstable-2020-10-07 --- pkgs/tools/security/ghidra/extensions.nix | 2 ++ .../ghidraninja-ghidra-scripts/default.nix | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix diff --git a/pkgs/tools/security/ghidra/extensions.nix b/pkgs/tools/security/ghidra/extensions.nix index a5b2f0a64364..2f3669c797a9 100644 --- a/pkgs/tools/security/ghidra/extensions.nix +++ b/pkgs/tools/security/ghidra/extensions.nix @@ -2,4 +2,6 @@ lib.makeScope newScope (self: { inherit (callPackage ./build-extension.nix { inherit ghidra; }) buildGhidraExtension buildGhidraScripts; + + ghidraninja-ghidra-scripts = self.callPackage ./extensions/ghidraninja-ghidra-scripts { }; }) diff --git a/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix b/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix new file mode 100644 index 000000000000..6c5e2ec2ea2a --- /dev/null +++ b/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix @@ -0,0 +1,36 @@ +{ lib +, fetchFromGitHub +, buildGhidraScripts +, binwalk +, swift +, yara +}: + +buildGhidraScripts { + pname = "ghidraninja-ghidra-scripts"; + version = "unstable-2020-10-07"; + + src = fetchFromGitHub { + owner = "ghidraninja"; + repo = "ghidra_scripts"; + rev = "99f2a8644a29479618f51e2d4e28f10ba5e9ac48"; + sha256 = "aElx0mp66/OHQRfXwTkqdLL0gT2T/yL00bOobYleME8="; + }; + + postPatch = '' + # Replace subprocesses with store versions + substituteInPlace binwalk.py --replace-fail 'subprocess.call(["binwalk"' 'subprocess.call(["${binwalk}/bin/binwalk"' + substituteInPlace swift_demangler.py --replace-fail '"swift"' '"${swift}/bin/swift"' + substituteInPlace yara.py --replace-fail 'subprocess.check_output(["yara"' 'subprocess.check_output(["${yara}/bin/yara"' + substituteInPlace YaraSearch.py --replace-fail '"yara "' '"${yara}/bin/yara "' + ''; + + meta = with lib; { + description = "Scripts for the Ghidra software reverse engineering suite"; + homepage = "https://github.com/ghidraninja/ghidra_scripts"; + license = with licenses; [ + gpl3Only + gpl2Only + ]; + }; +}