-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
ghidra-extensions.ret-sync: init at unstable-2024-05-29 #315672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
353ccf0
ghidra.buildGhidraExtension: improve compatibility with darwin
emilytrau b72d4eb
ghidra-extensions.ret-sync: init at unstable-2024-05-29
vringar acc5bfc
ghidra-extensions.lightkeeper: init at 1.1.0
vringar 57a7c13
ghidra: chore run nixfmt-rfc-style on ghidra dir
vringar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,72 +1,98 @@ | ||
| { lib | ||
| , stdenv | ||
| , unzip | ||
| , jdk | ||
| , gradle | ||
| , ghidra | ||
| { | ||
| lib, | ||
| stdenv, | ||
| unzip, | ||
| jdk, | ||
| gradle, | ||
| ghidra, | ||
| }: | ||
|
|
||
| let | ||
| metaCommon = oldMeta: | ||
| oldMeta // (with lib; { | ||
| maintainers = (oldMeta.maintainers or []) ++ (with maintainers; [ vringar ]); | ||
| metaCommon = | ||
| oldMeta: | ||
| oldMeta | ||
| // (with lib; { | ||
| maintainers = (oldMeta.maintainers or [ ]) ++ (with maintainers; [ vringar ]); | ||
| platforms = oldMeta.platforms or ghidra.meta.platforms; | ||
| }); | ||
|
|
||
| buildGhidraExtension = { | ||
| pname, nativeBuildInputs ? [], meta ? { }, ... | ||
| }@args: | ||
| stdenv.mkDerivation (args // { | ||
| nativeBuildInputs = nativeBuildInputs ++ [ | ||
| unzip | ||
| jdk | ||
| gradle | ||
| ]; | ||
| buildGhidraExtension = | ||
| { | ||
| pname, | ||
| nativeBuildInputs ? [ ], | ||
| meta ? { }, | ||
| ... | ||
| }@args: | ||
| stdenv.mkDerivation ( | ||
| args | ||
| // { | ||
| nativeBuildInputs = nativeBuildInputs ++ [ | ||
| unzip | ||
| jdk | ||
| gradle | ||
| ]; | ||
|
|
||
| preBuild = '' | ||
| # Set project name, otherwise defaults to directory name | ||
| echo -e '\nrootProject.name = "${pname}"' >> settings.gradle | ||
| ${args.preBuild or ""} | ||
| ''; | ||
| preBuild = '' | ||
| # Set project name, otherwise defaults to directory name | ||
| echo -e '\nrootProject.name = "${pname}"' >> settings.gradle | ||
| # A config directory needs to exist when ghidra's GHelpBuilder is run | ||
| export XDG_CONFIG_HOME="''${XDG_CONFIG_HOME:-$(mktemp -d)}" | ||
| ${args.preBuild or ""} | ||
| ''; | ||
|
|
||
| gradleBuildTask = args.gradleBuildTask or "buildExtension"; | ||
| gradleFlags = args.gradleFlags or [] ++ [ "-PGHIDRA_INSTALL_DIR=${ghidra}/lib/ghidra" ]; | ||
| # Needed to run gradle on darwin | ||
| __darwinAllowLocalNetworking = true; | ||
|
|
||
| installPhase = args.installPhase or '' | ||
| runHook preInstall | ||
| gradleBuildTask = args.gradleBuildTask or "buildExtension"; | ||
| gradleFlags = args.gradleFlags or [ ] ++ [ "-PGHIDRA_INSTALL_DIR=${ghidra}/lib/ghidra" ]; | ||
|
|
||
| mkdir -p $out/lib/ghidra/Ghidra/Extensions | ||
| unzip -d $out/lib/ghidra/Ghidra/Extensions dist/*.zip | ||
| installPhase = | ||
| args.installPhase or '' | ||
| runHook preInstall | ||
|
|
||
| runHook postInstall | ||
| ''; | ||
| mkdir -p $out/lib/ghidra/Ghidra/Extensions | ||
| unzip -d $out/lib/ghidra/Ghidra/Extensions dist/*.zip | ||
|
|
||
| meta = metaCommon meta; | ||
| }); | ||
| runHook postInstall | ||
| ''; | ||
|
|
||
| buildGhidraScripts = { pname, meta ? { }, ... }@args: | ||
| stdenv.mkDerivation (args // { | ||
| installPhase = '' | ||
| runHook preInstall | ||
| meta = metaCommon meta; | ||
| } | ||
| ); | ||
|
|
||
| GHIDRA_HOME=$out/lib/ghidra/Ghidra/Extensions/${pname} | ||
| mkdir -p $GHIDRA_HOME | ||
| cp -r . $GHIDRA_HOME/ghidra_scripts | ||
| buildGhidraScripts = | ||
| { | ||
| pname, | ||
| meta ? { }, | ||
| ... | ||
| }@args: | ||
| stdenv.mkDerivation ( | ||
| args | ||
| // { | ||
| installPhase = '' | ||
| runHook preInstall | ||
|
|
||
| touch $GHIDRA_HOME/Module.manifest | ||
| cat <<'EOF' > extension.properties | ||
| name=${pname} | ||
| description=${meta.description or ""} | ||
| author= | ||
| createdOn= | ||
| version=${lib.getVersion ghidra} | ||
| GHIDRA_HOME=$out/lib/ghidra/Ghidra/Extensions/${pname} | ||
| mkdir -p $GHIDRA_HOME | ||
| cp -r . $GHIDRA_HOME/ghidra_scripts | ||
|
|
||
| EOF | ||
| touch $GHIDRA_HOME/Module.manifest | ||
| cat <<'EOF' > extension.properties | ||
| name=${pname} | ||
| description=${meta.description or ""} | ||
| author= | ||
| createdOn= | ||
| version=${lib.getVersion ghidra} | ||
|
|
||
| runHook postInstall | ||
| ''; | ||
| EOF | ||
|
|
||
| meta = metaCommon meta; | ||
| }); | ||
| runHook postInstall | ||
| ''; | ||
|
|
||
| meta = metaCommon meta; | ||
| } | ||
| ); | ||
| in | ||
| { inherit buildGhidraExtension buildGhidraScripts; } | ||
| { | ||
| inherit buildGhidraExtension buildGhidraScripts; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,26 @@ | ||
| { lib, newScope, callPackage, ghidra }: | ||
| { | ||
| lib, | ||
| newScope, | ||
| callPackage, | ||
| ghidra, | ||
| }: | ||
|
|
||
| lib.makeScope newScope (self: { | ||
| inherit (callPackage ./build-extension.nix { inherit ghidra; }) buildGhidraExtension buildGhidraScripts; | ||
| inherit (callPackage ./build-extension.nix { inherit ghidra; }) | ||
| buildGhidraExtension | ||
| buildGhidraScripts | ||
| ; | ||
|
|
||
| ghidraninja-ghidra-scripts = self.callPackage ./extensions/ghidraninja-ghidra-scripts { }; | ||
|
|
||
| gnudisassembler = self.callPackage ./extensions/gnudisassembler { inherit ghidra; }; | ||
|
|
||
| lightkeeper = self.callPackage ./extensions/lightkeeper { }; | ||
|
|
||
| machinelearning = self.callPackage ./extensions/machinelearning { inherit ghidra; }; | ||
|
|
||
| ret-sync = self.callPackage ./extensions/ret-sync { }; | ||
|
|
||
| sleighdevtools = self.callPackage ./extensions/sleighdevtools { inherit ghidra; }; | ||
|
|
||
| }) | ||
13 changes: 7 additions & 6 deletions
13
pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
pkgs/tools/security/ghidra/extensions/lightkeeper/default.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| lib, | ||
| fetchFromGitHub, | ||
| buildGhidraExtension, | ||
| }: | ||
| buildGhidraExtension rec { | ||
| pname = "lightkeeper"; | ||
| version = "1.1.0"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "WorksButNotTested"; | ||
| repo = "lightkeeper"; | ||
| rev = version; | ||
| hash = "sha256-S8yNn56A2CvrIBsq0RoBx0qOjrYDZSv1IVTxGmlL4Js="; | ||
| }; | ||
| preConfigure = '' | ||
| cd lightkeeper | ||
| ''; | ||
| meta = { | ||
| description = "A port of the Lighthouse plugin to GHIDRA."; | ||
| homepage = "https://github.com/WorksButNotTested/lightkeeper"; | ||
| license = lib.licenses.asl20; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
pkgs/tools/security/ghidra/extensions/ret-sync/default.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| lib, | ||
| fetchFromGitHub, | ||
| buildGhidraExtension, | ||
| ghidra, | ||
| }: | ||
| buildGhidraExtension { | ||
| pname = "ret-sync-ghidra"; | ||
| version = "0-unstable-2024-05-29"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "bootleg"; | ||
| repo = "ret-sync"; | ||
| rev = "0617c75746ddde7fe2bdbbf880175af8ad27553e"; | ||
| hash = "sha256-+G5ccdHnFL0sHpueuIYwLRU9FhzN658CYqQCHCBwxV4="; | ||
| }; | ||
|
|
||
| preConfigure = '' | ||
| cd ext_ghidra | ||
| ''; | ||
| preInstall = '' | ||
| correct_version=$(ls dist | grep ${ghidra.version}) | ||
| mv dist/$correct_version dist/safe.zip | ||
| rm dist/ghidra* | ||
| mv dist/safe.zip dist/$correct_version | ||
| ''; | ||
| meta = with lib; { | ||
| description = "Reverse-Engineering Tools SYNChronization. Allows syncing between a debugging session and Ghidra"; | ||
| homepage = "https://github.com/bootleg/ret-sync"; | ||
| license = licenses.gpl3Only; | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.