This repository contains the datasets and source code for the paper, "LibAM: An Area Matching Framework for Detecting Third-party Libraries in Binaries".

- Update the dataset-I
You can pull a docker image to quickly use LibAM, whether to reproduce all the results in the paper or use your own custom dataset.
-
1. Pull the docker image
docker pull ivoryseeker/libam-img:latest docker run -it --name libam --gpus all ivoryseeker/libam-img:latest /bin/bash -
2. Reproduce the evaluation
cd /work/libam ./0_prepare_dataset.sh python3 1_preprocess.py python3 2_embedding.py python3 3_func_compare.py python3 4_tpl_detection.py python3 5_area_detection.py -
3. Use your custom dataset
Replace
dataset2under/work/libam/datasetwith your custom dataset. The new dataset structure must be consistent withdataset2.- dataset - dataset2 - 1_binary - target - candidateModify the name of the dataset in
0_prepare_dataset.shandsettings.py. It can bedataset2,dataset3or a custom dataset.
- Python 3.8
- IDA Pro 6.8 (with Python 2.7 package)
code/: All source code of LibAM ()dataset/: All four datasets used in LibAMenvs/: Python dependencies of LibAMgroundtruth/: The ground truth for dataset2 and dataset3 in LibAMcode/libam/data/: All detection results and intermediate data are saved in the directoryresult/: Final detection results in paper and all intermediate data from the detection process. You can use this data rather than raw binaries indataset/to run any process of LibAM.
(For the purpose of large-scale analysis, the code is set to run with multiple processes by default. However, it can be easily modified to run with a single process. In fact, for dataset2 and dataset3, running with a single process is already quite fast.)
Without using docker, you can download the code to the local environment and build it yourself. It is not recommended to do this as there may be some dependency issues that need to be resolved.