Skip to content

Commit

Permalink
update for ghidra 10.3 (#32)
Browse files Browse the repository at this point in the history
Updates Groovy and Kotlin to newer versions, and updates the CI
workflow and documentation to support Ghidra 10.3.
  • Loading branch information
goatshriek authored Jun 4, 2023
1 parent b970fb9 commit 159dba7
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 95 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
ghidra: ["10.2.3"]
ghidra: ["10.3"]
include:
- ghidra: "10.2.3"
ghidra-url: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.2.3_build/ghidra_10.2.3_PUBLIC_20230208.zip"
ghidra-sha256: "daf4d85ec1a8ca55bf766e97ec43a14b519cbd1060168e4ec45d429d23c31c38"
ghidra-filename: "ghidra_10.2.3_PUBLIC_20230208.zip"
ghidra-folder: "ghidra_10.2.3_PUBLIC"
- ghidra: "10.3"
ghidra-url: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.3_build/ghidra_10.3_PUBLIC_20230510.zip"
ghidra-sha256: "4e990af9b22be562769bb6ce5d4d609fbb45455a7a2f756167b8cdcdb75887fc"
ghidra-filename: "ghidra_10.3_PUBLIC_20230510.zip"
ghidra-folder: "ghidra_10.3_PUBLIC"

env:
GHIDRA_INSTALL_DIR: /home/runner/ghidra/${{ matrix.ghidra-folder }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [2.3.0] - 2023-06-04
### Changed
- Upgrade to Groovy 4.0.12
- Upgrade to Kotlin 1.8.21


## [2.2.0] - 2023-03-15
### Added
- Automatic class import option for all interpreters.
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ plugins {
dependencies {
implementation('org.jruby:jruby-complete:9.3.10.0')
implementation('org.clojure:clojure:1.11.1')
implementation('org.apache.groovy:groovy:4.0.9')
implementation('org.apache.groovy:groovy-groovysh:4.0.9')
testImplementation('junit:junit:4.13')
runtimeOnly('org.jetbrains.kotlin:kotlin-scripting-jsr223:1.8.10')
implementation('org.apache.groovy:groovy:4.0.12')
implementation('org.apache.groovy:groovy-groovysh:4.0.12')
testImplementation('junit:junit:4.13.2')
runtimeOnly('org.jetbrains.kotlin:kotlin-scripting-jsr223:1.8.21')
}

test {
Expand Down
68 changes: 0 additions & 68 deletions data/auto-import.xml

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ features, or maybe even adding support for a new language, here is some
information that you will likely find useful.


## Setting Up a Development Environment
While there is documentation included with Ghidra on how to set up a plugin
development environment, there are a few unmentioned pitfalls that are worth
mentioning.

TODO: upgrade steps (deleted build directory, link to new Ghidra)


## Adding a New Language
Support for a wide variety of languages is the primary goal of Ruby Dragon. As
such, its design is optimized to make the addition of a new one as
Expand Down Expand Up @@ -62,4 +70,4 @@ two of these which you will need to provide. The first is a basics script that
does several common tasks in Ghidra. The second saves all strings that are
defined in a program to a given file. You will need to implement these two
scripts, and also add runs of them in the Github Action tests and verify their
output against an expected value.
output against an expected value.
7 changes: 7 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ or want to make a suggestion, please submit an issue on the project's
[Github page](https://github.com/goatshriek/ruby-dragon).


## 2.3.0
* [CHANGE] **Delay interpreter creation**
Currently some interpreters are created when the tool is created, which
increases startup time, often needlessly. This will be adjusted for all
interactive interpreters so that they do not load until needed.


## Unallocated to a release
* [ADD] **Complete Example Set**
A full suite of example scripts is needed for users to quickly understand how
Expand Down
1 change: 1 addition & 0 deletions ghidra_scripts/GhidraBasicsScriptRb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
FUN_00401000
FUN_00401010
Catch_All@004011b0
FUN_004011d7
FUN_004012ea
entry
FUN_00401549
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,48 @@
*/
/*
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.
The blockquote tag is used heavily to control indentation throughout the help docs. Place the
blockquote tag around other elements to create a standard indentation. The default values of
blockquote are:
blockquote {
display: block;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 40px;
margin-right: 40px;
}
*/


/*
Add some indentation for lists to show their relation to the preceding text. The value is
chosen based on the left margin of the body and the blockquote.
*/
ul { margin-left: 50px; }
ol { margin-left: 50px; }
li { font-family:times new roman; font-size:14pt; margin-left: 5px; }


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; }
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; }
h5 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:12pt; font-style:italic; }


/*
A class to be used for showing screenshot style images. These images will have padding above
and below the image and will be centered. To apply this to a file path, use this syntax:
<DIV class="image"><IMG src="..." /></DIV>
*/
div.image { margin-top: 20px; margin-bottom: 40px; text-align: center; }



/*
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
Expand All @@ -40,11 +67,10 @@ h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size
*/
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; }
p.image { margin-top: 100; margin-bottom: 100; }


/*
We wish for a tables to have space between it and the preceding element, so that text
Expand All @@ -55,6 +81,8 @@ 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-like formatting for things such as file system paths and proper names of classes,
methods, etc. To apply this to a file path, use this syntax:
Expand Down
2 changes: 1 addition & 1 deletion src/main/help/help/topics/Clojure/interpreter.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<META name="ProgId" content="FrontPage.Editor.Document">

<TITLE>Clojure Interpreter</TITLE>
<LINK rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

<BODY>
Expand Down
2 changes: 1 addition & 1 deletion src/main/help/help/topics/Groovy/interpreter.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<META name="ProgId" content="FrontPage.Editor.Document">

<TITLE>Groovy Interpreter</TITLE>
<LINK rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

<BODY>
Expand Down
2 changes: 1 addition & 1 deletion src/main/help/help/topics/JShell/interpreter.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<META name="ProgId" content="FrontPage.Editor.Document">

<TITLE>JShell Interpreter</TITLE>
<LINK rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

<BODY>
Expand Down
2 changes: 1 addition & 1 deletion src/main/help/help/topics/Kotlin/interpreter.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<META name="ProgId" content="FrontPage.Editor.Document">

<TITLE>Kotlin Interpreter</TITLE>
<LINK rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

<BODY>
Expand Down
2 changes: 1 addition & 1 deletion src/main/help/help/topics/Ruby/interpreter.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<META name="ProgId" content="FrontPage.Editor.Document">

<TITLE>Ruby Interpreter</TITLE>
<LINK rel="stylesheet" type="text/css" href="../../shared/Frontpage.css">
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

<BODY>
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/rubydragon/ruby/RubyGhidraInterpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;

import org.jdom.JDOMException;
import org.jruby.embed.EvalFailedException;
import org.jruby.embed.LocalContextScope;
import org.jruby.embed.LocalVariableBehavior;
import org.jruby.embed.ScriptingContainer;
Expand Down Expand Up @@ -68,7 +69,13 @@ public class RubyGhidraInterpreter extends ScriptableGhidraInterpreter {
// we also have to skip Data because it generates deprecation warnings
if (!className.equals("Data") && container.get(className) == null) {
String importStatement = "java_import Java::" + packageName + "." + className;
container.runScriptlet(importStatement);
try {
container.runScriptlet(importStatement);
} catch (EvalFailedException e) {
String evalError = "could not load class " + packageName + "." + className + ": "
+ e.getMessage() + "\n";
container.getError().append(evalError);
}
}
});
} catch (JDOMException | IOException e) {
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/expected/GhidraBasicsScript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ FUN_00401000
FUN_00401010
Catch_All@004011b0
FUN_004011d0
FUN_004011d7
FUN_00401230
FUN_004012a0
FUN_004012ea
Expand Down Expand Up @@ -54,6 +55,7 @@ FUN_00401af5
FUN_00401b44
FUN_00401b9a
FUN_00401ba2
FUN_00401bce
__SEH_prolog4
__except_handler4
FUN_00401c74
Expand Down

0 comments on commit 159dba7

Please sign in to comment.