Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The HBC version (84) is not supported. #28

Closed
BaseMax opened this issue Dec 29, 2022 · 10 comments
Closed

The HBC version (84) is not supported. #28

BaseMax opened this issue Dec 29, 2022 · 10 comments

Comments

@BaseMax
Copy link

BaseMax commented Dec 29, 2022

C:\Users\Max\feeld\co.feeld\assets>hbctool disasm index.android.bundle test_hasm
[*] Disassemble 'index.android.bundle' to 'test_hasm' path
Traceback (most recent call last):
  File "C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python310\Scripts\hbctool.exe\__main__.py", line 7, in <module>
  File "C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\hbctool\__init__.py", line 61, in main
    disasm(args['<HBC_FILE>'], args['<HASM_PATH>'])
  File "C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\hbctool\__init__.py", line 33, in disasm
    hbco = hbc.load(f)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\hbctool\hbc\__init__.py", line 29, in load
    assert version in HBC, f"The HBC version ({version}) is not supported."
AssertionError: The HBC version (84) is not supported.
@jieunboy0516
Copy link

its not supported yet i think

@jieunboy0516
Copy link

@hab12335
Copy link

hab12335 commented Jan 3, 2023

just found this https://github.com/niosega/hbctool/tree/draft/hbc-v84

niosega@ac6fabb

parser is from 76 (no good)

V

@stuxctf
Copy link

stuxctf commented Feb 7, 2023

@BaseMax run with poetry, the pip package generate this error.

Clone the repo

poetry install
poetry run hbctool [options]

@BaseMax
Copy link
Author

BaseMax commented Feb 8, 2023

@BaseMax run with poetry, the pip package generate this error.

Clone the repo

poetry install poetry run hbctool [options]

Thanks, do you mean HBC version 84 now supported?

@martooy
Copy link

martooy commented Feb 8, 2023

I tried this with some version 84 code with the above steps and get this error:

bash-5.2$ poetry run hbctool  disasm ~/index.android.bundle disassembly
[*] Disassemble '/Users/msells/index.android.bundle' to 'disassembly' path
[*] Hermes Bytecode [ Source Hash: d17705580035ede988df772ff322104fc925d6cc, HBC Version: 84 ]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/msells/src/hbctool/hbctool/__init__.py", line 61, in main
    disasm(args['<HBC_FILE>'], args['<HASM_PATH>'])
  File "/Users/msells/src/hbctool/hbctool/__init__.py", line 41, in disasm
    hasm.dump(hbco, hasmpath)
  File "/Users/msells/src/hbctool/hbctool/hasm.py", line 67, in dump
    write_func(f, hbc.getFunction(i), i, hbc)
  File "/Users/msells/src/hbctool/hbctool/hbc/hbc84/__init__.py", line 59, in getFunction
    insts = disassemble(bc)
  File "/Users/msells/src/hbctool/hbctool/hbc/hbc84/translator.py", line 33, in disassemble
    opcode = opcode_mapper[bc[i]]
IndexError: list index out of range

$ file index.android.bundle
index.android.bundle: Hermes JavaScript bytecode, version 84

I'll look at this later today and see if I can figure out why it's unhappy.

@hexpwn
Copy link

hexpwn commented Apr 6, 2023

I submitted a pull request (#31) that fixes this. Until it is merged you can check out the changes I made or clone my fork.

@bongtrop
Copy link
Owner

related to #31, thank to @hexpwn. this issue have closed.

@BaseMax
Copy link
Author

BaseMax commented Apr 11, 2023

@BaseMax run with poetry, the pip package generate this error.

Clone the repo

poetry install poetry run hbctool [options]

Thanks, I am trying.

C:\Users\Max\hbctool>git pull

C:\Users\Max\hbctool>poetry run hbctool disasm "C:/Users/Max/appname/co.appname/assets/index.android.bundle" test_hasm
running disasm
[*] Disassemble 'C:/Users/Max/appname/co.appname/assets/index.android.bundle' to 'test_hasm' path
C:/Users/Max/appname/co.appname/assets/index.android.bundle
Load function
{85: <class 'hbctool.hbc.hbc85.HBC85'>, 84: <class 'hbctool.hbc.hbc84.HBC84'>, 76: <class 'hbctool.hbc.hbc76.HBC76'>, 74: <class 'hbctool.hbc.hbc74.HBC74'>, 62: <class 'hbctool.hbc.hbc62.HBC62'>, 59: <class 'hbctool.hbc.hbc59.HBC59'>}
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Max\hbctool\hbctool\__init__.py", line 69, in main
    disasm(args['<HBC_FILE>'], args['<HASM_PATH>'])
  File "C:\Users\Max\hbctool\hbctool\__init__.py", line 34, in disasm
    hbco = hbc.load(f)
  File "C:\Users\Max\hbctool\hbctool\hbc\__init__.py", line 30, in load
    print(version)
UnboundLocalError: local variable 'version' referenced before assignment

@Hiltoness
Copy link

I tried this with some version 84 code with the above steps and get this error:

bash-5.2$ poetry run hbctool  disasm ~/index.android.bundle disassembly
[*] Disassemble '/Users/msells/index.android.bundle' to 'disassembly' path
[*] Hermes Bytecode [ Source Hash: d17705580035ede988df772ff322104fc925d6cc, HBC Version: 84 ]
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/msells/src/hbctool/hbctool/__init__.py", line 61, in main
    disasm(args['<HBC_FILE>'], args['<HASM_PATH>'])
  File "/Users/msells/src/hbctool/hbctool/__init__.py", line 41, in disasm
    hasm.dump(hbco, hasmpath)
  File "/Users/msells/src/hbctool/hbctool/hasm.py", line 67, in dump
    write_func(f, hbc.getFunction(i), i, hbc)
  File "/Users/msells/src/hbctool/hbctool/hbc/hbc84/__init__.py", line 59, in getFunction
    insts = disassemble(bc)
  File "/Users/msells/src/hbctool/hbctool/hbc/hbc84/translator.py", line 33, in disassemble
    opcode = opcode_mapper[bc[i]]
IndexError: list index out of range

$ file index.android.bundle
index.android.bundle: Hermes JavaScript bytecode, version 84

I'll look at this later today and see if I can figure out why it's unhappy.

Did you resolve it? I also encountered this in version 89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants