diff --git a/.gitattributes b/.gitattributes index 04b1ff2926..3b556a8b3a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,53 +3,79 @@ # Explicitly declare text files you want to always be normalized and converted # to native line endings on checkout. -*.java text -*.gradle text -*.manifest text +*.bash text +*.c text +*.cc text +*.command text +*.cpp text +*.cspec text *.css text +*.gradle text +*.groovy text +*.h text +*.hh text *.htm text *.html text +*.java text +*.jj text *.js text *.json text *.jsp text *.jspf text *.jspx text +*.l text +*.lang text +*.ldefs text +*.manifest text +*.opinion text +*.props text *.properties text -*.tld text -*.txt text +*.proto text +*.pspec text +*.py text +*.rxg text +*.sh text +*.sla text *.tag text +*.tld text +*.tool text +*.trans text +*.txt text *.xml text -*.c text -*.h text -*.cpp text -*.hh text -*.cc text +*.y text # Declare files that will always have CRLF line endings on checkout. +*.bat text eol=crlf *.sln text eol=crlf *.vcproj text eol=crlf *.vcxproj text eol=crlf -*.bat text eol=crlf # Denote all files that are truly binary and should not be modified. -*.png binary -*.jpg binary +*.a binary +*.apk binary +*.bmp binary *.class binary *.dll binary +*.dmg binary *.ear binary -*.gif binary -*.ico binary -*.jar binary -*.jpeg binary -*.so binary -*.war binary -*.pdf binary *.exe binary -*.lib binary -*.sa binary +*.gdt binary +*.gif binary *.gz binary *.gzf binary -*.tgz binary +*.ico binary +*.ipsw binary +*.jar binary +*.jpeg binary +*.jpg binary +*.lib binary +*.o binary +*.obj binary +*.pdf binary +*.png binary +*.sa binary +*.so binary *.tar binary -*.sh binary - +*.tgz binary +*.war binary +*.zip binary diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 385782a424..2882356cb6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -29,7 +29,8 @@ If applicable, please attach any files that caused problems or log files generat **Environment (please complete the following information):** - OS: [e.g. macOS 10.14.2] - Java Version: [e.g. 11.0] - - Ghidra Version: [e.g. 9.0] + - Ghidra Version: [e.g. 9.1.2] + - Ghidra Origin: [e.g. official ghidra-sre.org distro, third party distro, locally built] **Additional context** Add any other context about the problem here. diff --git a/GPL/CabExtract/build.gradle b/GPL/CabExtract/build.gradle index 95b36dd4d4..46994edbc7 100644 --- a/GPL/CabExtract/build.gradle +++ b/GPL/CabExtract/build.gradle @@ -1,3 +1,6 @@ +/* ### + * IP: Public Domain + */ apply from: file("../gpl.gradle").getCanonicalPath() if (findProject(':Generic') != null) { @@ -57,4 +60,4 @@ if (['linux64', 'osx64'].contains(currentPlatform)) { delete file("build/unpack/${cabextract}") } } -} \ No newline at end of file +} diff --git a/GPL/CabExtract/certification.manifest b/GPL/CabExtract/certification.manifest index d63ae0e1ac..aa851666c6 100644 --- a/GPL/CabExtract/certification.manifest +++ b/GPL/CabExtract/certification.manifest @@ -2,6 +2,4 @@ ##MODULE IP: GPL 3 ##MODULE IP: Public Domain Module.manifest||Public Domain||||END| -build.gradle||Public Domain||||END| data/cabextract-1.6.tar.gz||GPL 3||||END| -settings.gradle||Public Domain||||END| diff --git a/GPL/CabExtract/settings.gradle b/GPL/CabExtract/settings.gradle index e69de29bb2..1092a7aaab 100644 --- a/GPL/CabExtract/settings.gradle +++ b/GPL/CabExtract/settings.gradle @@ -0,0 +1,3 @@ +/* ### + * IP: Public Domain + */ diff --git a/GPL/DMG/build.gradle b/GPL/DMG/build.gradle index d66cd2d0f2..690d55e941 100644 --- a/GPL/DMG/build.gradle +++ b/GPL/DMG/build.gradle @@ -1,3 +1,6 @@ +/* ### + * IP: Public Domain + */ apply from: file("../gpl.gradle").getCanonicalPath() if (findProject(':Generic') != null) { diff --git a/GPL/DMG/certification.manifest b/GPL/DMG/certification.manifest index 7311651d24..d7bac0f1d3 100644 --- a/GPL/DMG/certification.manifest +++ b/GPL/DMG/certification.manifest @@ -3,7 +3,6 @@ ##MODULE IP: LGPL 2.1 ##MODULE IP: Public Domain Module.manifest||Public Domain||||END| -build.gradle||Public Domain||||END| data/lib/catacombae_csframework.jar||LGPL 2.1||||END| data/lib/catacombae_hfsx.jar||GPL 3||||END| data/lib/catacombae_hfsx_dmglib.jar||GPL 3||||END| @@ -16,4 +15,3 @@ data/os/win64/llio_amd64.dll||GPL 3||||END| data/os/win64/llio_i386.dll||GPL 3||||END| data/os/win64/llio_ia64.dll||GPL 3||||END| data/server_memory.cfg||Public Domain||||END| -settings.gradle||Public Domain||||END| diff --git a/GPL/DMG/settings.gradle b/GPL/DMG/settings.gradle index e69de29bb2..1092a7aaab 100644 --- a/GPL/DMG/settings.gradle +++ b/GPL/DMG/settings.gradle @@ -0,0 +1,3 @@ +/* ### + * IP: Public Domain + */ diff --git a/GPL/DemanglerGnu/build.gradle b/GPL/DemanglerGnu/build.gradle index 6244215680..0e9f80bb3f 100644 --- a/GPL/DemanglerGnu/build.gradle +++ b/GPL/DemanglerGnu/build.gradle @@ -1,3 +1,6 @@ +/* ### + * IP: Public Domain + */ apply from: file("../gpl.gradle").getCanonicalPath() if (findProject(':Generic') != null) { diff --git a/GPL/DemanglerGnu/certification.manifest b/GPL/DemanglerGnu/certification.manifest index f3ecf6e571..6f2767e5f8 100644 --- a/GPL/DemanglerGnu/certification.manifest +++ b/GPL/DemanglerGnu/certification.manifest @@ -5,7 +5,5 @@ ##MODULE IP: LGPL 3.0 ##MODULE IP: Public Domain Module.manifest||Public Domain||||END| -build.gradle||Public Domain||||END| -settings.gradle||Public Domain||||END| src/demangler_gnu_v2_24/README.txt||Public Domain||||END| src/demangler_gnu_v2_33_1/README.txt||Public Domain||||END| diff --git a/GPL/DemanglerGnu/settings.gradle b/GPL/DemanglerGnu/settings.gradle index e69de29bb2..1092a7aaab 100644 --- a/GPL/DemanglerGnu/settings.gradle +++ b/GPL/DemanglerGnu/settings.gradle @@ -0,0 +1,3 @@ +/* ### + * IP: Public Domain + */ diff --git a/GPL/GnuDisassembler/build.gradle b/GPL/GnuDisassembler/build.gradle index e3261bf24e..0fd000d05e 100644 --- a/GPL/GnuDisassembler/build.gradle +++ b/GPL/GnuDisassembler/build.gradle @@ -1,3 +1,6 @@ +/* ### + * IP: Public Domain + */ // If extension module does not reside within the Ghidra GPL directory, the Ghidra installation directory // must be specified either by setting the GHIDRA_INSTALL_DIR environment variable or Gradle // project property: diff --git a/GPL/GnuDisassembler/buildGdis.gradle b/GPL/GnuDisassembler/buildGdis.gradle index 2859dd073f..d145467092 100644 --- a/GPL/GnuDisassembler/buildGdis.gradle +++ b/GPL/GnuDisassembler/buildGdis.gradle @@ -1,3 +1,6 @@ +/* ### + * IP: Public Domain + */ /******************************************************************************************* * build.gradle file that applies this script must define two properties * 1) binutilsLocation - the folder where the original binutils.zip lives diff --git a/GPL/GnuDisassembler/certification.manifest b/GPL/GnuDisassembler/certification.manifest index f439b820d8..5ef30394a2 100644 --- a/GPL/GnuDisassembler/certification.manifest +++ b/GPL/GnuDisassembler/certification.manifest @@ -4,10 +4,7 @@ .project||GHIDRA||||END| Module.manifest||Public Domain||||END| README.txt||Public Domain||||END| -build.gradle||Public Domain||||END| -buildGdis.gradle||Public Domain||||END| data/arm_test1.s||Public Domain||||END| data/big.elf||Public Domain||||END| data/little.elf||Public Domain||||END| extension.properties||Public Domain||||END| -settings.gradle||Public Domain||||END| diff --git a/GPL/GnuDisassembler/settings.gradle b/GPL/GnuDisassembler/settings.gradle index e69de29bb2..1092a7aaab 100644 --- a/GPL/GnuDisassembler/settings.gradle +++ b/GPL/GnuDisassembler/settings.gradle @@ -0,0 +1,3 @@ +/* ### + * IP: Public Domain + */ diff --git a/GPL/certification.local.manifest b/GPL/certification.local.manifest index 1d8b8c1740..6f4737a251 100644 --- a/GPL/certification.local.manifest +++ b/GPL/certification.local.manifest @@ -1,5 +1,2 @@ ##VERSION: 2.0 ##MODULE IP: Public Domain -gpl.gradle||Public Domain||||END| -nativeBuildProperties.gradle||Public Domain||||END| -vsconfig.gradle||GHIDRA||||END| diff --git a/GPL/gpl.gradle b/GPL/gpl.gradle index 9428b3bdf4..4dafd461f7 100644 --- a/GPL/gpl.gradle +++ b/GPL/gpl.gradle @@ -1,4 +1,6 @@ - +/* ### + * IP: Public Domain + */ // BIN_REPO only useable in full Ghidra source configuration project.ext.BIN_REPO = file("../../../ghidra.bin").absolutePath diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle index 759e2c0ceb..36b9a07875 100644 --- a/GPL/nativeBuildProperties.gradle +++ b/GPL/nativeBuildProperties.gradle @@ -1,3 +1,6 @@ +/* ### + * IP: Public Domain + */ /**************************************************************************** * nativeBuildProperties.gradle * diff --git a/GPL/vsconfig.gradle b/GPL/vsconfig.gradle index a3e4d3c6d8..a57b7eb54a 100644 --- a/GPL/vsconfig.gradle +++ b/GPL/vsconfig.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ /**************************************************************************** * Establish Visual Studio configuration environment for Windows native builds * diff --git a/Ghidra/Configurations/Public_Release/build.gradle b/Ghidra/Configurations/Public_Release/build.gradle index 9b1f4a62db..defe20000a 100644 --- a/Ghidra/Configurations/Public_Release/build.gradle +++ b/Ghidra/Configurations/Public_Release/build.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/jacocoProject.gradle" diff --git a/Ghidra/Configurations/Public_Release/certification.manifest b/Ghidra/Configurations/Public_Release/certification.manifest index 2e4833ec30..3a50c1b4a9 100644 --- a/Ghidra/Configurations/Public_Release/certification.manifest +++ b/Ghidra/Configurations/Public_Release/certification.manifest @@ -1,6 +1,5 @@ ##VERSION: 2.0 Module.manifest||GHIDRA||||END| -build.gradle||GHIDRA||||END| data/PDB_SYMBOL_SERVER_URLS.pdburl||GHIDRA||||END| src/global/docs/ChangeHistory.html||GHIDRA||||END| src/global/docs/UserAgreement.html||GHIDRA||||END| diff --git a/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html b/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html index aabe465742..98bad04149 100644 --- a/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html +++ b/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html @@ -6,14 +6,66 @@
++Improvements
++
+- Analysis. Added check for vftable entries in
+.NEP
section and relaxed the requirement that the code must have a return. (GP-649)- Analysis. Corrected flaw in RTTI analyzer determination of size of vftables. (GP-688)
+- Basic Infrastructure. Updated TLS protocol preference to use the most preferred/recent version available to both sides of an SSL connection (e.g., TLSv1.3) instead of forcing use of TLSv1.2. (GP-622)
+- Build. Corrected build issues which had prevented users from building Ghidra on an Apple M1 (OS X, AARCH64 architecture). (GP-600, Issue #2653)
+- Demangler. Increased Gnu Demangler parsing performance by changing some regular expressions. (GP-705)
+- Eclipse Integration. Updated SleighEditor to support new endian tag on define token definitions. (GP-721)
+- GUI. Updated the Choose Data Type dialog to apply data types in the same manner as dragging types from the Data Types window. This provides users more control when choosing how to overwrite existing types. (GP-521)
+- Importer:ELF. Added support for ELF relocation
+R_X86_64_IRELATIVE
. (GP-651, Issue #1189)- Importer:ELF. Sped up loading of ELF files with large symbol tables. (GP-697)
+
+Bugs
++
+- Analysis. The RTTI analyzer now runs prior to Reference analysis so that references into vftables are not turned into code or data before the vftables are created. (GP-517)
+- API.
+Funtion.getCalledFunctions(TaskMonitor)
andFunction.getCallingFunctions(TaskMonitor)
now support passingnull
for the task monitor parameter, which previously would have thrown an exception. (GP-589, Issue #2643)- Data Types. Corrected segmented 32-bit pointer datatype address generation for 16:16 x86 far pointers. (GP-534, Issue #2548)
+- Decompiler. Fixed Decompiler issue where, when a function name extends beyond the line limit, an end-of-line comment could wrap around to additional lines without including additional
+//
comment indicators. (GP-473)- Decompiler. Corrected an exception that could occur when attempting to edit function signature from the Decompiler. (GP-597, Issue #2601)
+- Demangler. Changed return type applied to constructors by Demangler from
+void
toUndefined
, allowing the Decompiler to determine the type. (GP-790)- DWARF. Improved handling of empty DWARF compile units. (GP-743)
+- DWARF. Improved handling of DWARF function signatures when parameter info contains unsupported location opcodes or failed to resolve datatypes. (GP-794)
+- Eclipse Integration. When installing the SleighEditor into Eclipse, the plugin will now show up under the Ghidra category. Previously the Group Items by Category option had to be turned off before the SleighEditor would appear as a visible entry. (GP-564)
+- Eclipse Integration. Fixed an issue with Eclipse PyDev breakpoints not catching. (GP-668, Issue #2713)
+- Eclipse Integration. Fixed an Eclipse GhidraDev exception that occurred when creating a new Ghidra scripting project if a ~/ghidra_scripts directory did not exist. (GP-669)
+- Emulator. Replaced Java floating point emulation to fix multiple rounding issues. (GP-357, Issue #2414)
+- Graphing. Fixed issue with graph filters not updating satellite view when changing edge filters. (GP-557)
+- Graphing. Fixed Function Graph keybindings that did not work when docked in the main Code Browser window. (GP-586, Issue #2641)
+- GUI. Fixed NullPointerException due to using Go To action when there was no open program in the Listing. (GP-66)
+- GUI. Fixed bug in Reference Code Viewer options that caused an exception. (GP-620, Issue #2672)
+- Importer. Fixed exception caused when importing previously exported XML data where the bookmark override option was turned off. (GP-667)
+- Importer:ELF. Fixed a NullPointerException caused by importing an ELF with an uninitialized
+.got
section. (GP-360, Issue #2416)- Importer:ELF. Added Support for ELF
+R_ARM_MOVW_ABS_NC
andR_ARM_MOVT_ABS ELF
Relocations for ARM. (GP-555, Issue #2510)- Importer:ELF. Corrected ELF processing of
+.init_array
and.fini_array
which was incorrectly overadjusting entries for an image base change. (GP-699)- Importer:Mach-O. Corrected Mach-O fat-binary library import issue and resolved error related to unnamed Mach-O segment. (GP-652, Issue #2702)
+- Importer:Mach-O. Fixed an issue with DYLD Load Command data structures being created in the wrong locations. (GP-689, Issue #2624)
+- Importer:Mach-O. Fixed an exception that occurred when importing Mach-O files that define zero
+LC_BUILD_VERSION
tool entries. (GP-702, Issue #2192)- PDB. Fixed createPdbXmlFiles.bat to permit spaces in the path name of Ghidra installation folder and the batch argument name. (GP-575, Issue #2167)
+- PDB. Fixed PDB Universal analyzer to set the run-once flag when finished. (GP-724)
+- PDB. Changed return type applied to constructors by PDB Universal from
+void
toUndefined
, allowing the Decompiler to determine the type. (GP-791)- Processors. Added missing
+RFE
instruction in MIPS up to version R3000. (GP-33, Issue #1766)- Processors. ARM instruction
+VMUL
now decodes correctly. (GP-627, Issue #2677)- Processors. Added missing
+CFINV
instruction to AARCH64 processor specification and added definitions for locals in neon instructions. (GP-655, Issue #2710)- Scripting. Fixed analyzeHeadless
+-scriptPath
option that didn't work for Python and other non-Java scripts located in non-default directories. (GP-528, Issue #2561)- Scripting. Fixed concurrency issue with management of scripting bundle paths. (GP-576)
+- Scripting. Corrected handling for Ghidra Script files which are symlinks that were broken in Ghidra 9.2. (GP-650, Issue #2698)
+- Scripting. Fixed the analyzeHeadless
+-scriptPath
option to correctly parse$GHIDRA_HOME
and$USER_HOME
. (GP-781)
@@ -24,6 +76,7 @@Bugs
- Graphing. Fixed issue with Graph filters not working and satellite view sometimes not matching graph. (GP-526)
-- Importer:MachO. MachO DYLD cache incorrect offset use has been fixed. (GP-550, Issue ##2560)
-- Listing. Fixed issue where Edit Label action (L key) did not work on primary function symbols. (GP-537)
+- Importer:Mach-O. Mach-O DYLD cache incorrect offset use has been fixed. (GP-550, Issue #2560)
+- Listing. Fixed issue where Edit Label action (L key) did not work on primary function symbols. (GP-537)
- Multi-User. Corrected Ghidra Server build issue for version 9.2.1 which had an improperly generated classpath.frag file. Issue caused server to fail startup with a ClassNotFoundException. (GP-542)
-- Processors. The V850 JMP instruction has been corrected not to use the PC in the address calculation (GP-548, Issue #2570)
+- Processors. The V850
JMP
instruction has been corrected not to use the PC in the address calculation. (GP-548, Issue #2570)- Processors. Removed erroneous VST4 variant, most likely from a copy/paste error. This fixes the ARM Thumb BL instruction disassembly with a negative offset. (GP-549, Issue #2559)
type_info
vftable when it cannot be found with its mangled name. This will enable many more Windows programs to have their RTTI structures created that were unable to be parsed in previous Ghidra versions. (GP-141)gradle Decompiler:generateParsers
task, which still requires bison and flex, must be used, explicitly, when changes are made to lex/yacc source files. (GP-467)0x1608
and 0x1609
with presumed class and struct types and follow-on application of these types. Also fixed up some fall-back data type logic and improved some warning messages to reflect the cause of the conditions. (GP-474, Issue #2523)longlong
and double
return values. Endianess ordering of r0
/r1
was incorrect. (GP-512, Issue #2547)DUMPBIN /EXPORTS
(see Ghidra/Features/Base/data/symbols/README.txt). (GT-3235)unique
space are now always shown with the size of the access. Fixed bug which would cause the PCode emulator to reject valid pcode in rare instances. (GP-196)"Method is not Remote"
errors. (GT-3521, Issue #1440)Method is not Remote
errors. (GT-3521, Issue #1440)RSB.w
instruction. (GT-3420, Issue #1365)@@ -331,7 +384,7 @@Improvements
-
- Importer:MachO. Improved import/load time of DYLD shared cache files. (GT-3261)
+- Importer:Mach-O. Improved import/load time of DYLD shared cache files. (GT-3261)
- Program API. Cached the addresses that correspond to executable memory to improve analysis performance. (GT-3260)
-i
option. Corrected -ip
option to strictly convey remote access hostname to clients. The updated server will only accept connections from Ghidra 9.1 and later clients due to the registry port now employing TLS. (GT-2685, Issue #101, #645)GhidraScript.askDomainFile()
now correctly throws a CancelledException when the cancel button is clicked. (GT-2841)Bugs
-
- Multi-User:Ghidra Server. Corrected severe script error in svrAdmin.bat introduced with 9.0.3 build.
-- GUI. Restored the default 'p' key binding for creating pointers within the listing display.
+- Multi-User:Ghidra Server. Corrected severe script error in svrAdmin.bat introduced with 9.0.3 build. (GT-2874)
+- GUI. Restored the default 'p' key binding for creating pointers within the listing display. (GT-2854)
New Features
-
- GUI. Function tags are now viewable from Functions Window table using new column.
+- GUI. Function tags are now viewable from Functions Window table using new column. (GT-2114)
Improvements
-
- Decompiler. Improved modeling of CFG on Windows 10. (Issue #340)
-- Patcher. Renamed patch directory to /Ghidra/patch and added README.txt that explains how the patch directory is used.
-- Search. Updated the Decompiler Data Type Finder to find references to inside of nested array access in a line of Decompiler C output. (Issue #416)
-- Sleigh. Improved error reporting for SLEIGH compiler. (Issue #364)
+- Decompiler. Improved modeling of CFG on Windows 10. (GT-2755, Issue #340)
+- Patcher. Renamed patch directory to
+/Ghidra/patch and added README.txt that explains how the patch directory is used. (GT-2734) - Search. Updated the Decompiler Data Type Finder to find references inside of nested array access in a line of Decompiler C output. (GT-2756, Issue #416)
+- Sleigh. Improved error reporting for SLEIGH compiler. (GT-2820, Issue #364)
Bugs
-
- Analysis. Code that checks for thunks no longer throws an exception if the PC is not set for the processor.
-- Analysis. Made a fix to enable Apply button when changing tool options. (Issue #40)
-- Data Types. Fixed concurrent modification exception when replacing one datatype for another that results in some other datatype being renamed.
-- Decompiler. Fixed dynamic variables and equates in 16-bit x86 programs. (Issue #336)
-- Decompiler:Java. Fixed DEX decompilation regression issue. (Issue #350)
-- Eclipse Integration. Fixed exception in Eclipse GhidraDev plugin that occurred when performing certain actions on a Ghidra project that was imported from a previously exported Archive File. (Issues #283, #383)
+- Analysis. Code that checks for thunks no longer throws an exception if the PC is not set for the processor. (GT-2730)
+- Analysis. Made a fix to enable Apply button when changing tool options. (GT-2801, Issue #40)
+- Data Types. Fixed concurrent modification exception when replacing one datatype for another that results in some other datatype being renamed. (GT-2736)
+- Decompiler. Fixed dynamic variables and equates in 16-bit x86 programs. (GT-2745, Issue #336)
+- Decompiler:Java. Fixed DEX decompilation regression issue. (GT-2743, Issue #350)
+- Eclipse Integration. Fixed exception in Eclipse GhidraDev plugin that occurred when performing certain actions on a Ghidra project that was imported from a previously exported Archive File. (GT-2721, Issues #283, #383)
- GUI. Improved documentation on how to deal with HiDPI monitor issues in Linux. In the <ghidra_installation>/support/launch.properties file, change VMARGS=-Dsun.java2d.xrender from false to true.
-- Importer. Fixed an exception that occurred when batch importing APK files. (Issue #426)
-- Multi-User:Ghidra Server. Restored ability to execute svrAdmin script in development mode.
-- Processors. The 6502 Zero page indexed addressing has been corrected to only access the Zero page. (Issue #201)
-- Processors. The 68000 BCD arithmetic instructions now have pcode semantics that allow disassembly to continue. (Issue #227)
-- Search. Fixed NullPointerException in Decompiler Data Type Reference Finder. (Issue #407)
+- Importer. Fixed an exception that occurred when batch importing APK files. (GT-2767, Issue #426)
+- Multi-User:Ghidra Server. Restored ability to execute svrAdmin script in development mode. (GT-2740)
+- Processors. The 6502 Zero page indexed addressing has been corrected to only access the Zero page. (GT-2759, Issue #201)
+- Processors. The M68000 BCD arithmetic instructions now have pcode semantics that allow disassembly to continue. (GT-2807, Issue #227)
+- Search. Fixed NullPointerException in Decompiler Data Type Reference Finder. (GT-2754, Issue #407)
Bugs
-
- Analysis. Constant reference analysis boundary controls for speculative references has been fixed. Speculative references are references created from computed constants passed as parameters, stored to a location, or from indexed offsets from a register. (Issue #228)
-- Decompiler. Fixed rendering bug in the Decompiler when the "Find" dialog is closed. (Issue #282)
-- Decompiler. Fixed decompiler handling of Function Definition data types. (Issue #247)
-- Decompiler. Fixed "Free Varnode" exception in RuleConditionalMove. (Issue #294)
-- Diff. Fixed exceptions that can occur in the Diff View for programs with overlays.
-- Documentation. Corrected the spelling of "listener" throughout the source code. (Issue #235)
-- Exporter. Exporting a selection as Intel Hex will now allow a selection of any length. Previously this was restricted to multiples of 16 bytes. (Issue #260)
-- GUI. Fixed exception that occurs after disabling MyProgramChangesDisplayPlugin.
-- GUI. Updated the "Open Program" dialog to disallow file drop operations. (Issue #252) -
- Multi-User:Ghidra Server. Corrected bug introduced into ghidraSvr.bat which could prevent Ghidra Server startup (Issue #279)
-- Processors. The ARM Thumb CMP.W and LSL instructions have been changed to correctly decode. There are still issues to work out with Unpredictable execution when Rd is the PC. (Issue #280)
-- Scripting. MultiInstructionMemReference script has been corrected to consider input and output registers when placing a reference on an instruction.
+- Analysis. Constant reference analysis boundary controls for speculative references has been fixed. Speculative references are references created from computed constants passed as parameters, stored to a location, or from indexed offsets from a register. (GT-2723, Issue #228)
+- Decompiler. Fixed Decompiler handling of Function Definition data types. (GT-2704, Issue #247)
+- Decompiler. Fixed rendering bug in the Decompiler when the "Find" dialog is closed. (GT-2716, Issue #282)
+- Decompiler. Fixed "Free Varnode" exception in RuleConditionalMove. (GT-2726, Issue #294)
+- Diff. Fixed exceptions that can occur in the Diff View for programs with overlays. (GT-2706)
+- Documentation. Corrected the spelling of "listener" throughout the source code. (GT-2702, Issue #235)
+- Exporter. Exporting a selection as Intel Hex will now allow a selection of any length. Previously this was restricted to multiples of 16 bytes. (GT-2703, Issue #260)
+- GUI. Fixed exception that occurs after disabling MyProgramChangesDisplayPlugin. (GT-2712)
+- GUI. Updated the "Open Program" dialog to disallow file drop operations. (GT-2705, Issue #252)
+- Multi-User:Ghidra Server. Corrected bug introduced into ghidraSvr.bat which could prevent Ghidra Server startup. (GT-2717, Issue #279)
+- Processors. The ARM Thumb CMP.W and LSL instructions have been changed to correctly decode. There are still issues to work out with Unpredictable execution when Rd is the PC. (GT-2722, Issue #280)
+- Scripting. MultiInstructionMemReference script has been corrected to consider input and output registers when placing a reference on an instruction. (GT-2723)
Security
-
- Basic Infrastructure. Added a property to support/launch.properties to prevent log4j from using jansi.dll on Windows. (Issue #286)
+- Basic Infrastructure. Added a property to support/launch.properties to prevent log4j from using jansi.dll on Windows. (GT-2725, Issue #286)
New Features
-
- Scripting. Created a script to show all equates within the current selection. (Issue #111)
+- Scripting. Created ShowEquatesInSelectionScript to show all equates within the current selection. (GT-2651, Issue #111)
Improvements
-
- Basic Infrastructure. Updated commons-compress library to version 1.18. (Issue #171)
-- Eclipse Integration. Ghidra now connects to the Eclipse GhidraDev plugin on 127.0.0.1 rather than localhost.
-- GUI. Turned on font anti-aliasing by default for Linux. (Issue #212)
-- GUI. Fixed Options Dialog slow scrolling speed. (Issue #27)
-- Importer:ELF. Corrected bug in ELF loader which can improperly process the GOT, PLT and relocations - when multiple symbol tables exist within the ELF binary. (Issue #52)
-- Multi-User:Ghidra Server. Corrected the Ghidra Server service wrapper (YAJSW) configuration for - Mac OS X to prevent a startup timeout condition which could occur.
-- Processors. Added ARM/Thumb SRS instruction decodes for undefined modes. (Issue #216)
+- Basic Infrastructure. Updated commons-compress library to version 1.18. (GT-2657, Issue #171)
+- Eclipse Integration. Ghidra now connects to the Eclipse GhidraDev plugin on 127.0.0.1 rather than localhost. (GT-2691)
+- GUI. Turned on font anti-aliasing by default for Linux. (GT-2674, Issue #212)
+- GUI. Fixed Options Dialog slow scrolling speed. (GT-2679, Issue #27)
+- Importer:ELF. Corrected bug in ELF loader which can improperly process the GOT, PLT and relocations when multiple symbol tables exist within the ELF binary. (GT-2646, Issue #52)
+- Multi-User:Ghidra Server. Corrected the Ghidra Server service wrapper (YAJSW) configuration for Mac OS X to prevent a startup timeout condition which could occur. (GT-2637)
+- Processors. Added ARM/Thumb SRS instruction decodes for undefined modes. (GT-2676, Issue #216)
Bugs
-
- API. Fixed equals method on Varnode class. (Issue #97)
-- API. Fixed a bug in MaskImpl.comlementMask(). (Issue #187)
-- Basic Infrastructure. Fixed special character handling in idaxml.py. (Issue #75)
-- Basic Infrastructure. Ghidra now forces the locale to en_US by default. Only the en_US is currently supported. - This fixes certain unexpected exceptions. (Issue #209)
-- Diff. Fixed exceptions occasionally encountered when starting a Diff session. (Issue #211)
-- Documentation. Fixed javadoc search box redirecting to broken links. (Issue #129)
-- Function Graph. Fixed Function Graph exception when generating tooltip. (Issue #65)
-- GUI. Updated window placement to keep windows on screen. (Issue #41)
-- GUI. Add/Edit References dialog now restricts users to creating refs in valid memory address spaces.
-- GUI. Fixed exception when exiting Ghidra while a table is being edited. (Issue #51)
-- GUI. Fixed some touchpad scrolling issues. (Issue #2)
-- GUI. Fixed stack trace in the Data Type Manager's tooltip generation. (Issue #133)
-- GUI. User key binding settings for the Recently Used and Define Pointer actions no longer lost after re-launching tool. (Issue #152)
-- GUI. Toolbar buttons now respond to fast clicking.
-- Importer:MachO. The MachoLoader can now find import libraries found in Universal Binary files. (Issue #136)
-- Importer:PE. The PeLoader now correctly parses the GuardCFFunctionTable when entries are more than 4 bytes each. (Issue #220)
-- Multi-User:Ghidra Server. Removed support for native OS authentication from Ghidra Server (removed modes -a2 and -a3) - due to incompatibility with newer OS releases including Windows 10 and Windows Server 2016. Re-introduction of this will be - considered for a future release.
-- PDB. Corrected NPE error when processing PDB files. (Issues #138, #188)
-- Processors. Added missing PowerPC VLE conditional branch instructions: e_bdnz and e_bdz. (Issue #103)
-- Processors. Fixed instruction semantics for several instructions and added Control Flow Enforcement, NOP variants, CMP variants, UD1, and - prefixed call instructions to X86 processor specification. (Issues #22, #53, #158, #157)
-- Processors. The 68000 MOVE instruction now correctly sets the CF and VF flags. (Issue #163)
-- Processors. Added four missing MOVEM instruction variants to the 68000 processor. (Issue #219)
-- Processors. An incorrect usage of X instead of Y in indexed mode for the 6502 has been corrected.(Issue #201)
-- Processors. Added support for ARM Thumb half BL instruction on processor variants prior to v6. (Issue #39)
-- Scripting. Fixed a bug in ImportSymbolsScript.py that prevented it from running. (Issue #170)
+- API. Fixed equals method on Varnode class. (GT-2648, Issue #97)
+- API. Fixed a bug in MaskImpl.complementMask(). (GT-2694, Issue #187)
+- Basic Infrastructure. Fixed special character handling in idaxml.py. (GT-2669, Issue #75)
+- Basic Infrastructure. Ghidra now forces the locale to en_US by default. Only the en_US is currently supported. This fixes certain unexpected exceptions. (GT-2680, Issue #209)
+- Diff. Fixed exception occasionally encountered when starting a Diff session. (GT-2672, Issue #211)
+- Documentation. Fixed javadoc search box redirecting to broken links. (GT-2655, Issue #129)
+- Function Graph. Fixed Function Graph exception when generating tooltip. (GT-2650, Issue #65)
+- GUI. Updated window placement to keep windows on screen. (GT-1516, Issue #41)
+- GUI. Add/Edit References dialog now restricts users to creating refs in valid memory address spaces. (GT-2638)
+- GUI. Fixed exception when exiting Ghidra while a table is being edited. (GT-2642, Issue #51)
+- GUI. Fixed some touchpad scrolling issues. (GT-2647, Issue #2)
+- GUI. Fixed stack trace in the Data Type Manager's tooltip generation. (GT-2656, Issue #133)
+- GUI. User key binding settings for the Recently Used and Define Pointer actions no longer lost after re-launching tool. (GT-2659, Issue #152)
+- GUI. Toolbar buttons now respond to fast clicking. (GT-2689)
+- Importer:Mach-O. The Mach-O loader can now find import libraries found in Universal Binary files. (GT-2663, Issue #136)
+- Importer:PE. The PeLoader now correctly parses the GuardCFFunctionTable when table entries are more than 4 bytes each. (GT-2671, Issue #220)
+- Multi-User:Ghidra Server. Removed support for native OS authentication from Ghidra Server (removed modes -a2 and -a3) due to incompatibility with newer OS releases including Windows 10 and Windows Server 2016. Re-introduction of this will be considered for a future release. (GT-2653)
+- PDB. Corrected NullPointerException when processing PDB files. (GT-2673, Issues #138, #188)
+- Processors. Added missing PowerPC VLE conditional branch instructions: e_bdnz and e_bdz. (GT-2652, Issue #103)
+- Processors. Fixed instruction semantics for several instructions and added Control Flow Enforcement, NOP variants, CMP variants, UD1, and prefixed call instructions to X86 processor specification. (GT-2660, Issues #22, #53, #158, #157)
+- Processors. The M68000 MOVE instruction now correctly sets the CF and VF flags. (GT-2661, Issue #163)
+- Processors. Added four missing MOVEM instruction variants to the M68000 processor. (GT-2675, Issue #219)
+- Processors. An incorrect usage of X instead of Y in indexed mode for the 6502 has been corrected. (GT-2677, Issue #201)
+- Processors. PPC VLE now disassembles base PPC instructions that are valid in VLE mode. (GT-2681, Issue #127)
+- Processors. Added support for ARM Thumb half BL instruction on processor variants prior to v6. (GT-2684, Issue #39)
+- Scripting. Fixed a bug in ImportSymbolsScript.py that prevented it from running. (GT-2668, Issue #170)
diff --git a/Ghidra/Extensions/SampleTablePlugin/build.gradle b/Ghidra/Extensions/SampleTablePlugin/build.gradle index b49b2ef531..5950dcfe29 100644 --- a/Ghidra/Extensions/SampleTablePlugin/build.gradle +++ b/Ghidra/Extensions/SampleTablePlugin/build.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ apply from: "$rootProject.projectDir/gradle/distributableGhidraExtension.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" diff --git a/Ghidra/Extensions/SampleTablePlugin/certification.manifest b/Ghidra/Extensions/SampleTablePlugin/certification.manifest index 147e3af647..b9b2c11b56 100644 --- a/Ghidra/Extensions/SampleTablePlugin/certification.manifest +++ b/Ghidra/Extensions/SampleTablePlugin/certification.manifest @@ -2,7 +2,6 @@ ##MODULE IP: FAMFAMFAM Icons - CC 2.5 ##MODULE IP: Oxygen Icons - LGPL 3.0 Module.manifest||GHIDRA||reviewed||END| -build.gradle||GHIDRA||||END| data/ExtensionPoint.manifest||GHIDRA||||END| extension.properties||GHIDRA||||END| src/main/help/help/TOC_Source.xml||GHIDRA||||END| diff --git a/Ghidra/Extensions/SleighDevTools/build.gradle b/Ghidra/Extensions/SleighDevTools/build.gradle index 189b77a16f..4dbcca1cae 100644 --- a/Ghidra/Extensions/SleighDevTools/build.gradle +++ b/Ghidra/Extensions/SleighDevTools/build.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ apply from: "$rootProject.projectDir/gradle/distributableGhidraExtension.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" diff --git a/Ghidra/Extensions/SleighDevTools/certification.manifest b/Ghidra/Extensions/SleighDevTools/certification.manifest index 07bcf00587..4dc3953d2b 100644 --- a/Ghidra/Extensions/SleighDevTools/certification.manifest +++ b/Ghidra/Extensions/SleighDevTools/certification.manifest @@ -1,14 +1,12 @@ ##VERSION: 2.0 .project||GHIDRA||||END| Module.manifest||GHIDRA||||END| -build.gradle||GHIDRA||||END| data/ExtensionPoint.manifest||GHIDRA||||END| data/LanguageMap.txt||GHIDRA||||END| extension.properties||GHIDRA||||END| pcodetest/.gitignore||GHIDRA||||END| pcodetest/README.txt||GHIDRA||||END| pcodetest/build||GHIDRA||||END| -pcodetest/build.py||GHIDRA||||END| pcodetest/c_src/BIOPS.test||GHIDRA||||END| pcodetest/c_src/BIOPS2.test||GHIDRA||||END| pcodetest/c_src/BIOPS4.test||GHIDRA||||END| @@ -28,7 +26,3 @@ pcodetest/c_src/PointerManipulation.test||GHIDRA||||END| pcodetest/c_src/StructUnionManipulation.test||GHIDRA||||END| pcodetest/c_src/misc.test||GHIDRA||||END| pcodetest/c_src/msp430x.ld||GHIDRA||||END| -pcodetest/defaults.py||GHIDRA||||END| -pcodetest/pcode_defs.py||GHIDRA||||END| -pcodetest/pcodetest.py||GHIDRA||||END| -pcodetest/tpp.py||GHIDRA||||END| diff --git a/Ghidra/Extensions/SleighDevTools/pcodetest/build.py b/Ghidra/Extensions/SleighDevTools/pcodetest/build.py index 988edb84b6..ee663bb3ea 100644 --- a/Ghidra/Extensions/SleighDevTools/pcodetest/build.py +++ b/Ghidra/Extensions/SleighDevTools/pcodetest/build.py @@ -1,3 +1,18 @@ +## ### +# 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. +## import os import shutil import subprocess diff --git a/Ghidra/Extensions/SleighDevTools/pcodetest/defaults.py b/Ghidra/Extensions/SleighDevTools/pcodetest/defaults.py index 16bd50ef87..1505aa8e20 100644 --- a/Ghidra/Extensions/SleighDevTools/pcodetest/defaults.py +++ b/Ghidra/Extensions/SleighDevTools/pcodetest/defaults.py @@ -1,4 +1,18 @@ - +## ### +# 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. +## # Default values can be modified here, or (in # some cases) on the build command line (see ./build --help) diff --git a/Ghidra/Extensions/SleighDevTools/pcodetest/pcode_defs.py b/Ghidra/Extensions/SleighDevTools/pcodetest/pcode_defs.py index 4a8e096ec6..c8cf6cc787 100644 --- a/Ghidra/Extensions/SleighDevTools/pcodetest/pcode_defs.py +++ b/Ghidra/Extensions/SleighDevTools/pcodetest/pcode_defs.py @@ -1,4 +1,18 @@ - +## ### +# 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. +## # The available pcode tests are recorded here as instances of the 'name' # python class. diff --git a/Ghidra/Extensions/SleighDevTools/pcodetest/pcodetest.py b/Ghidra/Extensions/SleighDevTools/pcodetest/pcodetest.py index dfc796f48d..628a8759a4 100644 --- a/Ghidra/Extensions/SleighDevTools/pcodetest/pcodetest.py +++ b/Ghidra/Extensions/SleighDevTools/pcodetest/pcodetest.py @@ -1,3 +1,18 @@ +## ### +# 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. +## import os import glob import re diff --git a/Ghidra/Extensions/SleighDevTools/pcodetest/tpp.py b/Ghidra/Extensions/SleighDevTools/pcodetest/tpp.py index d574530166..6c6246eabe 100644 --- a/Ghidra/Extensions/SleighDevTools/pcodetest/tpp.py +++ b/Ghidra/Extensions/SleighDevTools/pcodetest/tpp.py @@ -1,4 +1,19 @@ #!/usr/bin/python +## ### +# 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. +## import re import os diff --git a/Ghidra/Extensions/bundle_examples/build.gradle b/Ghidra/Extensions/bundle_examples/build.gradle index 7d477c15a9..4fce7fc287 100644 --- a/Ghidra/Extensions/bundle_examples/build.gradle +++ b/Ghidra/Extensions/bundle_examples/build.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ /* This extension is different from the others. It produces a zip containing * directories of source bundles and jar bundles. * - Each source directory is added as a sourceset so that the eclipse plugin diff --git a/Ghidra/Extensions/bundle_examples/certification.manifest b/Ghidra/Extensions/bundle_examples/certification.manifest index b951f42732..7cbc96e96a 100644 --- a/Ghidra/Extensions/bundle_examples/certification.manifest +++ b/Ghidra/Extensions/bundle_examples/certification.manifest @@ -1,6 +1,5 @@ ##VERSION: 2.0 Module.manifest||GHIDRA||||END| -build.gradle||GHIDRA||||END| extension.properties||GHIDRA||||END| scripts_jar1/META-INF/MANIFEST.MF||GHIDRA||||END| scripts_jar2/META-INF/MANIFEST.MF||GHIDRA||||END| diff --git a/Ghidra/Extensions/sample/build.gradle b/Ghidra/Extensions/sample/build.gradle index b0e9354f12..a6a9893a0c 100644 --- a/Ghidra/Extensions/sample/build.gradle +++ b/Ghidra/Extensions/sample/build.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ apply from: "$rootProject.projectDir/gradle/distributableGhidraExtension.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/javaTestProject.gradle" diff --git a/Ghidra/Extensions/sample/certification.manifest b/Ghidra/Extensions/sample/certification.manifest index 4e6d44c844..f76dd9c0ce 100644 --- a/Ghidra/Extensions/sample/certification.manifest +++ b/Ghidra/Extensions/sample/certification.manifest @@ -2,7 +2,6 @@ ##MODULE IP: FAMFAMFAM Icons - CC 2.5 ##MODULE IP: Oxygen Icons - LGPL 3.0 Module.manifest||GHIDRA||reviewed||END| -build.gradle||GHIDRA||||END| data/README.txt||GHIDRA||||END| extension.properties||GHIDRA||||END| src/main/help/help/TOC_Source.xml||GHIDRA||||END| diff --git a/Ghidra/Features/Base/build.gradle b/Ghidra/Features/Base/build.gradle index 2a77bdc815..f306645e5f 100644 --- a/Ghidra/Features/Base/build.gradle +++ b/Ghidra/Features/Base/build.gradle @@ -1,3 +1,18 @@ +/* ### + * 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. + */ apply from: "$rootProject.projectDir/gradle/distributableGhidraModule.gradle" apply from: "$rootProject.projectDir/gradle/javaProject.gradle" apply from: "$rootProject.projectDir/gradle/helpProject.gradle" diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifest index 1fa71b205c..a22037ed99 100644 --- a/Ghidra/Features/Base/certification.manifest +++ b/Ghidra/Features/Base/certification.manifest @@ -13,7 +13,6 @@ .launch/Ghidra Code Coverage.launch||GHIDRA||||END| .launch/Ghidra.launch||GHIDRA||||END| Module.manifest||GHIDRA||||END| -build.gradle||GHIDRA||||END| data/ElfFunctionsThatDoNotReturn||GHIDRA||||END| data/ExtensionPoint.manifest||GHIDRA||||END| data/MachOFunctionsThatDoNotReturn||GHIDRA||||END| @@ -78,8 +77,6 @@ data/typeinfo/win32/windows_vs12_64.gdt||GHIDRA||||END| data/x64_linux_syscall_numbers||GHIDRA||||END| data/x86_linux_syscall_numbers||GHIDRA||||END| ghidra_scripts/AskScript.properties||GHIDRA||||END| -ghidra_scripts/RecursiveStringFinder.py||GHIDRA||||END| -ghidra_scripts/mark_in_out.py||GHIDRA||reviewed||END| ghidra_scripts/world.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END| src/main/help/help/TOC_Source.xml||GHIDRA||||END| src/main/help/help/shared/arrow.gif||GHIDRA||||END| diff --git a/Ghidra/Features/Base/data/PEFunctionsThatDoNotReturn b/Ghidra/Features/Base/data/PEFunctionsThatDoNotReturn index e8ed7404f4..51c5089410 100644 --- a/Ghidra/Features/Base/data/PEFunctionsThatDoNotReturn +++ b/Ghidra/Features/Base/data/PEFunctionsThatDoNotReturn @@ -1,7 +1,15 @@ +abort CxxThrowException CxxThrowException@8 CxxFrameHandler3 crtExitProcess ExitProcess +ExitThread exit +FreeLibraryAndExitThread +invalid_parameter_noinfo_noreturn +invoke_watson longjmp +quick_exit +RpcRaiseException +terminate diff --git a/Ghidra/Features/Base/ghidra_scripts/BuildGhidraJarScript.java b/Ghidra/Features/Base/ghidra_scripts/BuildGhidraJarScript.java index b6a3f8e809..675904cb82 100644 --- a/Ghidra/Features/Base/ghidra_scripts/BuildGhidraJarScript.java +++ b/Ghidra/Features/Base/ghidra_scripts/BuildGhidraJarScript.java @@ -17,10 +17,9 @@ //@category Examples import java.io.File; -import java.util.*; +import java.util.List; import generic.jar.ApplicationModule; -import generic.jar.ResourceFile; import ghidra.app.script.GhidraScript; import ghidra.framework.Application; import ghidra.util.GhidraJarBuilder; @@ -32,8 +31,7 @@ public class BuildGhidraJarScript extends GhidraScript { @Override public void run() throws Exception { - GhidraJarBuilder builder = - new GhidraJarBuilder(toFiles(Application.getApplicationRootDirectories())); + GhidraJarBuilder builder = new GhidraJarBuilder(Application.getApplicationLayout()); builder.setMainClass("ghidra.JarRun"); // default is ghidra.JarRun, only here if you want // to change it to something else. @@ -69,12 +67,4 @@ public class BuildGhidraJarScript extends GhidraScript { // uncomment the following line to create a src zip for debugging. // builder.buildSrcZip(new File(installDir, "GhidraSrc.zip"), monitor); } - - private ListSecurity
-
- Basic Infrastructure. Running Ghidra in debug mode no longer opens remotely accessible ports by default. (Issue #6)
-- GUI. The Defined Strings plugin no longer renders HTML in its table. (Issue #45)
-- Project Manager. Fixed an XXE vulnerability affecting projects and many other saved components. (Issue #71)
+- Basic Infrastructure. Running Ghidra in debug mode no longer opens remotely accessible ports by default. (GT-2641, Issue #6)
+- GUI. The Defined Strings plugin no longer renders HTML in its table. (GT-2686, Issue #45)
+- Project Manager. Fixed an XXE vulnerability affecting projects and many other saved components. (GT-2643, Issue #71)
+Writes an ELF program that was imported with the ELF loader back to its original file + layout. Any file-backed bytes that were modified by the user in the program database will + be reflected in the new file.
+ ++ +
Writing back a modified Memory + Map is not supported.
+
Relocation bytes are always + restored to their original values, even if the user modifies them.
+Writes a PE program that was imported with the PE loader back to its original file + layout. Any file-backed bytes that were modified by the user in the program database will + be reflected in the new file.
+ ++ +
Writing back a modified Memory + Map is not supported.
+
Relocation bytes are always + restored to their original values, even if the user modifies them.
Each button press will use the selected items as the items to be processed. While the - * items are scheduled to be processed, they will still be in the table, painted light gray. - * Attempting to reschedule any of these pending items will have no effect. Each time the + * + *
Each button press will use the selected items as the items to be processed. While the
+ * items are scheduled to be processed, they will still be in the table, painted light gray.
+ * Attempting to reschedule any of these pending items will have no effect. Each time the
* button is pressed, a new {@link SwingWorker} is created, which will put the processing into
* a background thread. Further, by using multiple workers, the work will be performed in
* parallel.
@@ -113,8 +114,7 @@ public class TableChooserDialog extends DialogComponentProvider
table.installNavigation(goToService, navigatable);
}
table.getSelectionModel()
- .addListSelectionListener(
- e -> setOkEnabled(table.getSelectedRowCount() > 0));
+ .addListSelectionListener(e -> setOkEnabled(table.getSelectedRowCount() > 0));
GhidraTableFilterPanel This method should be called after all custom columns have been added via
+ * {@link #addCustomColumn(ColumnDisplay)}.
+ *
+ * @param index the view's 0-based column index
+ * @see #setSortState(TableSortState)
+ * @throws IllegalArgumentException if an invalid column is requested for sorting
+ */
+ public void setSortColumn(int index) {
+ setSortState(TableSortState.createDefaultSortState(index));
+ }
+
+ /**
+ * Sets the column sort state for this dialog. The {@link TableSortState} allows for
+ * combinations of sorted columns in ascending or descending order.
+ *
+ * This method should be called after all custom columns have been added via
+ * {@link #addCustomColumn(ColumnDisplay)}.
+ *
+ * @param state the sort state
+ * @see #setSortColumn(int)
+ * @throws IllegalArgumentException if an invalid column is requested for sorting
+ */
+ public void setSortState(TableSortState state) {
+ AtomicReference
+ * This indicates an empty range, in which case the caller may want to take
+ * special steps to avoid issues with Ghidra ranges.
+ *
+ * Only seen in extremely old gcc versions. Typically the low & high
+ * pc values are omitted if the CU is empty.
+ *
+ * @return boolean true if the LowPC and HighPC values are present and equal
+ */
+ public boolean isLowPCEqualHighPC() {
+ AttrInfo low = findAttribute(DWARFAttribute.DW_AT_low_pc);
+ AttrInfo high = findAttribute(DWARFAttribute.DW_AT_high_pc);
+ if (low != null && high != null && low.form == high.form &&
+ low.attr instanceof DWARFNumericAttribute &&
+ high.attr instanceof DWARFNumericAttribute) {
+ DWARFNumericAttribute lowVal = (DWARFNumericAttribute) low.attr;
+ DWARFNumericAttribute highVal = (DWARFNumericAttribute) high.attr;
+ return lowVal.getValue() == highVal.getValue();
+ }
+ return false;
+ }
+
/**
* A simple class used by findAttribute() to return the found attribute, along with
* the DIE it was found in, and the DWARFForm type of the raw attribute.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/DWARFCompileUnit.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/DWARFCompileUnit.java
index 2b46c53442..3c8bd88929 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/DWARFCompileUnit.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/DWARFCompileUnit.java
@@ -49,11 +49,14 @@ public class DWARFCompileUnit {
String comp_dir = diea.getString(DWARFAttribute.DW_AT_comp_dir, null);
Number high_pc = null, low_pc = null, language = null, stmt_list = null;
+
if (diea.hasAttribute(DWARFAttribute.DW_AT_low_pc)) {
low_pc = diea.getLowPC(0);
}
- if (diea.hasAttribute(DWARFAttribute.DW_AT_high_pc)) {
+ // if lowPC and highPC values are the same, don't read the high value
+ // because Ghidra can't express an empty range.
+ if (diea.hasAttribute(DWARFAttribute.DW_AT_high_pc) && !diea.isLowPCEqualHighPC()) {
high_pc = diea.getHighPC();
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java
index 786da2b95c..5cdfc55a1c 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java
@@ -15,10 +15,11 @@
*/
package ghidra.app.util.bin.format.dwarf4.next;
-import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
+import java.io.IOException;
+
import ghidra.app.cmd.comments.AppendCommentCmd;
import ghidra.app.cmd.label.SetLabelPrimaryCmd;
import ghidra.app.util.bin.format.dwarf4.*;
@@ -202,26 +203,26 @@ public class DWARFFunctionImporter {
return;
}
- DWARFFunction function = new DWARFFunction(prog.getName(diea));
- function.namespace = function.dni.getParentNamespace(currentProgram);
+ DWARFFunction dfunc = new DWARFFunction(prog.getName(diea));
+ dfunc.namespace = dfunc.dni.getParentNamespace(currentProgram);
Number lowPC = diea.getLowPC(0);
- function.address = toAddr(lowPC);
- function.highAddress =
+ dfunc.address = toAddr(lowPC);
+ dfunc.highAddress =
diea.hasAttribute(DWARFAttribute.DW_AT_high_pc) ? toAddr(diea.getHighPC()) : null;
- String previousFunctionProcessed = functionsProcessed.get(function.address);
+ String previousFunctionProcessed = functionsProcessed.get(dfunc.address);
if (previousFunctionProcessed != null) {
// Msg.info(this, "Duplicate function defintion found for " + dni.getCategoryPath() +
// " at " + function.address + " in DIE " + diea.getHexOffset() + ", skipping");
markAllChildrenAsProcessed(diea.getHeadFragment());
return;
}
- functionsProcessed.put(function.address,
- function.dni.getNamespacePath() + " DIE: " + diea.getHexOffset());
+ functionsProcessed.put(dfunc.address,
+ dfunc.dni.getNamespacePath() + " DIE: " + diea.getHexOffset());
// Check if the function is an external function
- function.isExternal = diea.getBool(DWARFAttribute.DW_AT_external, false);
+ dfunc.isExternal = diea.getBool(DWARFAttribute.DW_AT_external, false);
// Retrieve the frame base if it exists
DWARFLocation frameLoc = null;
@@ -229,9 +230,9 @@ public class DWARFFunctionImporter {
List
* If the program is an Elf binary, it must have (at least) ".debug_info" and ".debug_abbr" program sections.
*
@@ -67,17 +63,17 @@ public class DWARFProgram implements Closeable {
* original binary file on the native filesystem. (ie. outside of Ghidra). See the DSymSectionProvider
* for more info.
*
- * @param program
- * @param monitor
- * @return
+ * @param program {@link Program} to test
+ * @return boolean true if program has DWARF info, false if not
*/
- public static boolean isDWARF(Program program, TaskMonitor monitor) {
+ public static boolean isDWARF(Program program) {
String format = program.getExecutableFormat();
- if (ElfLoader.ELF_NAME.equals(format)) {
+ if (ElfLoader.ELF_NAME.equals(format) &&
+ DWARFSectionProviderFactory.createSectionProviderFor(program) != null) {
return true;
}
- else if (MachoLoader.MACH_O_NAME.equals(format) &&
+ if (MachoLoader.MACH_O_NAME.equals(format) &&
DSymSectionProvider.getDSYMForProgram(program) != null) {
return true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DWARFSectionProviderFactory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DWARFSectionProviderFactory.java
index 7ea6cdce59..7cb75f4a24 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DWARFSectionProviderFactory.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/DWARFSectionProviderFactory.java
@@ -15,14 +15,14 @@
*/
package ghidra.app.util.bin.format.dwarf4.next.sectionprovider;
-import ghidra.program.model.listing.Program;
-import ghidra.util.Msg;
-
import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
+import ghidra.program.model.listing.Program;
+import ghidra.util.Msg;
+
/**
* Auto-detects which {@link DWARFSectionProvider} matches a Ghidra program.
*/
@@ -44,7 +44,6 @@ public class DWARFSectionProviderFactory {
static {
sectionProviderFactoryFuncs.add(BaseSectionProvider::createSectionProviderFor);
sectionProviderFactoryFuncs.add(DSymSectionProvider::createSectionProviderFor);
- sectionProviderFactoryFuncs.add(ElfSectionProvider::createSectionProviderFor);
}
/**
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/ElfSectionProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/ElfSectionProvider.java
deleted file mode 100644
index 4eb692cabc..0000000000
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/sectionprovider/ElfSectionProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ###
- * 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.
- */
-package ghidra.app.util.bin.format.dwarf4.next.sectionprovider;
-
-import ghidra.app.util.bin.*;
-import ghidra.app.util.bin.format.elf.*;
-import ghidra.app.util.opinion.ElfLoader;
-import ghidra.program.model.listing.Program;
-
-import java.io.File;
-import java.io.IOException;
-
-import generic.continues.RethrowContinuesFactory;
-
-/**
- * Fetches DWARF section data from ELF files, directly, without going through
- * the Ghidra memory block api. This section provider usually isn't needed as
- * ELF sections are normally provided as Ghidra memory blocks. In case of extra-
- * large binaries, Ghidra may not be able to map the debug sections into memory
- * and this section provider will allow the DWARF analyzer to still function.
- */
-public class ElfSectionProvider implements DWARFSectionProvider {
-
- private ElfHeader header;
- private RandomAccessByteProvider provider;
-
- public static ElfSectionProvider createSectionProviderFor(Program program) {
- if (ElfLoader.ELF_NAME.equals(program.getExecutableFormat())) {
- try {
- File exePath = new File(program.getExecutablePath());
- return new ElfSectionProvider(exePath);
- }
- catch (IOException ioe) {
- // ignore
- }
- }
- return null;
- }
-
- public ElfSectionProvider(File exeFile) throws IOException {
- provider = new RandomAccessByteProvider(exeFile);
- try {
- // Parse the ELF header to get the sections
- header = ElfHeader.createElfHeader(RethrowContinuesFactory.INSTANCE, provider);
- header.parse();
- }
- catch (ElfException e) {
- provider.close();
- throw new IOException("Error parsing ELF", e);
- }
- }
-
- @Override
- public ByteProvider getSectionAsByteProvider(String sectionName) throws IOException {
-
- ElfSectionHeader section = header.getSection("." + sectionName);
-
- return (section != null) ? new ByteProviderWrapper(section.getReader().getByteProvider(),
- section.getOffset(), section.getSize()) : null;
- }
-
- @Override
- public void close() {
- try {
- provider.close();
- }
- catch (IOException e) {
- // ignore
- }
- }
-
- @Override
- public boolean hasSection(String... sectionNames) {
- for (String sectionName : sectionNames) {
- if (header.getSection("." + sectionName) == null) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbol.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbol.java
index 297dedfd3b..170c317d97 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbol.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbol.java
@@ -103,11 +103,24 @@ public class ElfSymbol implements ByteArrayConverter {
private String nameAsString;
+ /**
+ * create an ElfSymbol()
+ * Warning! the routine initSymbolName() must be called on the symbol later
+ * to initialize the string name. This is a performance enhancement.
+ *
+ * @param reader to read symbol from
+ * @param symbolIndex index of the symbol to read
+ * @param symbolTable symbol table to associate the symbol to
+ * @param stringTable string table to read symbols from
+ * @param header else header
+ * @return newly created ElfSymbol
+ *
+ * @throws IOException if an issue with reading occurs
+ */
public static ElfSymbol createElfSymbol(FactoryBundledWithBinaryReader reader, int symbolIndex,
- ElfSymbolTable symbolTable, ElfStringTable stringTable, ElfHeader header)
- throws IOException {
+ ElfSymbolTable symbolTable, ElfHeader header) throws IOException {
ElfSymbol elfSymbol = (ElfSymbol) reader.getFactory().create(ElfSymbol.class);
- elfSymbol.initElfSymbol(reader, symbolIndex, symbolTable, stringTable, header);
+ elfSymbol.initElfSymbol(reader, symbolIndex, symbolTable, header);
return elfSymbol;
}
@@ -117,49 +130,6 @@ public class ElfSymbol implements ByteArrayConverter {
public ElfSymbol() {
}
- private void initElfSymbol(FactoryBundledWithBinaryReader reader, int symbolIndex,
- ElfSymbolTable symbolTable, ElfStringTable stringTable, ElfHeader header)
- throws IOException {
- this.header = header;
- this.symbolTable = symbolTable;
- this.symbolTableIndex = symbolIndex;
-
- if (header.is32Bit()) {
- st_name = reader.readNextInt();
- st_value = reader.readNextInt() & Conv.INT_MASK;
- st_size = reader.readNextInt() & Conv.INT_MASK;
- st_info = reader.readNextByte();
- st_other = reader.readNextByte();
- st_shndx = reader.readNextShort();
- }
- else {
- st_name = reader.readNextInt();
- st_info = reader.readNextByte();
- st_other = reader.readNextByte();
- st_shndx = reader.readNextShort();
- st_value = reader.readNextLong();
- st_size = reader.readNextLong();
- }
-
- if (st_name == 0) {
- if (getType() == STT_SECTION) {
- ElfSectionHeader[] sections = header.getSections();
- if (st_shndx < 0 || st_shndx >= sections.length) {
- //invalid section reference...
- //this is a bug in objcopy, whereby sections are removed
- //but the corresponding section symbols are left behind.
- }
- else {
- ElfSectionHeader section = sections[st_shndx];
- nameAsString = section.getNameAsString();
- }
- }
- }
- else {
- nameAsString = stringTable.readString(reader, st_name);
- }
- }
-
/**
* Creates a new section symbol.
* @param header the corresponding ELF header
@@ -209,6 +179,69 @@ public class ElfSymbol implements ByteArrayConverter {
this.symbolTableIndex = symbolIndex;
}
+ private void initElfSymbol(FactoryBundledWithBinaryReader reader, int symbolIndex,
+ ElfSymbolTable symbolTable, ElfHeader header) throws IOException {
+ this.header = header;
+ this.symbolTable = symbolTable;
+ this.symbolTableIndex = symbolIndex;
+
+ if (header.is32Bit()) {
+ st_name = reader.readNextInt();
+ st_value = reader.readNextInt() & Conv.INT_MASK;
+ st_size = reader.readNextInt() & Conv.INT_MASK;
+ st_info = reader.readNextByte();
+ st_other = reader.readNextByte();
+ st_shndx = reader.readNextShort();
+ }
+ else {
+ st_name = reader.readNextInt();
+ st_info = reader.readNextByte();
+ st_other = reader.readNextByte();
+ st_shndx = reader.readNextShort();
+ st_value = reader.readNextLong();
+ st_size = reader.readNextLong();
+ }
+
+ if (st_name == 0) {
+ if (getType() == STT_SECTION) {
+ ElfSectionHeader[] sections = header.getSections();
+ if (st_shndx < 0 || st_shndx >= sections.length) {
+ //invalid section reference...
+ //this is a bug in objcopy, whereby sections are removed
+ //but the corresponding section symbols are left behind.
+ }
+ else {
+ ElfSectionHeader section = sections[st_shndx];
+ nameAsString = section.getNameAsString();
+ }
+ }
+ }
+ else {
+ // The string name will be initialized later
+ // in a call to initSymbolName()
+ }
+ }
+
+ /**
+ * Initialize the string name of the symbol.
+ *
+ * NOTE: This routine MUST be called for each
+ * ELFSymbol after the elf symbols have been created.
+ *
+ * This is done separately from the initial symbol entry read because
+ * the string names are in a separate location. If they are read
+ * at the same time the reading buffer will jump around and significantly
+ * degrade reading performance.
+ *
+ * @param reader to read from
+ * @param stringTable stringTable to initialize symbol name
+ */
+ public void initSymbolName(FactoryBundledWithBinaryReader reader, ElfStringTable stringTable) {
+ if (nameAsString == null) {
+ nameAsString = stringTable.readString(reader, st_name);
+ }
+ }
+
/**
* Get the symbol table containing this symbol
* @return symbol table
@@ -249,27 +282,37 @@ public class ElfSymbol implements ByteArrayConverter {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
ElfSymbol other = (ElfSymbol) obj;
- if (st_info != other.st_info)
+ if (st_info != other.st_info) {
return false;
- if (st_name != other.st_name)
+ }
+ if (st_name != other.st_name) {
return false;
- if (st_other != other.st_other)
+ }
+ if (st_other != other.st_other) {
return false;
- if (st_shndx != other.st_shndx)
+ }
+ if (st_shndx != other.st_shndx) {
return false;
- if (st_size != other.st_size)
+ }
+ if (st_size != other.st_size) {
return false;
- if (st_value != other.st_value)
+ }
+ if (st_value != other.st_value) {
return false;
- if (symbolTableIndex != other.symbolTableIndex)
+ }
+ if (symbolTableIndex != other.symbolTableIndex) {
return false;
+ }
return true;
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbolTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbolTable.java
index 09eea496c9..fcb4631af9 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbolTable.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfSymbolTable.java
@@ -18,6 +18,7 @@ package ghidra.app.util.bin.format.elf;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
import ghidra.app.util.bin.ByteArrayConverter;
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
@@ -96,15 +97,26 @@ public class ElfSymbolTable implements ElfFileSection, ByteArrayConverter {
long entryPos = reader.getPointerIndex();
+ // load the all the symbol entries first, don't initialize the string name
+ // that will be done later to help localize memory access
for (int i = 0; i < symbolCount; i++) {
// Reposition reader to start of symbol element since ElfSymbol object
// may not consume all symbol element data
reader.setPointerIndex(entryPos);
- ElfSymbol sym = ElfSymbol.createElfSymbol(reader, i, this, stringTable, header);
+ ElfSymbol sym = ElfSymbol.createElfSymbol(reader, i, this, header);
symbolList.add(sym);
entryPos += entrySize;
}
+ // sort the entries by the index in the string table, so don't jump around reading
+ List The View Settings option describes how the graph will be zoomed when it is first
+ loaded. The values are: There are various edge color and highlight color options available to change. The
highlight colors are those to be used when the flow animations take place. The Use Dim Return Edges option makes default code block return flow edges
+ lighter than conditional edges. This makes it easier for users to scan the
+ graph and ignore return flows.
+ Edges returning to the default code flow are painted lighter to de-emphasize them. This
* could be made into an option.
- *
- * Edge routing herein defaults to 'simple routing'; 'complex routing' is a user option.
+ *
+ * Edge routing herein defaults to 'simple routing'; 'complex routing' is a user option.
* Simple routing will reduce edge noise as much as possible by combining/overlapping edges that
* flow towards the bottom of the function (returning code flow). Also, edges may fall behind
* vertices for some functions. Complex routing allows the user to visually follow the flow
* of an individual edge. Complex routing will prevent edges from overlapping and will route
- * edges around vertices. Simple routing is better when the layout of the vertices is
- * important to the user; complex routing is better when edges/relationships are more
+ * edges around vertices. Simple routing is better when the layout of the vertices is
+ * important to the user; complex routing is better when edges/relationships are more
* important to the user.
- *
+ *
* TODO ideas:
* -paint fallthrough differently for all, or just for those returning to the baseline
*/
@@ -113,7 +114,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
@Override
protected double getCondenseFactor() {
- // our layout needs more spacing because we have custom edge routing that we want to
+ // our layout needs more spacing because we have custom edge routing that we want to
// stand out
return .3;
}
@@ -201,7 +202,7 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
continue;
}
- //
+ //
// Special case: fallthrough--don't label this...not sure how to tell fallthrough. For
// now assume that any column below or backwards is fallthrough. However,
// do label fallthrough if it is the only edge.
@@ -231,10 +232,10 @@ public class DecompilerNestedLayout extends AbstractFGLayout {
MapIMAGE_FILE_HEADER
in bytes.
*/
- public final static int IMAGE_SIZEOF_FILE_HEADER = 20;
+ public final static int IMAGE_SIZEOF_FILE_HEADER = 20;
/**
* Relocation info stripped from file.
*/
- public final static int IMAGE_FILE_RELOCS_STRIPPED = 0x0001;
- /**
- * File is executable (no unresolved externel references).
- */
- public final static int IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002;
- /**
- * Line nunbers stripped from file.
- */
- public final static int IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004;
- /**
- * Local symbols stripped from file.
- */
- public final static int IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008;
- /**
- * Agressively trim working set
- */
- public final static int IMAGE_FILE_AGGRESIVE_WS_TRIM = 0x0010;
- /**
- * App can handle >2gb addresses
- */
- public final static int IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020;
- /**
- * Bytes of machine word are reversed.
- */
- public final static int IMAGE_FILE_BYTES_REVERSED_LO = 0x0080;
- /**
- * 32 bit word machine.
- */
- public final static int IMAGE_FILE_32BIT_MACHINE = 0x0100;
- /**
- * Debugging info stripped from file in .DBG file
- */
- public final static int IMAGE_FILE_DEBUG_STRIPPED = 0x0200;
- /**
- * If Image is on removable media, copy and run from the swap file.
- */
- public final static int IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400;
- /**
- * If Image is on Net, copy and run from the swap file.
- */
- public final static int IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800;
- /**
- * System File.
- */
- public final static int IMAGE_FILE_SYSTEM = 0x1000;
- /**
- * File is a DLL.
- */
- public final static int IMAGE_FILE_DLL = 0x2000;
- /**
- * File should only be run on a UP machine
- */
- public final static int IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000;
- /**
- * Bytes of machine word are reversed.
- */
- public final static int IMAGE_FILE_BYTES_REVERSED_HI = 0x8000;
+ public final static int IMAGE_FILE_RELOCS_STRIPPED = 0x0001;
+ /**
+ * File is executable (no unresolved externel references).
+ */
+ public final static int IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002;
+ /**
+ * Line nunbers stripped from file.
+ */
+ public final static int IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004;
+ /**
+ * Local symbols stripped from file.
+ */
+ public final static int IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008;
+ /**
+ * Agressively trim working set
+ */
+ public final static int IMAGE_FILE_AGGRESIVE_WS_TRIM = 0x0010;
+ /**
+ * App can handle >2gb addresses
+ */
+ public final static int IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020;
+ /**
+ * Bytes of machine word are reversed.
+ */
+ public final static int IMAGE_FILE_BYTES_REVERSED_LO = 0x0080;
+ /**
+ * 32 bit word machine.
+ */
+ public final static int IMAGE_FILE_32BIT_MACHINE = 0x0100;
+ /**
+ * Debugging info stripped from file in .DBG file
+ */
+ public final static int IMAGE_FILE_DEBUG_STRIPPED = 0x0200;
+ /**
+ * If Image is on removable media, copy and run from the swap file.
+ */
+ public final static int IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400;
+ /**
+ * If Image is on Net, copy and run from the swap file.
+ */
+ public final static int IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800;
+ /**
+ * System File.
+ */
+ public final static int IMAGE_FILE_SYSTEM = 0x1000;
+ /**
+ * File is a DLL.
+ */
+ public final static int IMAGE_FILE_DLL = 0x2000;
+ /**
+ * File should only be run on a UP machine.
+ */
+ public final static int IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000;
+ /**
+ * Bytes of machine word are reversed.
+ */
+ public final static int IMAGE_FILE_BYTES_REVERSED_HI = 0x8000;
- public final static String [] CHARACTERISTICS = {
- "Relocation info stripped from file",
- "File is executable (i.e. no unresolved externel references)",
- "Line nunbers stripped from file",
- "Local symbols stripped from file",
- "Agressively trim working set",
- "App can handle >2gb addresses",
- "Bytes of machine word are reversed",
- "32 bit word machine",
- "Debugging info stripped from file in .DBG file",
- "If Image is on removable media, copy and run from the swap file",
- "If Image is on Net, copy and run from the swap file",
- "System file",
- "File is a DLL",
- "File should only be run on a UP machine",
- "Bytes of machine word are reversed"
- };
+ /**
+ * Magic value in LordPE's Symbol Table pointer field.
+ */
+ private final static int LORDPE_SYMBOL_TABLE = 0x726F4C5B;
+ /**
+ * Magic value in LordPE's Number of Symbols field.
+ */
+ private final static int LORDPE_NUMBER_OF_SYMBOLS = 0x5D455064;
- private short machine;
- private short numberOfSections;
- private int timeDateStamp;
- private int pointerToSymbolTable;
- private int numberOfSymbols;
- private short sizeOfOptionalHeader; // delta between start of OptionalHeader and start of section table
- private short characteristics;
+ public final static String[] CHARACTERISTICS = { "Relocation info stripped from file",
+ "File is executable (i.e. no unresolved externel references)",
+ "Line nunbers stripped from file", "Local symbols stripped from file",
+ "Agressively trim working set", "App can handle >2gb addresses",
+ "Bytes of machine word are reversed", "32 bit word machine",
+ "Debugging info stripped from file in .DBG file",
+ "If Image is on removable media, copy and run from the swap file",
+ "If Image is on Net, copy and run from the swap file", "System file", "File is a DLL",
+ "File should only be run on a UP machine", "Bytes of machine word are reversed" };
- private SectionHeader [] sectionHeaders;
- private ListIMAGE_NT_HEADERS32
and
- * IMAGE_NT_HEADERS64 structs as defined in
+ * IMAGE_NT_HEADERS64 structs as defined in
* winnt.h
.
*
* typedef struct _IMAGE_NT_HEADERS {
@@ -39,8 +39,8 @@ import ghidra.util.task.TaskMonitorAdapter;
* IMAGE_OPTIONAL_HEADER32 OptionalHeader;
* };
*
- *
- *
+ *
+ *
*/
public class NTHeader implements StructConverter, OffsetValidator {
/**
@@ -82,8 +82,8 @@ public class NTHeader implements StructConverter, OffsetValidator {
public NTHeader() {
}
- private void initNTHeader(FactoryBundledWithBinaryReader reader, int index, SectionLayout layout,
- boolean advancedProcess, boolean parseCliHeaders)
+ private void initNTHeader(FactoryBundledWithBinaryReader reader, int index,
+ SectionLayout layout, boolean advancedProcess, boolean parseCliHeaders)
throws InvalidNTHeaderException, IOException {
this.reader = reader;
this.index = index;
@@ -172,9 +172,9 @@ public class NTHeader implements StructConverter, OffsetValidator {
//low alignment mode?
//
if (optionalHeader != null) {
- if (optionalHeader.getFileAlignment() == optionalHeader.getSectionAlignment()
- && optionalHeader.getSectionAlignment() < 800
- && optionalHeader.getFileAlignment() > 1) {
+ if (optionalHeader.getFileAlignment() == optionalHeader.getSectionAlignment() &&
+ optionalHeader.getSectionAlignment() < 800 &&
+ optionalHeader.getFileAlignment() > 1) {
return rva;
}
}
@@ -270,6 +270,7 @@ public class NTHeader implements StructConverter, OffsetValidator {
fileHeader.processSections(optionalHeader);
fileHeader.processSymbols();
+ fileHeader.processImageRuntimeFunctionEntries();
if (advancedProcess) {
optionalHeader.processDataDirectories(TaskMonitorAdapter.DUMMY_MONITOR);
@@ -278,7 +279,7 @@ public class NTHeader implements StructConverter, OffsetValidator {
void writeHeader(RandomAccessFile raf, DataConverter dc) throws IOException {
- raf.seek( index );
+ raf.seek(index);
raf.write(dc.getBytes(signature));
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/blobs/CliAbstractSig.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/blobs/CliAbstractSig.java
index e82c38b122..303b5138b7 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/blobs/CliAbstractSig.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/cli/blobs/CliAbstractSig.java
@@ -4,9 +4,9 @@
* 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.
@@ -107,12 +107,12 @@ public abstract class CliAbstractSig extends CliBlob implements CliRepresentable
ELEMENT_TYPE_VALUETYPE(0x11),
ELEMENT_TYPE_VAR(0x13), // "Class type variable VAR"
(0x16),
-
+
ELEMENT_TYPE_MVAR(0x1e), // Method type variable MVAR
-
+
ELEMENT_TYPE_INTERNAL(0x21), // Internal (generated internally, "will not be persisted in any way")
ELEMENT_TYPE_MAX(0x22),
-
+
*/
switch (typeCode) {
@@ -431,32 +431,95 @@ public abstract class CliAbstractSig extends CliBlob implements CliRepresentable
}
public class CliTypeFnPtr extends CliSigType {
- private CliAbstractSig sig;
- private boolean isDefSig; // true => MethodDef, false => MethodRef
+ private long dataOffset;
+
+ private CliRetType retType;
+ private CliParam params[];
+ private int sizeOfCount;
+ private byte flags;
+ private int genericParamCount;
+ private int sizeOfGenericCount;
+
+ private int sentinelIndex; // SENTINEL is before the parameter index in this field
+
+ private final int FNPTR_FLAGS_DEFAULT = 0x00;
+ private final int FNPTR_FLAGS_VARARG = 0x05;
+ private final int FNPTR_FLAGS_GENERIC = 0x10;
+ private final int FNPTR_FLAGS_HASTHIS = 0x20;
+ private final int FNPTR_FLAGS_EXPLICITTHIS = 0x40;
public CliTypeFnPtr(BinaryReader reader, CliElementType typeCode) throws IOException {
super(typeCode);
- // TODO: MethodDef and MethodRef sig need to have static isX(reader) methods so I can tell the difference
- //sig = new CliSigMethodRef(blob); // MethodRef is just Def plus possible sentinel and minus potential XORed args in the first byte
+
+ sentinelIndex = -1;
+
+ dataOffset = reader.getPointerIndex();
+
+ // Flags is similar to a MethodDef unless vararg is used.
+ flags = reader.readNextByte();
+
+ if ((flags & FNPTR_FLAGS_GENERIC) == FNPTR_FLAGS_GENERIC) {
+ long origIndex = reader.getPointerIndex();
+ genericParamCount = decodeCompressedUnsignedInt(reader);
+ sizeOfGenericCount = (int) (reader.getPointerIndex() - origIndex);
+ }
+
+ long origIndex = reader.getPointerIndex();
+ int paramCount = decodeCompressedUnsignedInt(reader);
+ this.sizeOfCount = (int) (reader.getPointerIndex() - origIndex);
+
+ try {
+ retType = new CliRetType(reader);
+ }
+ catch (InvalidInputException e) {
+ retType = null;
+ }
+ params = new CliParam[paramCount];
+
+ for (int i = 0; i < paramCount; i++) {
+ if (reader.peekNextByte() == CliElementType.ELEMENT_TYPE_SENTINEL.id()) {
+ reader.readNextByte();
+ sentinelIndex = i;
+ }
+ try {
+ params[i] = new CliParam(reader);
+ }
+ catch (InvalidInputException e) {
+ params[i] = null;
+ }
+ }
}
@Override
public String getRepresentation() {
- return "FnPtr " + sig.getRepresentation();
+ return "FnPtr " /*+ sig.getRepresentation()*/;
}
@Override
public String getShortRepresentation() {
- return "FnPtr " + sig.getShortRepresentation();
+ return "FnPtr " /*+ sig.getShortRepresentation()*/;
}
@Override
public DataType getDefinitionDataType() {
- StructureDataType struct = new StructureDataType(new CategoryPath(PATH), "FnPtr", 0);
- struct.add(CliTypeCodeDataType.dataType, "FnPtr", "FnPtr");
- struct.add(DWORD, "MethodDefOrRef", "index into blob heap");
+ StructureDataType struct =
+ new StructureDataType(new CategoryPath(PATH), "FnPtr_" + dataOffset, 0);
+ struct.add(CliTypeCodeDataType.dataType, CliElementType.ELEMENT_TYPE_FNPTR.toString(),
+ "");
+ struct.add(BYTE, "Flags", "ORed VARARG/GENERIC/HASTHIS/EXPLICITTHIS");
+
+ if (genericParamCount > 0) {
+ struct.add(getDataTypeForBytes(sizeOfGenericCount), "GenParamCount",
+ "Number of generic paramameters for the method");
+ }
+ struct.add(getDataTypeForBytes(sizeOfCount), "ParamCount",
+ "Number of parameter types to follow RetType");
+ struct.add(retType.getDefinitionDataType(), "RetType", null);
+
+ for (int i = 0; i < params.length; i++) {
+ struct.add(params[i].getDefinitionDataType(), "Param" + i, null);
+ }
return struct;
- // TODO: Return the correct size of a signature reference (always 4B in this context perchance?)
}
}
@@ -552,17 +615,18 @@ public abstract class CliAbstractSig extends CliBlob implements CliRepresentable
}
public class CliTypeVarOrMvar extends CliSigType {
+ private long dataOffset;
private int number;
private int numberBytes;
public CliTypeVarOrMvar(BinaryReader reader, CliElementType typeCode) throws IOException {
super(typeCode);
- long origIndex = reader.getPointerIndex();
+ dataOffset = reader.getPointerIndex();
number = decodeCompressedUnsignedInt(reader);
long endIndex = reader.getPointerIndex();
- numberBytes = (int) (endIndex - origIndex);
+ numberBytes = (int) (endIndex - dataOffset);
}
@Override
@@ -572,9 +636,9 @@ public abstract class CliAbstractSig extends CliBlob implements CliRepresentable
@Override
public DataType getDefinitionDataType() {
- StructureDataType struct =
- new StructureDataType(new CategoryPath(PATH), "VarOrMvar", 0);
- struct.add(BYTE, "Type", "Var or Mvar");
+ StructureDataType struct = new StructureDataType(new CategoryPath(PATH),
+ baseTypeCode.toString() + "_" + dataOffset, 0);
+ struct.add(CliTypeCodeDataType.dataType, baseTypeCode.toString(), "");
struct.add(getDataTypeForBytes(numberBytes), "number", null);
return struct;
}
@@ -582,16 +646,24 @@ public abstract class CliAbstractSig extends CliBlob implements CliRepresentable
public class CliTypePtr extends CliSigType {
private List
+
+
+
+
+
diff --git a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java
index 40d6e65325..509ca88a7e 100644
--- a/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java
+++ b/Ghidra/Features/FunctionGraph/src/main/java/ghidra/app/plugin/core/functiongraph/FGProvider.java
@@ -578,6 +578,10 @@ public class FGProvider extends VisualGraphComponentProvider
" +
"See help for more";
+ private static final String DEFAULT_VERTEX_BACKGROUND_COLOR_KEY = "Default Vertex Color";
+ private static final String DEFAULT_VERTEX_BACKGROUND_COLOR_DESCRPTION =
+ "The default background color applied to each vertex";
+
private static final String DEFAULT_GROUP_BACKGROUND_COLOR_KEY = "Default Group Color";
private static final String DEFAULT_GROUP_BACKGROUND_COLOR_DESCRPTION =
"The default background color applied to newly created group vertices";
@@ -80,11 +84,14 @@ public class FunctionGraphOptions extends VisualGraphOptions {
"Signals that any user color changes to a group vertex will apply that same color to " +
"all grouped vertices as well.";
+ public static final Color DEFAULT_VERTEX_BACKGROUND_COLOR = Color.WHITE;
public static final Color DEFAULT_GROUP_BACKGROUND_COLOR = new Color(226, 255, 155);
private static final Color HOVER_HIGHLIGHT_FALL_THROUGH_COLOR = new Color(255, 127, 127);
private static final Color HOVER_HIGHLIGHT_UNCONDITIONAL_COLOR = new Color(127, 127, 255);
private static final Color HOVER_HIGHLIGHT_CONDITIONAL_COLOR = Color.GREEN;
+ private Color defaultVertexBackgroundColor = DEFAULT_VERTEX_BACKGROUND_COLOR;
+
private boolean updateGroupColorsAutomatically = true;
private Color defaultGroupBackgroundColor = DEFAULT_GROUP_BACKGROUND_COLOR;
@@ -104,6 +111,10 @@ public class FunctionGraphOptions extends VisualGraphOptions {
private Map
* UserAdmin.invocation - identifies the name of the application used when displaying usage text.
- * UserAdmin.serverDir - identifies the server directory instead of passing on command line.
+ * UserAdmin.config - identifies the config file instead of passing on command line.
*
* @param args command line arguments
*/
@@ -75,22 +75,18 @@ public class ServerAdmin implements GhidraLaunchable {
* The following properties may be set:
*
* UserAdmin.invocation - identifies the name of the application used when displaying usage text.
- * UserAdmin.serverDir - identifies the server directory instead of passing on command line.
+ * UserAdmin.config - identifies the config file instead of passing on command line.
*
* @param args command line arguments
*/
public void execute(String[] args) {
- File serverDir = null;
-
int ix = 0;
- if (args.length != 0 && !args[0].startsWith("-")) {
- serverDir = new File(args[ix++]);
- }
- else {
- serverDir = getServerDirFromConfig();
- }
+ String configFilePath = args.length != 0 && !args[0].startsWith("-") ? args[ix++]
+ : System.getProperty(CONFIG_FILE_PROPERTY);
+
+ File serverDir = getServerDirFromConfig(configFilePath);
if (serverDir == null || (args.length - ix) == 0) {
displayUsage("");
System.exit(-1);
@@ -105,9 +101,7 @@ public class ServerAdmin implements GhidraLaunchable {
System.exit(-1);
}
- if (propertyUsed) {
- System.out.println("Using server directory: " + serverDir);
- }
+ System.out.println("Using server directory: " + serverDir);
File userFile = new File(serverDir, UserManager.USER_PASSWORD_FILE);
if (!serverDir.isDirectory() || !userFile.isFile()) {
@@ -423,18 +417,32 @@ public class ServerAdmin implements GhidraLaunchable {
}
}
- private File getServerDirFromConfig() {
- String p = System.getProperty(CONFIG_FILE_PROPERTY);
- if (p == null) {
+ /**
+ * Parse contents of specified configFilePath as server.conf to determine
+ * repositories root directory. If configFilePath corresponds to a directory,
+ * that directory will be treated as the repositories root directory.
+ * @param configFilePath path to server.conf or repositories root directory
+ * @return repositories root directory
+ */
+ private File getServerDirFromConfig(String configFilePath) {
+
+ if (configFilePath == null) {
return null;
}
- propertyUsed = true;
- File configFile = new File(p);
+ File configFile = new File(configFilePath);
if (!configFile.exists()) {
System.out.println("Config file not found: " + configFile.getAbsolutePath());
+ return null;
}
+ if (configFile.isDirectory()) {
+ // If specified path is a directory treat as the server root
+ return configFile;
+ }
+
+ System.out.println("Using config file: " + configFilePath);
+
Properties config = new Properties();
InputStream in = null;
try {
@@ -455,8 +463,9 @@ public class ServerAdmin implements GhidraLaunchable {
}
}
- p = config.getProperty(SERVER_DIR_CONFIG_PROPERTY);
+ String p = config.getProperty(SERVER_DIR_CONFIG_PROPERTY);
if (p == null) {
+ System.out.println("Failed to find property: " + SERVER_DIR_CONFIG_PROPERTY);
return null;
}
File dir = new File(p);
@@ -482,8 +491,8 @@ public class ServerAdmin implements GhidraLaunchable {
}
String invocationName = System.getProperty(INVOCATION_NAME_PROPERTY);
System.err.println("Usage: " +
- (invocationName != null ? invocationName : "java " + UserAdmin.class.getName()) +
- (propertyUsed ? "" : "