diff --git a/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix b/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix index 51e8b58838d7..47b961603e01 100644 --- a/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix +++ b/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix @@ -5,6 +5,7 @@ binwalk, swift, yara, + useSwift ? false, }: buildGhidraScripts { @@ -20,11 +21,20 @@ buildGhidraScripts { 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 "' - ''; + substituteInPlace binwalk.py --replace-fail 'subprocess.call(["binwalk"' 'subprocess.call(["${lib.getExe binwalk}"' + substituteInPlace yara.py --replace-fail 'subprocess.check_output(["yara"' 'subprocess.check_output(["${lib.getExe yara}"' + substituteInPlace YaraSearch.py --replace-fail '"yara "' '"${lib.getExe yara} "' + '' + + ( + if useSwift then + '' + substituteInPlace swift_demangler.py --replace-fail '"swift"' '"${lib.getExe' swift "swift"}"' + '' + else + '' + rm swift_demangler.py + '' + ); meta = { description = "Scripts for the Ghidra software reverse engineering suite";