逆向工程 - Hermes-dec - Hermes VM bytecode(HBC)



參考資訊:
https://github.com/P1sec/hermes-dec
https://github.com/facebook/hermes/blob/main/doc/Design.md
https://github.com/P1sec/hermes-dec/blob/main/src/parsers/hbc_file_parser.py
https://github.com/facebook/hermes/blob/v0.12.0/include/hermes/BCGen/HBC/BytecodeFileFormat.h#L71

uint64_t magic                  // Hermes JavaScript bytecode (0x1f1903c103bc1fc6)
uint32_t version
uint8_t  sourceHash[20]
uint32_t fileLength
uint32_t globalCodeIndex
uint32_t functionCount
uint32_t stringKindCount
uint32_t identifierCount
uint32_t stringCount
uint32_t overflowStringCount
uint32_t stringStorageSize
uint32_t bigIntCount
uint32_t bigIntStorageSize
uint32_t regExpCount
uint32_t regExpStorageSize
uint32_t arrayBufferSize
uint32_t objKeyBufferSize
uint32_t objValueBufferSize
uint32_t segmentID
uint32_t cjsModuleCount
uint32_t functionSourceCount
uint32_t debugInfoOffset