Due to limitations in the tools used, we are providing a simplified version of the dataset. The complete dataset can be made available upon request.
This repository provides a set of tools for recovering decompiled code, predicting control flow, and evaluating code similarity. The tools are organized into several modules that handle different stages of the recovery process and similarity detection.
- This module is designed to build the Semantic Distortion Database, which contains common decompiler artifacts and corresponding recovery suggestions. Currently, this feature is not yet available.
- Purpose: To predict and guide semantic recovery using the database.
- This module is used for control flow prediction, which helps in recovering control structures like loops and conditionals that may have been flattened or altered during optimization or obfuscation. This functionality is also not yet provided.
- Purpose: To predict control flow sequences for decompiled code.
- This module contains the three-stage recovery pipeline, which optimizes and recovers decompiled code by:
1. Semantic recovery: Restoring program behavior using context-aware semantic adjustments. 2. Structural recovery: Rebuilding control flow and refining code layout for improved coherence. 3. Lexical recovery: Enhancing variable names and code structure for better readability.
- Purpose: To transform decompiled code into a source-like format that maintains functionality and enhances readability.
- This module is responsible for similarity detection between decompiled functions and a pre-built function library. It uses embedding models (e.g., GraphCodeBERT) to compute the similarity between functions.
- Purpose: To detect functional similarities between the recovered code and functions in a library using embeddings.
- This module is used to evaluate code similarity. It takes in the decompiled and recovered code and evaluates its similarity to the source code or library based on various similarity metrics such as token-level similarity, structural similarity, and semantic alignment.
- Purpose: To assess the effectiveness of the recovery process and the similarity between decompiled and source code.
- This file lists the required dependencies and libraries needed to run the scripts and modules in this repository. You can install the dependencies with:
pip install -r requirements.txt
Once the relevant modules are available, you can use them in the following manner:
Semantic Database Construction & Prediction:
Use the construct_semantic_database module to generate and predict semantic recovery suggestions for decompiled code.
Control Flow Prediction:
Use the control_flow_predict module to predict the control flow structures for the decompiled code.
Decompiled Code Recovery:
Use the Decompiled_code_recovery module to recover decompiled functions by optimizing their lexical, semantic, and structural aspects.
Similarity Detection:
Use the Similarity_detection module to compute function similarity using embeddings.
Code Similarity Evaluation:
Use the Code_Similarity_Evaluate module to evaluate how well the recovered code matches the source or function library.
construct_semantic_database and control_flow_predict modules are currently under development. These modules will be available after the paper is accepted and the repository is updated.