clearbluejar / ghidrecomp Goto Github PK
View Code? Open in Web Editor NEWPython Command-Line Ghidra Decompiler
License: GNU General Public License v3.0
Python Command-Line Ghidra Decompiler
License: GNU General Public License v3.0
The get_calling
function sets the default parameter for cgraph
as CallGraph()
. Using an object as a default argument in a Python function results in the object being initialized only once. This can lead to unexpected results when the function is called multiple times.
A better approach would be to set the default value of cgraph to None and then initialize it within the function if it is not provided.
def get_calling(f: "ghidra.program.model.listing.Function", cgraph: CallGraph = None, depth: int = 0, visited: tuple = None, verbose=False, include_ns=True, start_time=None, max_run_time=None, max_depth=MAX_DEPTH):
if cgraph is None:
cgraph = CallGraph()
AttributeError: type object 'ghidra.program.util.GhidraProgramUtilities' has no attribute 'setAnalyzedFlag'
in https://github.com/clearbluejar/ghidrecomp/actions/runs/5007536581/jobs/8974271234
Current images is built on x84-64 and runs poorly with Mac M1 Arm. (Ghidra hangs)
Build new image with --bullseye variant.
File "/workspaces/ghidrecomp/ghidrecomp/decompile.py", line 92, in decompile_to_single_file
decompiler = CppExporter(create_header, create_file, emit_types, exclude_tags, tags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: No matching overloads found for constructor ghidra.app.util.exporter.CppExporter(bool,bool,bool,bool,NoneType), options are:
public ghidra.app.util.exporter.CppExporter(ghidra.app.decompiler.DecompileOptions,boolean,boolean,boolean,boolean,java.lang.String)
public ghidra.app.util.exporter.CppExporter()
For uploading artifacts in Github workflows. need to handle trouble characters.
Invalid characters include: Double quote ", Colon :, Less than <, Greater than >, Vertical bar |, Asterisk *, Question mark ?, Carriage return \r, Line feed \n
The following characters are not allowed in files that are uploaded due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.
Ensure ghidrecomp can run on Ghidra 11
Traceback (most recent call last): File "PdbPlugin.java", line 209, in pdb.PdbPlugin.findPdb java.net.java.net.SocketException: java.net.SocketException: Invalid argument: connect The above exception was the direct cause of the following exception: Traceback (most recent call last): File "PdbPlugin.java", line 209, in pdb.PdbPlugin.findPdb java.io.java.io.IOException: java.io.IOException: Unable to establish loopback connection The above exception was the direct cause of the following exception: Traceback (most recent call last): File "PdbPlugin.java", line 209, in pdb.PdbPlugin.findPdb Exception: Java Exception The above exception was the direct cause of the following exception: Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users.______166\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\ghidrecomp.exe_main.py", line 7, in File "C:\Users.______166\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ghidrecomp_main.py", line 11, in main decompile(args) File "C:\Users._______166\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ghidrecomp\decompile.py", line 192, in decompile pdb = get_pdb(program) ^^^^^^^^^^^^^^^^ File "C:\Users._______166\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ghidrecomp\utility.py", line 126, in get_pdb pdb = PdbPlugin.findPdb(prog, find_opts, ConsoleTaskMonitor()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ java.io.java.io.UncheckedIOException: java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
Instead of using python threading, would it be faster to use ParallelDecompiler?
from decompiler import MyDecompileConfigurer
from ghidra.app.decompiler.parallel import ParallelDecompiler
from ghidra.app.decompiler.parallel import DecompilerCallback
from ghidra.app.decompiler.parallel import DecompileConfigurer
configurer = MyDecompileConfigurer()
callback = DecompilerCallback(program, DecompileConfigurer)
ParallelDecompiler.decompileFunctions(callback, program, all_funcs, None, monitor)
@JImplements(DecompileConfigurer, deferred=False)
class MyDecompileConfigurer:
@JOverride
def configure(self, decompiler: 'ghidra.app.decompiler.DecompInterface'):
decompiler.toggleCCode(False)
decompiler.toggleSyntaxTree(True)
decompiler.setSimplificationStyle("decompile")
opts = DecompileOptions()
opts.grabFromProgram(p)
decompiler.setOptions(opts)
cwd
$ tree -L 1 ghidrecomps/
ghidrecomps/
├── afd.sys.10.0.22621.1415
├── bsim-xmls
├── ghidra_projects
├── ls
├── ls_aarch64
└── symbols
Put all bin outout under bins
If binary names match project files will be overwritten.
ghidrecomp bin1
cd /other_path
ghidrecomp bin1
conflict!
Add ability to apply custom Ghidra GDT prior to decomp.
ghidrecomp : The term 'ghidrecomp' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + ghidrecomp tm.exe + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (ghidrecomp:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.