{"id":13730033,"url":"https://github.com/GrammaTech/ddisasm","last_synced_at":"2025-05-08T02:31:13.144Z","repository":{"id":37514077,"uuid":"148640580","full_name":"GrammaTech/ddisasm","owner":"GrammaTech","description":"A fast and accurate disassembler","archived":false,"fork":false,"pushed_at":"2025-02-26T00:16:51.000Z","size":30463,"stargazers_count":705,"open_issues_count":28,"forks_count":63,"subscribers_count":40,"default_branch":"main","last_synced_at":"2025-05-08T00:52:09.830Z","etag":null,"topics":["analysis","binary","binary-analysis","binary-rewriting","disassembler","gtirb","intermediate-representation","reverse-engineering"],"latest_commit_sha":null,"homepage":"https://grammatech.github.io/ddisasm/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrammaTech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2018-09-13T13:19:08.000Z","updated_at":"2025-05-07T02:33:19.000Z","dependencies_parsed_at":"2024-01-10T16:58:15.844Z","dependency_job_id":"cba892d5-97b2-4ad9-8840-1863c8a9f170","html_url":"https://github.com/GrammaTech/ddisasm","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrammaTech%2Fddisasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrammaTech%2Fddisasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrammaTech%2Fddisasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrammaTech%2Fddisasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrammaTech","download_url":"https://codeload.github.com/GrammaTech/ddisasm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252986712,"owners_count":21836210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["analysis","binary","binary-analysis","binary-rewriting","disassembler","gtirb","intermediate-representation","reverse-engineering"],"created_at":"2024-08-03T02:01:08.984Z","updated_at":"2025-05-08T02:31:09.849Z","avatar_url":"https://github.com/GrammaTech.png","language":"C++","readme":"Datalog Disassembly\n===================\n\nDDisasm is a *fast* disassembler which is *accurate* enough for the\nresulting assembly code to be reassembled.  DDisasm is implemented\nusing the datalog ([souffle](https://github.com/souffle-lang/souffle))\ndeclarative logic programming language to compile disassembly rules\nand heuristics.  The disassembler first parses ELF/PE file information\nand decodes a superset of possible instructions to create an initial\nset of datalog facts.  These facts are analyzed to identify *code\nlocation*, *symbolization*, and *function boundaries*.  The results of\nthis analysis, a refined set of datalog facts, are then translated to\nthe [GTIRB](https://github.com/grammatech/gtirb) intermediate\nrepresentation for binary analysis and reverse engineering.  The\n[GTIRB pretty printer](https://github.com/grammatech/gtirb-pprinter)\nmay then be used to pretty print the GTIRB to reassemblable assembly\ncode.\n\n## Binary Support\n\nBinary formats:\n\n - ELF (Linux)\n - PE  (Windows)\n\nInstruction Set Architectures (ISAs):\n\n-  x86_32\n-  x86_64\n-  ARM32\n-  ARM64\n-  MIPS32\n\n## Getting Started\n\nYou can run a prebuilt version of Ddisasm using Docker:\n\n```bash\ndocker pull grammatech/ddisasm:latest\n```\n\nDdisasm can be used to disassemble a binary into the [GTIRB](https://github.com/grammatech/gtirb) representation.\nWe can try it with one of the examples included in the repository.\n\nFirst, start the Ddisasm docker container:\n```bash\ndocker run -v $PWD/examples:/examples -it grammatech/ddisasm:latest\n```\n\nWithin the Docker container, let us build one of the examples:\n\n```bash\napt update \u0026\u0026 apt install gcc -y\ncd /examples/ex1\ngcc ex.c -o ex\n```\n\nNow we can proceed to disassemble the binary:\n\n```bash\nddisasm ex --ir ex.gtirb\n```\n\nOnce you have the GTIRB representation, you can make programmatic changes to the\nbinary using [GTIRB](https://github.com/grammatech/gtirb) or [gtirb-rewriting](https://github.com/grammatech/gtirb-rewriting).\n\nThen, you can use [gtirb-pprinter](https://github.com/grammatech/gtirb-pprinter) (included in the Docker image) to produce\na new version of the binary:\n\n```\ngtirb-pprinter ex.gtirb -b ex_rewritten\n```\n\nInternally, `gtirb-pprinter` will generate an assembly file and invoke the compiler/assembler (e.g. gcc)\nto produce a new binary. `gtirb-pprinter` will take care or generating all the necessary command line\noptions to generate a new binary, including compilation options, library dependencies, or version linker scripts.\n\nYou can also use `gtirb-pprinter` to generate an assembly listing for manual modification:\n```bash\ngtirb-pprinter ex.gtirb --asm ex.s\n```\n\nThis assembly listing can then be manually recompiled:\n```bash\ngcc -nostartfiles ex.s -o ex_rewritten\n```\n\nPlease take a look at our [documentation](https://grammatech.github.io/ddisasm/) for additional information.\n\n## [Documentation](https://grammatech.github.io/ddisasm/)\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## External Contributors\n\n * Programming Language Group, The University of Sydney: Initial support for ARM64.\n * Github user gogo2464: Documentation refactoring.\n\n## Cite\n\n1. [Datalog Disassembly](https://www.usenix.org/conference/usenixsecurity20/presentation/flores-montoya)\n\n```\n@inproceedings {flores-montoya2020,\n    author = {Antonio Flores-Montoya and Eric Schulte},\n    title = {Datalog Disassembly},\n    booktitle = {29th USENIX Security Symposium (USENIX Security 20)},\n    year = {2020},\n    isbn = {978-1-939133-17-5},\n    pages = {1075--1092},\n    url = {https://www.usenix.org/conference/usenixsecurity20/presentation/flores-montoya},\n    publisher = {USENIX Association},\n    month = aug,\n}\n```\n\n2. [GTIRB](https://arxiv.org/abs/1907.02859)\n\n```\n@misc{schulte2020gtirb,\n    title={GTIRB: Intermediate Representation for Binaries},\n    author={Eric Schulte and Jonathan Dorn and Antonio Flores-Montoya and Aaron Ballman and Tom Johnson},\n    year={2020},\n    eprint={1907.02859},\n    archivePrefix={arXiv},\n    primaryClass={cs.PL}\n}\n```\n","funding_links":[],"categories":["Code-gen"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGrammaTech%2Fddisasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGrammaTech%2Fddisasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGrammaTech%2Fddisasm/lists"}