{"id":42934633,"url":"https://github.com/binsync/varbert_api","last_synced_at":"2026-02-23T02:41:08.384Z","repository":{"id":211161164,"uuid":"636384051","full_name":"binsync/varbert_api","owner":"binsync","description":"A Python API to VarBERT, a BERT based model for suggesting variable names in decompiled code.","archived":false,"fork":false,"pushed_at":"2024-09-09T05:00:06.000Z","size":3527,"stargazers_count":49,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-07T23:31:44.467Z","etag":null,"topics":["decompilation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binsync.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-04T18:19:29.000Z","updated_at":"2025-04-02T02:18:29.000Z","dependencies_parsed_at":"2023-12-06T21:20:24.443Z","dependency_job_id":"b56f4ce2-de56-4887-a9d1-79f7250b257f","html_url":"https://github.com/binsync/varbert_api","commit_stats":null,"previous_names":["binsync/varbert_api"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/binsync/varbert_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binsync%2Fvarbert_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binsync%2Fvarbert_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binsync%2Fvarbert_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binsync%2Fvarbert_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binsync","download_url":"https://codeload.github.com/binsync/varbert_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binsync%2Fvarbert_api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28917608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T19:10:10.838Z","status":"ssl_error","status_checked_at":"2026-01-30T19:06:40.573Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decompilation"],"created_at":"2026-01-30T19:14:41.725Z","updated_at":"2026-01-30T19:14:42.343Z","avatar_url":"https://github.com/binsync.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VarBERT API\nThe VarBERT API is a Python library to access and use the latest models from the S\u0026P 2024 work \n[\"\"Len or index or count, anything but v1\": Predicting Variable Names in Decompilation Output with Transfer Learning\"](https://www.atipriya.com/files/papers/varbert_oakland24.pdf), featuring VarBERT. \nVarBERT is a BERT-based model that predicts variable names for decompiled code.\nTo train new models and understand the pipeline, see the [VarBERT paper repo](https://github.com/sefcom/VarBERT).\nSpecialized models exist for IDA Pro and Ghidra, but can be used on any decompiler. \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./assets/varbert_no_background.png\" style=\"width: 50%;\" alt=\"DAILA context menu\"/\u003e\n\u003c/p\u003e\n\nThe main focus of this project is to provide an library API and CLI access to VarBERT models, but, it has \nbeen designed to be used in decompiler directly using the [DAILA](https://github.com/mahaloz/DAILA) project. \nDAILA comes with the VarBERT API bundled, so you do not need to install VarBERT if you are using DAILA.\n\n## Install \n```\npip3 install varbert \u0026\u0026 varbert --download-models\n```\n\nThis will install the VarBERT API library and download the models to be stored inside the VarBERT package.\nYou can optionally provide a decompiler name to `--download-models` to only download the models for that decompiler.\n\n## Usage\nThe VarBERT API can be used in three ways:\n- From the CLI, directly on decompiled text (without an attached decompiler)\n- As a scripting library \n- As a decompiler plugin (using [DALIA](https://github.com/mahaloz/DAILA)) \n\n### Command Line (without running a decompiler)\nNote that VarBERT runs better when it is directly hooked up to a decompiler because it can use additional semantic information that the decompiler knows about the decompiled code.\nHowever, we do have the ability to run VarBERT without a running decompiler, only operating on the text from the command line.\n\nRunning the following will cause VarBERT to read a function from standard input and output the function with predicted variable names to standard out:\n```bash\nvarbert --predict --decompiler ida\n```\n\nYou can select different decompilers that will use different models that are trained on the different decompilers.\nIf you do not specify a decompiler, the default is IDA Pro.\nAs an example, you can also give no decompiler:\n```bash \n echo \"__int64 sub_400664(char *a1,char *a2)\\n {}\" | varbert -p\n```\n\n### Scripting\n#### Without Decompiler\n```python\nfrom varbert import VariableRenamingAPI\napi = VariableRenamingAPI(decompiler_name=\"ida\", use_decompiler=False)\nnew_names, new_code = api.predict_variable_names(decompilation_text=\"__int64 sub_400664(char *a1,char *a2)\\n {}\", use_decompiler=False)\nprint(new_code)\n```\n\nYou can also find more examples in the [tests.py](./tests/tests.py) file.\n\n#### Inside Decompiler\nYou can use VarBERT as a scripting library inside your decompiler, utilizing LibBS.\n```python\nfrom varbert import VariableRenamingAPI\nfrom libbs.api import DecompilerInterface\ndec = DecompilerInterface()\napi = VariableRenamingAPI(decompiler_interface=dec)\nfor func_addr in dec.functions:\n    new_names, new_code = api.predict_variable_names(function=dec.functions[func_addr])\n    print(new_names)\n```\n\n### As a Decompiler Plugin\nIf you would like to use VarBERT as a decompiler plugin, you can use [DAILA](https://github.com/mahaloz/DAILA).\nYou should follow the instructions on the DAILA repo to install DAILA, but it's generally as simple as:\n```bash\npip3 install dailalib \u0026\u0026 daila --install\n```\n\nYou can find a demo of VarBERT running inside DAILA below:\n\n[![VarBERT Demo](https://img.youtube.com/vi/nUazQm8sFL8/0.jpg)](https://youtu.be/nUazQm8sFL8 \"DAILA v2.1.4: Renaming variables with local VarBERT model\")\n\n## Citing \nIf you use VarBERT in your research, please cite our paper:\n```\nTODO\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinsync%2Fvarbert_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinsync%2Fvarbert_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinsync%2Fvarbert_api/lists"}