Coder Social home page Coder Social logo

ghidrecomp's People

Contributors

clearbluejar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ghidrecomp's Issues

Incorrect Default Parameter in get_calling Function

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()

CppExporter breaks in 10.3

 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()

Handle bad characters in filenames

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.

java.io.java.io.UncheckedIOException (ghidra v11.0.3, windows 11 pro)

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

ParralelDecompiler Faster?

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)

Fix output folder directories

  • Put decomps in own folder
  • Put all output under "ghidrecomps" dir
  • Update tests to ensure no folders are created in cwd

Organise output directory

 $ 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

it is not working on windows

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.