Git Product home page Git Product logo

Comments (6)

justfoxing avatar justfoxing commented on July 18, 2024 1

Fixed in jfx-bridge 0.9.0.

What was happening was that slices created when the [1:] syntax was used were being pushed across the bridge as bridged objects. When they hit __getitem__ on the array on the other side, it expects either an int or something where the type is "slice" - but these were type "_bridged_slice". Now slices are serialized across the bridge as their start/stop/step values, and recreated as local slice objects on the other side. The type is what's expected, and __getitem__ is happy again.

TL;DR - update and reinstall with pip install jfx-bridge --upgrade --force-reinstall; python -m ghidra_bridge.install_server <script location>, and you should be able to go back to doing inputs[1:] without the list() wrapping.

from jfx_bridge.

justfoxing avatar justfoxing commented on July 18, 2024

from jfx_bridge.

6r0k3d avatar 6r0k3d commented on July 18, 2024

Ok, just got this running in an IDE instead of notepad++ and have actual useful info-

my code runs the following:
print("length inputs: ", len(inputs[1:]))

looks like bridge doesnt like list slicing?

Thought this picture captured the info better then trying to individually copy / paste the Watch output:
image

from jfx_bridge.

6r0k3d avatar 6r0k3d commented on July 18, 2024

Ha, the timing on our posts.

Full script is here, I'm working on modifying GRIMM's GEARSHIFT to auto extract C++ classes: GEARSHIFT

from jfx_bridge.

justfoxing avatar justfoxing commented on July 18, 2024

Cool, thanks for that. I've confirmed I can replicate the error, and that it doesn't happen in purely internal Ghidra python - think you're right and it's an issue with how slices work. I'm going to have to find some time to take a poke around and work out what's going on.

As a quick and dirty hack-around, you can fix this by casting the remote array to a local list (e.g. inputs[1:] would become list(inputs)[1:]) - the bridge will extract the content of the array into a python list, which will respect slicing. Obviously not the ideal solution (especially for large arrays :/), but it might stop you getting blocked for now, until I can work out an actual fix.

from jfx_bridge.

6r0k3d avatar 6r0k3d commented on July 18, 2024

Thanks, work around is doing the trick for the moment, hopefully I don't hit anything else...

Did some single stepping at the list slice and was getting the following output in the ghidra console:

Traceback (most recent call last):
  File "C:\Users\student\Downloads\ghidra_10.0.4_PUBLIC_20210928\ghidra_10.0.4_PUBLIC\Ghidra\Features\Python\ghidra_scripts\jfx_bridge\bridge.py", line 976, in local_get
    result = getattr(target, name)
AttributeError: 'method_descriptor' object has no attribute 'shape'
(u'target: ', <method '__getitem__' of 'array.array' objects>)
(u'name: ', u'__len__')
Traceback (most recent call last):
  File "C:\Users\student\Downloads\ghidra_10.0.4_PUBLIC_20210928\ghidra_10.0.4_PUBLIC\Ghidra\Features\Python\ghidra_scripts\jfx_bridge\bridge.py", line 976, in local_get
    result = getattr(target, name)
AttributeError: 'method_descriptor' object has no attribute '__len__'

Dunno if shape and __len__ need to be added to _LOCAL_METHODS?

image

Hopefully that's useful

from jfx_bridge.

Related Issues (5)

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.