Skip to content

How to preprocess new dataset and generate embedding representations? #30

Description

@randomFriendlyGuy

Thanks for your excellent research.
I am trying to apply HermesSim on a new dataset, and I have successfully run lifting/pcode_lifter.py.
However, I was unable to run preprocess/preprocessing_pcode.py, which is invoked by preprocess/preprocess_all.sh.
The error indicates that several files are required, including opcodes_dict.json in pcode_acfg, pcode_tscg, pcode_sog, pcode_iscg. Even after copying these files from inputs/pcode_raw/pcode_xxx, it still throws exception.

python preprocess/preprocessing_pcode.py --freq-mode -f pkl -s new_testing -i dbs/new/features/pcode_raw_new -o inputs/pcode-new

Traceback (most recent call last):
  File "/xxxx/HermesSim/preprocess/preprocessing_pcode.py", line 478, in <module>
    main()
    ~~~~^^
  File "/xxxx/lib/python3.13/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/xxxx/lib/python3.13/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/xxxx/lib/python3.13/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/xxxx/lib/python3.13/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/xxxx/HermesSim/preprocess/preprocessing_pcode.py", line 461, in main
    str_dict, pkl_dict = create_functions_dict(
                         ~~~~~~~~~~~~~~~~~~~~~^
        input_dir, opc_dicts, dump_str, dump_pkl)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/xxxx/HermesSim/preprocess/preprocessing_pcode.py", line 395, in create_functions_dict
    tqdm(map(process_one_file, args), total=len(args)):
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/xxxx/lib/python3.13/site-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
               ^^^^^^^^
  File "/xxxx/HermesSim/preprocess/preprocessing_pcode.py", line 358, in process_one_file
    f_list = create_features_matrix(
        nodes, fva_data, opc_dicts[gtype], gtype, arch)
  File "/xxxx/HermesSim/preprocess/preprocessing_pcode.py", line 312, in create_features_matrix
    opcs[i] = opc_dict[ty]
              ~~~~~~~~^^^^
KeyError: 'mi_reg

I would appreciate your assistance running HermesSim on the new dataset. Could you please provide detailed guidance (or a script) on generating embedding vectors for new binaries? Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions