Skip to content

Commit

Permalink
update jruby and ghidra versions (#15)
Browse files Browse the repository at this point in the history
Update to the latest versions of JRuby (9.3.2.0) and Ghidra (10.1.1).
  • Loading branch information
goatshriek authored Jan 6, 2022
1 parent 464b60f commit 4a38a49
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 24 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: "ubuntu-latest"
strategy:
matrix:
ghidra: ["9.2.4", "10.0.4"]
ghidra: ["9.2.4", "10.0.4", "10.1.1"]
include:
- ghidra: "9.2.4"
ghidra-url: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_9.2.4_build/ghidra_9.2.4_PUBLIC_20210427.zip"
Expand All @@ -24,6 +24,11 @@ jobs:
ghidra-sha256: "1ce9bdf2d7f6bdfe5dccd06da828af31bc74acfd800f71ade021d5211e820d5e"
ghidra-filename: "ghidra_10.0.4_PUBLIC_20210928.zip"
ghidra-folder: "ghidra_10.0.4_PUBLIC"
- ghidra: "10.1.1"
ghidra-url: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.1.1_build/ghidra_10.1.1_PUBLIC_20211221.zip"
ghidra-sha256: "d4ee61ed669cec7e20748462f57f011b84b1e8777b327704f1646c0d47a5a0e8"
ghidra-filename: "ghidra_10.1.1_PUBLIC_20211221.zip"
ghidra-folder: "ghidra_10.1.1_PUBLIC"

env:
GHIDRA_INSTALL_DIR: /home/runner/ghidra/${{ matrix.ghidra-folder }}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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).


## [1.0.3] - 2022-01-05
### Changed
- Upgrade to Jruby 9.3.2.0 (Ruby 2.6.8)


## [1.0.2] - 2021-10-03
### Fixed
- Expand class lookup warning to also appear for Ghidra 10.0.4.
Expand Down
41 changes: 20 additions & 21 deletions data/launch.properties → data/10_1_1_launch.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ VMARGS_LINUX=-Dawt.useSystemAAFontSettings=on
VMARGS_WINDOWS=-Dsun.java2d.d3d=false

# The Ghidra application establishes the default SSLContext for all
# secure client connections based upon Java's default TLS protocol enablement.
# Setting this property will restrict the enabled TLS protocol versions for
# secure client connections based upon Java's default TLS protocol enablement.
# Setting this property will restrict the enabled TLS protocol versions for
# all secure network connections. Specifying multiple protocols must be
# comma-separated (e.g., TLSv1.2,TLSv1.3). See https://java.com/en/configure_crypto.html
# comma-separated (e.g., TLSv1.2,TLSv1.3). See https://java.com/en/configure_crypto.html
# for details on configuring Java's cryptographic algorithms.
VMARGS=-Djdk.tls.client.protocols=TLSv1.2,TLSv1.3

Expand All @@ -37,14 +37,14 @@ VMARGS=-Djdk.tls.client.protocols=TLSv1.2,TLSv1.3
# VMARGS=-Dghidra.cacerts=

# The following property will limit the number of processor cores that Ghidra
# will use for thread pools. If not specified, it will use the default number
# of processors returned from Runtime.getRuntime().getAvailableProcessors().
# Otherwise, it will use the min of the value returned from Runtime and the
# will use for thread pools. If not specified, it will use the default number
# of processors returned from Runtime.getRuntime().getAvailableProcessors().
# Otherwise, it will use the min of the value returned from Runtime and the
# value specified by the following property.
VMARGS=-Dcpu.core.limit=

# The following property is a way to exactly specify the number of processor
# cores that Ghidra will use for thread pools. Note: this will supersede the
# The following property is a way to exactly specify the number of processor
# cores that Ghidra will use for thread pools. Note: this will supersede the
# above 'cpu.core.limit' value if it is set.
VMARGS=-Dcpu.core.override=

Expand All @@ -55,7 +55,7 @@ VMARGS=-Dfont.size.override=
VMARGS=-Dpython.console.encoding=UTF-8

# Eclipse on macOS can have file locking issues if the user home directory is networked. Therefore,
# we will disable file locking by default for macOS. Comment the following line out if Eclipse file
# we will disable file locking by default for macOS. Comment the following line out if Eclipse file
# locking is needed and known to work.
VMARGS_MACOS=-Declipse.filelock.disable=true

Expand All @@ -65,32 +65,31 @@ VMARGS_MACOS=-Dapple.laf.useScreenMenuBar=false
# Prevent log4j from using the Jansi DLL on Windows.
VMARGS_WINDOWS=-Dlog4j.skipJansi=true

# Custom class loader usage forces class data sharing to be disabled which produces a warning.
# Custom class loader usage forces class data sharing to be disabled which produces a warning.
# Ghidra does not use class data sharing, so explicitly turn it off to avoid the warning.
VMARGS=-Xshare:off

# Permit "illegal reflective accesses" to enable JDK compatibility with Ghidra and 3rd party jars.
VMARGS=--add-opens java.base/java.lang=ALL-UNNAMED
VMARGS=--add-opens java.base/java.util=ALL-UNNAMED
VMARGS=--add-opens java.base/java.net=ALL-UNNAMED
VMARGS=--add-opens=java.base/java.lang=ALL-UNNAMED
VMARGS=--add-opens=java.base/java.util=ALL-UNNAMED
VMARGS=--add-opens=java.base/java.net=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.file=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.ftp=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.http=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.jar=ALL-UNNAMED
VMARGS=--add-opens java.desktop/sun.awt.image=ALL-UNNAMED
VMARGS_LINUX=--add-opens java.desktop/sun.awt.X11=ALL-UNNAMED
VMARGS=--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED

# Persistent cache directory used by the application. This directory will be used to store
# persistent application caches for all users. The default location for Mac/Linux is the same as
# specified by java.io.tmpdir property. The default location for Windows corresponds to the
# Persistent cache directory used by the application. This directory will be used to store
# persistent application caches for all users. The default location for Mac/Linux is the same as
# specified by java.io.tmpdir property. The default location for Windows corresponds to the
# application local settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
# directory with more storage or avoid system cleanups, it may be desirable to override the default
# directory with more storage or avoid system cleanups, it may be desirable to override the default
# location.
#VMARGS=-Dapplication.cachedir=

# Temporary directory used by the application. This directory will be used for all temporary files
# and may also be used for the persistent user cache directory <java.io.tmpdir>/<username>-Ghidra.
# Temporary directory used by the application. This directory will be used for all temporary files
# and may also be used for the persistent user cache directory <java.io.tmpdir>/<username>-Ghidra.
# The specified directory must exist and have appropriate read/write/execute permissions
#VMARGS=-Djava.io.tmpdir=

Expand Down
108 changes: 108 additions & 0 deletions data/10_1_launch.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Force Ghidra's Java home instead of trying to figure it out automatically.
# If the provided path does not point to a supported Java home that Ghidra
# supports, this property is ignored.
# NOTE: Ghidra requires a JDK to launch.
JAVA_HOME_OVERRIDE=

# Required Ghidra class loader
VMARGS=-Djava.system.class.loader=ghidra.GhidraClassLoader

# Set default encoding to UTF8
VMARGS=-Dfile.encoding=UTF8

# Set locale (only en_US is supported)
VMARGS=-Duser.country=US
VMARGS=-Duser.language=en
VMARGS=-Duser.variant=

# The following options affect rendering on different platforms. It may be necessary to play
# with these settings to get Ghidra to display and perform optimally on HiDPI monitors or in VM's.
VMARGS=-Dsun.java2d.opengl=false
VMARGS_LINUX=-Dsun.java2d.pmoffscreen=false
VMARGS_LINUX=-Dsun.java2d.xrender=true
VMARGS_LINUX=-Dsun.java2d.uiScale=1
VMARGS_LINUX=-Dawt.useSystemAAFontSettings=on
VMARGS_WINDOWS=-Dsun.java2d.d3d=false

# The Ghidra application establishes the default SSLContext for all
# secure client connections based upon Java's default TLS protocol enablement.
# Setting this property will restrict the enabled TLS protocol versions for
# all secure network connections. Specifying multiple protocols must be
# comma-separated (e.g., TLSv1.2,TLSv1.3). See https://java.com/en/configure_crypto.html
# for details on configuring Java's cryptographic algorithms.
VMARGS=-Djdk.tls.client.protocols=TLSv1.2,TLSv1.3

# Force PKI server authentication of all HTTPS and Ghidra Server connections by
# specifying path to installed CA certificates file.
# VMARGS=-Dghidra.cacerts=

# The following property will limit the number of processor cores that Ghidra
# will use for thread pools. If not specified, it will use the default number
# of processors returned from Runtime.getRuntime().getAvailableProcessors().
# Otherwise, it will use the min of the value returned from Runtime and the
# value specified by the following property.
VMARGS=-Dcpu.core.limit=

# The following property is a way to exactly specify the number of processor
# cores that Ghidra will use for thread pools. Note: this will supersede the
# above 'cpu.core.limit' value if it is set.
VMARGS=-Dcpu.core.override=

# Default font size for many java swing elements.
VMARGS=-Dfont.size.override=

# Set Jython console encoding (prevents a console error)
VMARGS=-Dpython.console.encoding=UTF-8

# Eclipse on macOS can have file locking issues if the user home directory is networked. Therefore,
# we will disable file locking by default for macOS. Comment the following line out if Eclipse file
# locking is needed and known to work.
VMARGS_MACOS=-Declipse.filelock.disable=true

# Where the menu bar is displayed on macOS
VMARGS_MACOS=-Dapple.laf.useScreenMenuBar=false

# Prevent log4j from using the Jansi DLL on Windows.
VMARGS_WINDOWS=-Dlog4j.skipJansi=true

# Custom class loader usage forces class data sharing to be disabled which produces a warning.
# Ghidra does not use class data sharing, so explicitly turn it off to avoid the warning.
VMARGS=-Xshare:off

# Permit "illegal reflective accesses" to enable JDK compatibility with Ghidra and 3rd party jars.
VMARGS=--add-opens=java.base/java.lang=ALL-UNNAMED
VMARGS=--add-opens=java.base/java.util=ALL-UNNAMED
VMARGS=--add-opens=java.base/java.net=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.file=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.ftp=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.http=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED
VMARGS=--add-opens java.base/sun.net.www.protocol.jar=ALL-UNNAMED
VMARGS=--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED

# Persistent cache directory used by the application. This directory will be used to store
# persistent application caches for all users. The default location for Mac/Linux is the same as
# specified by java.io.tmpdir property. The default location for Windows corresponds to the
# application local settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
# directory with more storage or avoid system cleanups, it may be desirable to override the default
# location.
#VMARGS=-Dapplication.cachedir=

# Temporary directory used by the application. This directory will be used for all temporary files
# and may also be used for the persistent user cache directory <java.io.tmpdir>/<username>-Ghidra.
# The specified directory must exist and have appropriate read/write/execute permissions
#VMARGS=-Djava.io.tmpdir=

# Disable alternating row colors in tables
#VMARGS=-Ddisable.alternating.row.colors=true

# The ContinuesInterceptor allows the import process to proceed if parsing corrupted headers
# generates uncaught exceptions. Its usage has been deprecated and will be removed in a future
# release of Ghidra. It is disabled by default.
#VMARGS=-DContinuesInterceptor.enabled=true

# Limit on XML parsing. See https://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html
#VMARGS=-Djdk.xml.totalEntitySizeLimit=50000000

# Enables Pdb debug logging during import and analysis to .ghidra/.ghidra_ver/pdb.analyzer.log
#VMARGS=-Dpdb.logging=true
Binary file not shown.
4 changes: 2 additions & 2 deletions src/main/java/rubydragon/ruby/RubyDragonPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ public void init() {
console = getTool().getService(InterpreterPanelService.class).createInterpreterPanel(this, false);
interpreter = new RubyGhidraInterpreter(console);
console.addFirstActivationCallback(() -> {
List<String> brokenVersions = Arrays.asList("10.0.3", "10.0.4");
List<String> brokenVersions = Arrays.asList("10.0.3", "10.0.4", "10.1", "10.1.1");
String ghidraVersion = Application.getApplicationVersion();
if (brokenVersions.contains(ghidraVersion)) {
PrintWriter errWriter = new PrintWriter(console.getStdErr());
errWriter.print("RubyDragon may have problems running in this "
+ "version of Ghidra. If you receive errors regarding class lookup "
+ "failures, you may need to replace the launch.properties "
+ "file in the support directory of the Ghidra install "
+ "with the one in this plugin (in the "
+ "with the appropriate one in this plugin (in the "
+ "Extensions/RubyDragon/data directory in your Ghidra install).\n");
errWriter.flush();
}
Expand Down
91 changes: 91 additions & 0 deletions src/test/resources/expected/10.1.1-GhidraBasicsScriptClj.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
Program Info:
HelloGhidra.exe x86:LE:32:default (windows)

Memory Layout:
Imagebase: 0x400000
Headers [start: 0x00400000, end:0x004003ff]
.text [start: 0x00401000, end:0x00401fff]
.rdata [start: 0x00402000, end:0x00402fff]
.data [start: 0x00403000, end:0x004031ff]
.data [start: 0x00403200, end:0x00403387]
.rsrc [start: 0x00404000, end:0x004041ff]
.reloc [start: 0x00405000, end:0x004051ff]

Function List:
FUN_00401000
FUN_00401010
Catch_All@004011b0
FUN_004012ea
entry
FUN_00401549
FUN_00401571
find_pe_section
___scrt_acquire_startup_lock
___scrt_initialize_crt
___scrt_initialize_onexit_tables
___scrt_is_nonwritable_in_current_image
___scrt_release_startup_lock
___scrt_uninitialize_crt
__onexit
_atexit
___get_entropy
___security_init_cookie
FUN_00401954
FUN_00401957
FUN_0040195b
FUN_00401961
FUN_0040196d
FUN_00401970
_guard_check_icall
FUN_00401994
FUN_0040199a
FUN_004019a0
FUN_004019bd
FUN_004019c9
FUN_004019cf
FUN_004019d5
thunk_FUN_00401954
FUN_00401af5
FUN_00401b44
FUN_00401b9a
FUN_00401ba2
__SEH_prolog4
__except_handler4
FUN_00401c74
___scrt_is_ucrt_dll_in_use
Unwind@00401e57
__current_exception
__current_exception_context
memset
_except_handler4_common
_seh_filter_exe
_set_app_type
__setusermatherr
_configure_narrow_argv
_initialize_narrow_environment
_get_initial_narrow_environment
_initterm
_initterm_e
exit
_exit
_set_fmode
__p___argc
__p___argv
_cexit
_c_exit
_register_thread_local_exe_atexit_callback
_configthreadlocale
__p__commode
_initialize_onexit_table
_register_onexit_function
_crt_atexit
_controlfp_s
terminate
__filter_x86_sse2_floating_point_exception_default
Unwind@00401f80
Unwind@00401f88

Current Location: 0x4194304

You entered 'HeadlessTest'

Loading

0 comments on commit 4a38a49

Please sign in to comment.