{"id":13419981,"url":"https://github.com/lifting-bits/codereason","last_synced_at":"2025-03-15T06:31:07.896Z","repository":{"id":23939366,"uuid":"27320759","full_name":"lifting-bits/codereason","owner":"lifting-bits","description":"Semantic Binary Code Analysis Framework","archived":true,"fork":false,"pushed_at":"2015-09-28T19:43:31.000Z","size":27684,"stargazers_count":124,"open_issues_count":28,"forks_count":21,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-11-11T00:02:29.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lifting-bits.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}},"created_at":"2014-11-30T01:28:38.000Z","updated_at":"2024-11-06T19:44:47.000Z","dependencies_parsed_at":"2022-07-25T13:52:06.250Z","dependency_job_id":null,"html_url":"https://github.com/lifting-bits/codereason","commit_stats":null,"previous_names":["trailofbits/codereason"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifting-bits%2Fcodereason","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifting-bits%2Fcodereason/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifting-bits%2Fcodereason/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifting-bits%2Fcodereason/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifting-bits","download_url":"https://codeload.github.com/lifting-bits/codereason/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243694947,"owners_count":20332619,"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":[],"created_at":"2024-07-30T22:01:23.819Z","updated_at":"2025-03-15T06:31:07.879Z","avatar_url":"https://github.com/lifting-bits.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"readme":"# CodeReason\n[![Build Status](https://travis-ci.org/trailofbits/codereason.svg)](https://travis-ci.org/trailofbits/codereason)\n[![Coverity Scan Build Status](https://scan.coverity.com/projects/5509/badge.svg)](https://scan.coverity.com/projects/5509)\n[![Slack Chat](http://empireslacking.herokuapp.com/badge.svg)](https://empireslacking.herokuapp.com/)\n\nCodeReason is a semantic binary code analysis framework and toolset. The tool RopTool discovers ROP gadgets in ARM, X86 and X86-64 binaries by providing pre- and post-conditions for the CPU and memory context using Lua scripts. Examples of other tools that can be created with CodeReason are available in the tools/ directory.\n\n## Building\nCodeReason builds on Linux and OS X. Windows are builds currently broken. [Help us fix them](https://github.com/trailofbits/codereason/issues/32)!\n\n### Requirements\n* [LibVEX](https://github.com/trailofbits/libvex) with custom patches to support static analysis\n* [gtest](https://code.google.com/p/googletest/) for unit tests\n* [lua](http://www.lua.org/home.html) for the user interface\n* [protobuf](https://developers.google.com/protocol-buffers/)\n* [boost](http://www.boost.org/)\n* [capstone](http://www.capstone-engine.org/) for pretty printing disassembly\n\n### Ubuntu\n```\nsudo ./install_deps.sh\n./make.sh\n```\n\n### OS X\n```\nbrew update \u0026\u0026 brew install cmake boost protobuf git\n./install_vex.sh\n./make.sh\n```\n\nSeveral helper scripts are available: `install_deps.sh` installs Ubuntu dependencies, `make.sh` creates a full build, `recompile.sh` recompiles CodeReason, and `package.sh` creates a debian package. See our [Travis-CI configuration](https://github.com/trailofbits/codereason/blob/master/.travis.yml) for more details about building.\n\n## Usage\n\n### Lua scripting\nThe Lua script bindings are defined in libs/VEE/VEElua.cpp. These bindings provide a way of describing CPU register values and memory contents to the VEX Execution Engine (VEE) which analyzes binary code.\n\nThe most common functions are:\n* putreg - Writes value to a register `vee.putreg(v, R1, 32, 80808080)`\n* putmem - Writes a value at an address `vee.putmem(v, 0x40000000, 32, 0x20202020)`\n* getreg - Read value from a register `vee.getreg(v, R15, 32)`\n* getmem - Read a value from memory `vee.getmem(v, 0x40000000, 32)`\n\nFor additional examples, check the scripts/ directory.\n\n### RopTool\nRopTool takes in a binary and a Lua script as input and will output results to stdout.\n\nExample usage:\n```\n./build/bin/RopTool -a x64 -c ./scripts/x64/call_reg.lua -f ./tests/ELF/ls_x64\n```\n\n### BlockExtract\nBlockExtract reads in a binary and outputs a database file containing block information. This can be useful when analyzing large binaries that take a long time to extract code blocks. Currently only 64-bit block extraction is supported.\n\nExample usage:\n```\n./build/bin/BlockExtract -f ./tests/ELF/ls_x64 -a x64  --blocks-out ./blockdbfile\n```\n\n### BlockReader\nBlockReader consumes the block database created by BlockExtract. It may be useful when debugging information stored inside of blocks. VEX output is printed to stdout.\n\nExample usage:\n```\n./build/bin/BlockReader -d ./blockdbfile\n```\n\n### ImgTool\nImgTool is a test program that prints information about executable code sections found in a binary.\n\nExample usage:\n```\n./build/bin/ImgTool -a x64 -f ./tests/MachO/ls_FAT_x86_x64\n```\nExample output:\n```\nIn file ./tests/MachO/ls_FAT_x86_x64\nfound 6 +X sections\n------------------\nSection of arch AMD64\nbeginning at 0x1778 of size 0x3635\n------------------\nSection of arch AMD64\nbeginning at 0x4dae of size 0x1bc\n------------------\nSection of arch AMD64\nbeginning at 0x4f6c of size 0x2f4\n------------------\nSection of arch AMD64\nbeginning at 0x5260 of size 0x568\n------------------\nSection of arch AMD64\nbeginning at 0x57c8 of size 0x a0\n------------------\nSection of arch AMD64\nbeginning at 0x5868 of size 0x798\n------------------\n```\n\n## References\n[Semantic Analysis of Native Programs, introducing CodeReason](http://blog.trailofbits.com/2014/02/23/semantic-analysis-of-native-programs-introducing-codereason/)\n\n## Authors\nOriginally developed by [Andrew Ruef](https://github.com/awruef) under contract for DARPA Cyber Fast Track.\n\nContributions made by:\n* [Markus Gaasedelen](https://github.com/gaasedelen)\n* [Jay Little](https://github.com/computerality)\n* [Peter Goodman](https://github.com/pgoodman)\n* Nick Anderson\n* Santiago Torres\n* Luke Mladek\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifting-bits%2Fcodereason","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifting-bits%2Fcodereason","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifting-bits%2Fcodereason/lists"}