diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 086a5f9..b80b080 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6872cc9..7d69789 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/build.gradle b/build.gradle index 88b1cfc..5839d59 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/data/auto-import.xml b/data/auto-import.xml index 0dab90f..663e1c9 100644 --- a/data/auto-import.xml +++ b/data/auto-import.xml @@ -453,31 +453,6 @@ ghidra.app.plugin.debug.dbtableStringColumnAdapter ghidra.app.plugin.debug.propertymanagerPropertyManagerPlugin ghidra.app.plugin.debug.propertymanagerPropertyManagerProvider - ghidra.app.plugin.exceptionhandlers.gccDwarfDecodeContext - ghidra.app.plugin.exceptionhandlers.gccDwarfDecoderFactory - ghidra.app.plugin.exceptionhandlers.gccDwarfEHDataApplicationMode - ghidra.app.plugin.exceptionhandlers.gccDwarfEHDataDecodeFormat - ghidra.app.plugin.exceptionhandlers.gccDwarfEHDecoder - ghidra.app.plugin.exceptionhandlers.gccGccAnalysisClass - ghidra.app.plugin.exceptionhandlers.gccGccAnalysisUtils - ghidra.app.plugin.exceptionhandlers.gccGccExceptionAnalyzer - ghidra.app.plugin.exceptionhandlers.gccRegionDescriptor - ghidra.app.plugin.exceptionhandlers.gcc.datatypeAbstractLeb128DataType - ghidra.app.plugin.exceptionhandlers.gcc.datatypeDwarfEncodingModeDataType - ghidra.app.plugin.exceptionhandlers.gcc.datatypePcRelative31AddressDataType - ghidra.app.plugin.exceptionhandlers.gcc.datatypeSignedLeb128DataType - ghidra.app.plugin.exceptionhandlers.gcc.datatypeUnsignedLeb128DataType - ghidra.app.plugin.exceptionhandlers.gcc.sectionsCieSource - ghidra.app.plugin.exceptionhandlers.gcc.sectionsDebugFrameSection - ghidra.app.plugin.exceptionhandlers.gcc.sectionsEhFrameHeaderSection - ghidra.app.plugin.exceptionhandlers.gcc.sectionsEhFrameSection - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDAActionRecord - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDAActionTable - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDACallSiteRecord - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDACallSiteTable - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDAHeader - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDATable - ghidra.app.plugin.exceptionhandlers.gcc.structures.gccexcepttableLSDATypeTable ghidra.app.scriptAskDialog ghidra.app.scriptGatherParamPanel ghidra.app.scriptGhidraScript @@ -535,7 +510,6 @@ ghidra.app.servicesMarkerSet ghidra.app.servicesMemorySearchService ghidra.app.servicesNavigationHistoryService - ghidra.app.servicesProgramCoordinator ghidra.app.servicesProgramLocationPair ghidra.app.servicesProgramManager ghidra.app.servicesProgramTreeService @@ -630,20 +604,6 @@ ghidra.app.util.demanglerDemangler ghidra.app.util.demanglerDemanglerOptions ghidra.app.util.demanglerDemanglerUtil - ghidra.app.util.exporterAbstractLoaderExporter - ghidra.app.util.exporterAsciiExporter - ghidra.app.util.exporterBinaryExporter - ghidra.app.util.exporterCppExporter - ghidra.app.util.exporterElfExporter - ghidra.app.util.exporterExporter - ghidra.app.util.exporterExporterException - ghidra.app.util.exporterGzfExporter - ghidra.app.util.exporterHtmlExporter - ghidra.app.util.exporterIntelHexExporter - ghidra.app.util.exporterPeExporter - ghidra.app.util.exporterProjectArchiveExporter - ghidra.app.util.exporterStringComparer - ghidra.app.util.exporterXmlExporter ghidra.app.util.headlessAnalyzeHeadless ghidra.app.util.headlessGhidraScriptRunner ghidra.app.util.headlessHeadlessAnalyzer @@ -675,17 +635,6 @@ ghidra.app.util.html.diffDataTypeDiffBuilder ghidra.app.util.html.diffDataTypeDiffInput ghidra.app.util.html.diffDiffLines - ghidra.app.util.importerAutoImporter - ghidra.app.util.importerCsHintLoadSpecChooser - ghidra.app.util.importerLcsHintLoadSpecChooser - ghidra.app.util.importerLibrarySearchPathManager - ghidra.app.util.importerLoadSpecChooser - ghidra.app.util.importerLoaderArgsOptionChooser - ghidra.app.util.importerMessageLog - ghidra.app.util.importerMultipleProgramsException - ghidra.app.util.importerMultipleProgramsStrategy - ghidra.app.util.importerOptionChooser - ghidra.app.util.importerSingleLoaderFilter ghidra.app.util.navigationGoToAddressLabelDialog ghidra.app.util.navigationGoToQuery ghidra.app.util.navigationGoToServiceImpl @@ -756,7 +705,6 @@ ghidra.app.util.xmlProgramXmlMgr ghidra.app.util.xmlXMLErrorHandler ghidra.app.util.xmlXmlProgramOptions - ghidra.base.actionsHorizontalRuleAction ghidra.base.helpGhidraHelpService ghidra.base.projectGhidraProject ghidra.base.widgets.table.constraint.providerAddressBasedLocationColumnTypeMapper @@ -850,7 +798,6 @@ ghidra.framework.mainFrontEndProjectDataNewFolderAction ghidra.framework.mainFrontEndService ghidra.framework.mainFrontEndTool - ghidra.framework.mainGetVersionedObjectTask ghidra.framework.mainGhidraApplicationInformationDisplayFactory ghidra.framework.mainLogPanel ghidra.framework.mainOpenVersionedFileDialog @@ -973,7 +920,6 @@ ghidra.framework.main.projectdata.actionsVersionControlViewCheckOutAction ghidra.framework.modelAbortedTransactionListener ghidra.framework.modelChangeSet - ghidra.framework.modelDefaultToolChangeListener ghidra.framework.modelDomainFile ghidra.framework.modelDomainFileFilter ghidra.framework.modelDomainFolder @@ -1003,7 +949,6 @@ ghidra.framework.modelToolServices ghidra.framework.modelToolSet ghidra.framework.modelToolTemplate - ghidra.framework.modelTransaction ghidra.framework.modelTransactionListener ghidra.framework.modelUndoable ghidra.framework.modelUndoableDomainObject @@ -1269,8 +1214,6 @@ ghidra.pcode.emulateInstructionDecodeException ghidra.pcode.emulateUnimplementedCallOtherException ghidra.pcode.emulateUnimplementedInstructionException - ghidra.pcode.emulate.callotherCountLeadingOnesOpBehavior - ghidra.pcode.emulate.callotherCountLeadingZerosOpBehavior ghidra.pcode.emulate.callotherOpBehaviorOther ghidra.pcode.emulate.callotherOpBehaviorOtherNOP ghidra.pcode.errorLowlevelError @@ -1427,7 +1370,6 @@ ghidra.program.database.dataPointerTypedefInspector ghidra.program.database.dataProgramBasedDataTypeManagerDB ghidra.program.database.dataProgramDataTypeManager - ghidra.program.database.dataProjectDataTypeManager ghidra.program.database.dataSourceArchiveDB ghidra.program.database.dataSourceArchiveUpgradeMap ghidra.program.database.externalExternalLocationDB @@ -1511,7 +1453,6 @@ ghidra.program.database.utilIndexedAddressIterator ghidra.program.database.utilNotQuery ghidra.program.database.utilOrQuery - ghidra.program.database.utilProgramTransaction ghidra.program.database.utilQuery ghidra.program.database.utilQueryRecordIterator ghidra.program.database.utilRecordFilter @@ -2169,7 +2110,6 @@ ghidra.program.utilDiffUtility ghidra.program.utilDiscoverableAddressCorrelator ghidra.program.utilDividerLocation - ghidra.program.utilELFExternalSymbolResolver ghidra.program.utilEolCommentFieldLocation ghidra.program.utilEquateInfo ghidra.program.utilEquateOperandFieldLocation @@ -2304,7 +2244,6 @@ ghidra.service.graphLayoutAlgorithmNames ghidra.service.graphVertexGraphActionContext ghidra.service.graphVertexShape - ghidra.utilBeginningOfLineAction ghidra.utilBigEndianDataConverter ghidra.utilBoundedInputStream ghidra.utilBrowserLoader @@ -2316,10 +2255,7 @@ ghidra.utilDataConverter ghidra.utilDateUtils ghidra.utilDefaultErrorLogger - ghidra.utilDeleteToEndOfWordAction - ghidra.utilDeleteToStartOfWordAction ghidra.utilDisposable - ghidra.utilEndOfLineAction ghidra.utilErrorDisplay ghidra.utilErrorLogger ghidra.utilFilterTransformer @@ -2354,20 +2290,16 @@ ghidra.utilNamingUtilities ghidra.utilNotOwnerException ghidra.utilNullOutputStream - ghidra.utilNumberUtil ghidra.utilNumericUtilities ghidra.utilObjectStorage ghidra.utilObjectStorageStreamAdapter ghidra.utilPrivateSaveable ghidra.utilPropertyFile ghidra.utilReadOnlyException - ghidra.utilReservedKeyBindings ghidra.utilReversedListIterator ghidra.utilSaveable ghidra.utilSaveableColor ghidra.utilSaveablePoint - ghidra.utilSelectBeginningOfLineAction - ghidra.utilSelectEndOfLineAction ghidra.utilSignednessFormatMode ghidra.utilStatusListener ghidra.utilStringFormat diff --git a/docs/development.md b/docs/development.md index bd3f6d1..45ccda0 100644 --- a/docs/development.md +++ b/docs/development.md @@ -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 @@ -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. \ No newline at end of file +output against an expected value. diff --git a/docs/roadmap.md b/docs/roadmap.md index ef142b5..f3ebfde 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -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 diff --git a/ghidra_scripts/GhidraBasicsScriptRb.rb b/ghidra_scripts/GhidraBasicsScriptRb.rb index fff2c77..2a3da8a 100644 --- a/ghidra_scripts/GhidraBasicsScriptRb.rb +++ b/ghidra_scripts/GhidraBasicsScriptRb.rb @@ -96,6 +96,7 @@ FUN_00401000 FUN_00401010 Catch_All@004011b0 +FUN_004011d7 FUN_004012ea entry FUN_00401549 diff --git a/src/main/help/help/shared/Frontpage.css b/src/main/help/help/shared/DefaultStyle.css similarity index 70% rename from src/main/help/help/shared/Frontpage.css rename to src/main/help/help/shared/DefaultStyle.css index b847166..4e712f3 100644 --- a/src/main/help/help/shared/Frontpage.css +++ b/src/main/help/help/shared/DefaultStyle.css @@ -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.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 @@ -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 @@ -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: diff --git a/src/main/help/help/topics/Clojure/interpreter.html b/src/main/help/help/topics/Clojure/interpreter.html index 06a81f4..d23a45d 100644 --- a/src/main/help/help/topics/Clojure/interpreter.html +++ b/src/main/help/help/topics/Clojure/interpreter.html @@ -10,7 +10,7 @@ Clojure Interpreter - + diff --git a/src/main/help/help/topics/Groovy/interpreter.html b/src/main/help/help/topics/Groovy/interpreter.html index 993b721..1e8627d 100644 --- a/src/main/help/help/topics/Groovy/interpreter.html +++ b/src/main/help/help/topics/Groovy/interpreter.html @@ -10,7 +10,7 @@ Groovy Interpreter - + diff --git a/src/main/help/help/topics/JShell/interpreter.html b/src/main/help/help/topics/JShell/interpreter.html index 8f37406..fefffa8 100644 --- a/src/main/help/help/topics/JShell/interpreter.html +++ b/src/main/help/help/topics/JShell/interpreter.html @@ -10,7 +10,7 @@ JShell Interpreter - + diff --git a/src/main/help/help/topics/Kotlin/interpreter.html b/src/main/help/help/topics/Kotlin/interpreter.html index baeb1f9..73d70c6 100644 --- a/src/main/help/help/topics/Kotlin/interpreter.html +++ b/src/main/help/help/topics/Kotlin/interpreter.html @@ -10,7 +10,7 @@ Kotlin Interpreter - + diff --git a/src/main/help/help/topics/Ruby/interpreter.html b/src/main/help/help/topics/Ruby/interpreter.html index 9d4395b..851c281 100644 --- a/src/main/help/help/topics/Ruby/interpreter.html +++ b/src/main/help/help/topics/Ruby/interpreter.html @@ -10,7 +10,7 @@ Ruby Interpreter - + diff --git a/src/main/java/rubydragon/ruby/RubyGhidraInterpreter.java b/src/main/java/rubydragon/ruby/RubyGhidraInterpreter.java index 7c31e46..0dfe776 100644 --- a/src/main/java/rubydragon/ruby/RubyGhidraInterpreter.java +++ b/src/main/java/rubydragon/ruby/RubyGhidraInterpreter.java @@ -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; @@ -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) { diff --git a/src/test/resources/expected/GhidraBasicsScript.txt b/src/test/resources/expected/GhidraBasicsScript.txt index 54fedb5..96cd1bb 100644 --- a/src/test/resources/expected/GhidraBasicsScript.txt +++ b/src/test/resources/expected/GhidraBasicsScript.txt @@ -17,6 +17,7 @@ FUN_00401000 FUN_00401010 Catch_All@004011b0 FUN_004011d0 +FUN_004011d7 FUN_00401230 FUN_004012a0 FUN_004012ea @@ -54,6 +55,7 @@ FUN_00401af5 FUN_00401b44 FUN_00401b9a FUN_00401ba2 +FUN_00401bce __SEH_prolog4 __except_handler4 FUN_00401c74