bongtrop / hbctool

Hermes Bytecode Reverse Engineering Tool (Assemble/Disassemble Hermes Bytecode)
MIT License
461 stars 81 forks source link

HBC 96 Support request #46

Closed EDLLT closed 1 week ago

EDLLT commented 1 week ago

I found this fork which added hbc 96 support https://github.com/weilanxiao/hbctool/tree/hbc_96

unfortunately, trying to use it gives out the following error

hbctool disasm index.android.bundle libnasm
[*] Disassemble 'index.android.bundle' to 'libnasm' path
[*] Hermes Bytecode [ Source Hash: fbe0885c69a7216007cd5002c77435644bda4987, HBC Version: 96 ]
Traceback (most recent call last):
  File "/home/user/.venv/bin/hbctool", line 6, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/user/src/hbctool/hbctool/__init__.py", line 61, in main
    disasm(args['<HBC_FILE>'], args['<HASM_PATH>'])
  File "/home/user/src/hbctool/hbctool/__init__.py", line 41, in disasm
    hasm.dump(hbco, hasmpath)
  File "/home/user/src/hbctool/hbctool/hasm.py", line 67, in dump
    write_func(f, hbc.getFunction(i), i, hbc)
                  ^^^^^^^^^^^^^^^^^^
  File "/home/user/src/hbctool/hbctool/hbc/hbc96/__init__.py", line 59, in getFunction
    insts = disassemble(bc)
            ^^^^^^^^^^^^^^^
  File "/home/user/src/hbctool/hbctool/hbc/hbc96/translator.py", line 43, in disassemble
    val = conv_to(bc[i:i+size])
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/src/hbctool/hbctool/util.py", line 297, in to_uint8
    return buf[0]
           ~~~^^^
IndexError: list index out of range
EDLLT commented 1 week ago

@weilanxiao if you could spare some time, could you please tell me how to fix it? Ty

EDLLT commented 1 week ago

https://github.com/Kirlif/HBC-Tool

Found this, seems to have worked