Skip to content

An LLM Assisted Transpiler for C to Rust Translation

Notifications You must be signed in to change notification settings

FarrukhCyber/SafeTrans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Directory Structure

  • dataset.tar contains the source C programs along with test cases. It also contains csv files for test case coverage and code metrics (no. of pointers, no. of functions etc.
  • rust_translations.tar contains final translated programs from all translation outcomes (correct, compilation error programs etc.)
  • results contains all the evaluation files.
  • vulnerability_analysis has all the files related to our security analysis.
  • vulnerability_analysis/model_checker should contain source files for ESBMC tool.

Install

Run the following command to setup a conda environment with all the necessary dependencies:

conda env create -f dependencies.yml -n new_env_name

Setup the API keys in your terminal session according to the selected model:

export DEEPSEEK_API_KEY=<your_key>
export OPENAI_API_KEY=<your_key>

To use the models from bedrock update the aws_config.json with the required configurations

SafeTrans Usage

Run the following command by specifying the model and deployed location:

python safe_trans.py --model_name <model_name> --service_name <service_name>

It will generate intermediate directories with repair reports, compile reports and final results in rust_translations .

Vulnerability Detection Usage

  • Run scan.py to detect vulnerable files in the C programs. It generates a scan_report.json
  • Run vulnerability_analysis/create_json_report.py file to parse log files from the ESBMC output and generate a vulnerability_summary.json report which includes identified vulnerability types and frequency.

About

An LLM Assisted Transpiler for C to Rust Translation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors