mirror of
https://github.com/DMaroo/GhidRust.git
synced 2025-05-22 23:12:05 +02:00
Initial extension set up
* Extension help can be found in the "Help" section in Ghidra * Extension build script, LICENSE and README added
This commit is contained in:
commit
1475238074
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# temp files
|
||||
tmp/
|
||||
|
||||
# editor config files
|
||||
.idea/
|
||||
.vscode/
|
||||
.settings/
|
||||
|
||||
# build directories
|
||||
bin/
|
||||
build/
|
||||
dist/
|
||||
|
||||
# gradle files
|
||||
.gradle/
|
||||
gradle/
|
||||
gradlew
|
||||
gradlew.bat
|
||||
|
||||
# misc
|
||||
.DS_Store
|
7
LICENSE
Normal file
7
LICENSE
Normal file
@ -0,0 +1,7 @@
|
||||
Copyright 2023 Dhruv Maroo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
0
Module.manifest
Normal file
0
Module.manifest
Normal file
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# GhidRust: Rust binary analysis extension
|
||||
|
||||
## Building
|
||||
|
||||
There is a build script provided (`build.sh`) which can build and install the extension.
|
||||
|
||||
```
|
||||
$ ./build.sh -h
|
||||
GhidRust install script
|
||||
Usage: build.sh [-i | --install] -g GHIDRA_PATH
|
||||
|
||||
-i | --install Install the extension
|
||||
-g | --ghidra Path to Ghidra installation (usually /opt/ghidra)
|
||||
-h | --help Show usage/help
|
||||
```
|
||||
|
||||
You can build the extension using the following command.
|
||||
|
||||
```
|
||||
$ ./build.sh -g <GHIDRA_INSTALL_DIR>
|
||||
```
|
||||
|
||||
You can install it using the install flag as follows.
|
||||
|
||||
```
|
||||
./build.sh -ig <GHIDRA_INSTALL_DIR>
|
||||
```
|
33
build.gradle
Normal file
33
build.gradle
Normal file
@ -0,0 +1,33 @@
|
||||
// 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-------------------------------
|
102
build.sh
Executable file
102
build.sh
Executable file
@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
success() {
|
||||
echo -e "\033[32;1m[+]\033[0m" "$1"
|
||||
}
|
||||
|
||||
status() {
|
||||
echo -e "\033[33;1m[-]\033[0m" "$1"
|
||||
}
|
||||
|
||||
failure() {
|
||||
echo -e "\033[31;1m[!]\033[0m" "$1"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo -e "Usage: $(basename $0) [-i | --install] -g GHIDRA_PATH"
|
||||
echo -e ""
|
||||
echo -e "\t-i | --install\t\t Install the extension"
|
||||
echo -e "\t-g | --ghidra\t\t Path to Ghidra installation (usually /opt/ghidra)"
|
||||
echo -e "\t-h | --help\t\t Show usage/help"
|
||||
}
|
||||
|
||||
VALID_ARGS=$(getopt -o ig:h --long install,ghidra:,help -- "$@")
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failure "Invalid arguments provided"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
eval set -- "$VALID_ARGS"
|
||||
|
||||
INSTALL=0
|
||||
GHIDRA=""
|
||||
|
||||
while [ : ]; do
|
||||
case "$1" in
|
||||
-i | --install)
|
||||
INSTALL=1
|
||||
shift
|
||||
;;
|
||||
-g | --ghidra)
|
||||
GHIDRA="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h | --help)
|
||||
echo -e "GhidRust install script"
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
failure "Invalid arguments provided"
|
||||
echo -e ""
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
--) shift;
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$GHIDRA" ]
|
||||
then
|
||||
failure "Required arguments not provided"
|
||||
echo -e ""
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
status "Building GhidRust"
|
||||
|
||||
gradle -PGHIDRA_INSTALL_DIR="$GHIDRA"
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failure "Build command failed"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
success "Build successful"
|
||||
|
||||
if [ "$INSTALL" -eq "0" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
status "Installing GhidRust"
|
||||
|
||||
sudo cp dist/* "$GHIDRA"/Extensions/Ghidra
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failure "Installation failed"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
success "Installation successful"
|
||||
|
||||
status "Next steps"
|
||||
|
||||
echo -e "\t 1. Open Ghidra"
|
||||
echo -e "\t 2. Go to File -> Install Extensions"
|
||||
echo -e "\t 3. Tick the checkbox beside GhidRust"
|
||||
echo -e "\t 4. Restart Ghidra"
|
6
certification.manifest
Normal file
6
certification.manifest
Normal file
@ -0,0 +1,6 @@
|
||||
##VERSION: 1.0
|
||||
##MODULE IP: MIT
|
||||
Module.manifest||GHIDRA||||END|
|
||||
extension.properties||GHIDRA||||END|
|
||||
src/main/help/help/TOC_Source.xml||GHIDRA||||END|
|
||||
src/main/help/help/topics/GhidRust/help.html||GHIDRA||||END|
|
5
extension.properties
Normal file
5
extension.properties
Normal file
@ -0,0 +1,5 @@
|
||||
name=@extname@
|
||||
description=Helps in analyzing and decompiling Rust binaries.
|
||||
author=DMaroo
|
||||
createdOn=4/11/2023
|
||||
version=@extversion@
|
54
src/main/help/help/TOC_Source.xml
Normal file
54
src/main/help/help/TOC_Source.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<?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>
|
||||
<tocref id="Ghidra Functionality">
|
||||
<tocdef id="GhidRust" text="GhidRust" target="help/topics/GhidRust/help.html" />
|
||||
</tocref>
|
||||
</tocroot>
|
58
src/main/help/help/shared/Frontpage.css
Normal file
58
src/main/help/help/shared/Frontpage.css
Normal file
@ -0,0 +1,58 @@
|
||||
/* ###
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
WARNING!
|
||||
This file is copied to all help directories. If you change this file, you must copy it
|
||||
to each src/main/help/help/shared directory.
|
||||
|
||||
|
||||
Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
|
||||
px (pixel) or with no type marking.
|
||||
|
||||
*/
|
||||
|
||||
body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
|
||||
li { font-family:times new roman; font-size:14pt; }
|
||||
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
|
||||
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
|
||||
h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
|
||||
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
|
||||
|
||||
/*
|
||||
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
|
||||
way it had been done in the beginning). The net effect is that the text is indented. In
|
||||
modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
|
||||
blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
|
||||
that the 'blockquote p' definition will inherit from the first 'p' definition.
|
||||
*/
|
||||
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
|
||||
blockquote p { margin-left: 10px; }
|
||||
|
||||
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
|
||||
p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
|
||||
|
||||
/*
|
||||
We wish for a tables to have space between it and the preceding element, so that text
|
||||
is not too close to the top of the table. Also, nest the table a bit so that it is clear
|
||||
the table relates to the preceding text.
|
||||
*/
|
||||
table { margin-left: 20px; margin-top: 10px; width: 80%;}
|
||||
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
|
||||
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
|
||||
|
||||
code { color: black; font-family: courier new; font-size: 14pt; }
|
19
src/main/help/help/topics/GhidRust/help.html
Normal file
19
src/main/help/help/topics/GhidRust/help.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta http-equiv="Content-Type" content="text/html">
|
||||
|
||||
<title>GhidRust</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><a name="GhidRust_head"></a>GhidRust: Rust binary analysis extension</h1>
|
||||
|
||||
<p>// TODO documentation</p>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user