-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a0620c8
Showing
20 changed files
with
904 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
target-branch: "main" | ||
schedule: | ||
interval: "weekly" |
This file contains 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,50 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '30 5 * * 1' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: 'ubuntu-latest' | ||
timeout-minutes: 360 | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'java-kotlin' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Install Ghidra | ||
uses: antoniovazquezblanco/[email protected] | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains 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,63 @@ | ||
name: Build | ||
on: [push, pull_request, workflow_dispatch] | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build_for_ghidra: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
ghidra: | ||
- "10.4" | ||
- "10.3.3" | ||
- "10.3.2" | ||
- "10.3.1" | ||
- "10.3" | ||
- "10.2.3" | ||
- "10.2.2" | ||
- "10.2.1" | ||
- "10.2" | ||
- "10.1.5" | ||
- "10.1.4" | ||
- "10.1.3" | ||
- "10.1.2" | ||
- "10.1.1" | ||
- "10.1" | ||
- "10.0.4" | ||
- "10.0.3" | ||
- "10.0.2" | ||
- "10.0.1" | ||
- "10.0" | ||
|
||
steps: | ||
- name: Clone Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Install Ghidra ${{ matrix.version }} | ||
uses: antoniovazquezblanco/[email protected] | ||
with: | ||
version: ${{ matrix.ghidra }} | ||
|
||
- name: Build the extension for Ghidra ${{ matrix.version }} | ||
uses: gradle/[email protected] | ||
with: | ||
gradle-version: 7.3 | ||
arguments: -PGHIDRA_INSTALL_DIR=${{ env.GHIDRA_INSTALL_DIR }} | ||
|
||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
if: github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v') | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file_glob: true | ||
file: dist/*GhidraDeviceTreeBlob.zip | ||
prerelease: ${{ github.ref == 'refs/heads/main' }} | ||
overwrite: true |
This file contains 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,10 @@ | ||
bin/ | ||
dist/ | ||
build/ | ||
.classpath | ||
.project | ||
.pydevproject | ||
.gradle | ||
.settings | ||
.idea | ||
.DS_Store |
Empty file.
This file contains 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,52 @@ | ||
# Ghidra System Map exporter | ||
|
||
[![Build](https://github.com/antoniovazquezblanco/GhidraDeviceTreeBlob/actions/workflows/main.yml/badge.svg)](https://github.com/antoniovazquezblanco/GhidraDeviceTreeBlob/actions/workflows/main.yml) | ||
|
||
Import Device Tree Information onto your Ghidra memory map. This is usefull when reversing firmware from propietary devices that do not publish SVD files. | ||
|
||
If you have SVD files for your device, I recommend you try [SVD Loader Ghidra](https://github.com/leveldown-security/SVD-Loader-Ghidra). | ||
|
||
|
||
## Installing | ||
|
||
Go to the [releases page](https://github.com/antoniovazquezblanco/GhidraDeviceTreeBlob/releases) and download the latest version for your Ghidra distribution. | ||
|
||
In Ghidra main window go to `File` > `Install extensions...`. In the new window press the `+` icon to import the downloaded zip. | ||
|
||
|
||
## Usage | ||
|
||
In a CodeBrowser window press `File` > `Import DTB...`. | ||
|
||
A file dialog will allow you to select your device tree file and import it. Memory map will automatically be updated. | ||
|
||
|
||
## Development | ||
|
||
### Development environment | ||
|
||
1. First, install [Eclipse for Java Developers](https://www.eclipse.org/downloads/packages/). | ||
2. Once installed, open Eclipse and click on `Help` > `Install New Software...`. A window will pop up. | ||
3. Click on `Add...` > `Archive...`. It will open a file selection dialog. In this dialog, please select `GhidraDev.zip` file from `<Your Ghidra install dir>/Extensions/Eclipse/GhidraDev/`. | ||
4. Check Ghidra category (or GhidraDev entry). | ||
5. Repeatedly click `Next`. | ||
6. Accept the terms of the license agreement. | ||
7. Check the `Unsigned` table entry and click `Trust Selected`. | ||
8. Restart Eclipse... | ||
|
||
### Importing the project | ||
|
||
After all of that, if you still want to develop and/or contribute to the project, first clone this repository: | ||
```bash | ||
git clone [email protected]:antoniovazquezblanco/GhidraDeviceTreeBlob.git | ||
``` | ||
|
||
In Eclipse: | ||
1. Click on `File` > `Import...`. | ||
2. In the dialog click on `General` > `Projects from Folder or Archive` > `Next`. | ||
3. Click on `Directory...` and select the `GhidraDeviceTreeBlob` folder you have just cloned. | ||
4. Click on `Finish`. | ||
5. Right click on the just imported project `GhidraDev` > `Link Ghidra...`. | ||
6. Select your desired Ghidra installation and click on `Finish`. | ||
|
||
You are now ready to develop! |
This file contains 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,59 @@ | ||
/* ### | ||
* IP: GHIDRA | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// Builds a Ghidra Extension for a given Ghidra installation. | ||
// | ||
// An absolute path to the Ghidra installation directory must be supplied either by setting the | ||
// GHIDRA_INSTALL_DIR environment variable or Gradle project property: | ||
// | ||
// > export GHIDRA_INSTALL_DIR=<Absolute path to Ghidra> | ||
// > gradle | ||
// | ||
// or | ||
// | ||
// > gradle -PGHIDRA_INSTALL_DIR=<Absolute path to Ghidra> | ||
// | ||
// Gradle should be invoked from the directory of the project to build. Please see the | ||
// application.gradle.version property in <GHIDRA_INSTALL_DIR>/Ghidra/application.properties | ||
// for the correction version of Gradle to use for the Ghidra installation you specify. | ||
|
||
//----------------------START "DO NOT MODIFY" SECTION------------------------------ | ||
def ghidraInstallDir | ||
|
||
if (System.env.GHIDRA_INSTALL_DIR) { | ||
ghidraInstallDir = System.env.GHIDRA_INSTALL_DIR | ||
} | ||
else if (project.hasProperty("GHIDRA_INSTALL_DIR")) { | ||
ghidraInstallDir = project.getProperty("GHIDRA_INSTALL_DIR") | ||
} | ||
|
||
if (ghidraInstallDir) { | ||
apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle" | ||
} | ||
else { | ||
throw new GradleException("GHIDRA_INSTALL_DIR is not defined!") | ||
} | ||
//----------------------END "DO NOT MODIFY" SECTION------------------------------- | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation 'io.kaitai:kaitai-struct-runtime:0.10' | ||
} | ||
|
||
// Exclude additional files from the built extension | ||
// Ex: buildExtension.exclude '.idea/**' |
This file contains 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,15 @@ | ||
The "data" directory is intended to hold data files that will be used by this module and will | ||
not end up in the .jar file, but will be present in the zip or tar file. Typically, data | ||
files are placed here rather than in the resources directory if the user may need to edit them. | ||
|
||
An optional data/languages directory can exist for the purpose of containing various Sleigh language | ||
specification files and importer opinion files. | ||
|
||
The data/buildLanguage.xml is used for building the contents of the data/languages directory. | ||
|
||
The skel language definition has been commented-out within the skel.ldefs file so that the | ||
skeleton language does not show-up within Ghidra. | ||
|
||
See the Sleigh language documentation (docs/languages/index.html) for details Sleigh language | ||
specification syntax. | ||
|
This file contains 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,5 @@ | ||
name=@extname@ | ||
description=This plugin manages the import of DTB files to add memory map information to a program. | ||
author=Antonio Vázquez Blanco | ||
createdOn=27/11/2023 | ||
version=@extversion@ |
This file contains 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 @@ | ||
Java source directory to hold module-specific Ghidra scripts. |
Binary file not shown.
This file contains 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,3 @@ | ||
The "os/linux_x86_64" directory is intended to hold Linux native binaries | ||
which this module is dependent upon. This directory may be eliminated for a specific | ||
module if native binaries are not provided for the corresponding platform. |
This file contains 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,3 @@ | ||
The "os/mac_x86_64" directory is intended to hold macOS (OS X) native binaries | ||
which this module is dependent upon. This directory may be eliminated for a specific | ||
module if native binaries are not provided for the corresponding platform. |
This file contains 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,3 @@ | ||
The "os/win_x86_64" directory is intended to hold MS Windows native binaries (.exe) | ||
which this module is dependent upon. This directory may be eliminated for a specific | ||
module if native binaries are not provided for the corresponding platform. |
This file contains 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,57 @@ | ||
<?xml version='1.0' encoding='ISO-8859-1' ?> | ||
<!-- | ||
This is an XML file intended to be parsed by the Ghidra help system. It is loosely based | ||
upon the JavaHelp table of contents document format. The Ghidra help system uses a | ||
TOC_Source.xml file to allow a module with help to define how its contents appear in the | ||
Ghidra help viewer's table of contents. The main document (in the Base module) | ||
defines a basic structure for the | ||
Ghidra table of contents system. Other TOC_Source.xml files may use this structure to insert | ||
their files directly into this structure (and optionally define a substructure). | ||
In this document, a tag can be either a <tocdef> or a <tocref>. The former is a definition | ||
of an XML item that may have a link and may contain other <tocdef> and <tocref> children. | ||
<tocdef> items may be referred to in other documents by using a <tocref> tag with the | ||
appropriate id attribute value. Using these two tags allows any module to define a place | ||
in the table of contents system (<tocdef>), which also provides a place for | ||
other TOC_Source.xml files to insert content (<tocref>). | ||
During the help build time, all TOC_Source.xml files will be parsed and validated to ensure | ||
that all <tocref> tags point to valid <tocdef> tags. From these files will be generated | ||
<module name>_TOC.xml files, which are table of contents files written in the format | ||
desired by the JavaHelp system. Additionally, the genated files will be merged together | ||
as they are loaded by the JavaHelp system. In the end, when displaying help in the Ghidra | ||
help GUI, there will be on table of contents that has been created from the definitions in | ||
all of the modules' TOC_Source.xml files. | ||
Tags and Attributes | ||
<tocdef> | ||
-id - the name of the definition (this must be unique across all TOC_Source.xml files) | ||
-text - the display text of the node, as seen in the help GUI | ||
-target** - the file to display when the node is clicked in the GUI | ||
-sortgroup - this is a string that defines where a given node should appear under a given | ||
parent. The string values will be sorted by the JavaHelp system using | ||
a javax.text.RulesBasedCollator. If this attribute is not specified, then | ||
the text of attribute will be used. | ||
<tocref> | ||
-id - The id of the <tocdef> that this reference points to | ||
**The URL for the target is relative and should start with 'help/topics'. This text is | ||
used by the Ghidra help system to provide a universal starting point for all links so that | ||
they can be resolved at runtime, across modules. | ||
--> | ||
|
||
|
||
<tocroot> | ||
<!-- Uncomment and adjust fields to add help topic to help system's Table of Contents | ||
<tocref id="Ghidra Functionality"> | ||
<tocdef id="HelpAnchor" text="My Feature" target="help/topics/my_topic/help.html" /> | ||
</tocref> | ||
--> | ||
</tocroot> |
This file contains 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,23 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
|
||
<HTML> | ||
<HEAD> | ||
<META name="generator" content= | ||
"HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net"> | ||
<META http-equiv="Content-Language" content="en-us"> | ||
<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> | ||
<META name="GENERATOR" content="Microsoft FrontPage 4.0"> | ||
<META name="ProgId" content="FrontPage.Editor.Document"> | ||
|
||
<TITLE>Skeleton Help File for a Module</TITLE> | ||
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css"> | ||
</HEAD> | ||
|
||
<BODY> | ||
<H1><a name="HelpAnchor"></a>Skeleton Help File for a Module</H1> | ||
|
||
<P>This is a simple skeleton help topic. For a better description of what should and should not | ||
go in here, see the "sample" Ghidra extension in the Extensions/Ghidra directory, or see your | ||
favorite help topic. In general, language modules do not have their own help topics.</P> | ||
</BODY> | ||
</HTML> |
Oops, something went wrong.