{"id":20373923,"url":"https://github.com/revng/crispr","last_synced_at":"2025-10-29T20:05:40.118Z","repository":{"id":91832986,"uuid":"314204710","full_name":"revng/crispr","owner":"revng","description":"The CRISPR static binary patcher","archived":false,"fork":false,"pushed_at":"2020-11-19T11:14:33.000Z","size":26,"stargazers_count":37,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T02:21:40.323Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/revng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-11-19T09:54:39.000Z","updated_at":"2024-05-24T19:18:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7e8ca64-264c-473d-87dd-0e19f51d9278","html_url":"https://github.com/revng/crispr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revng%2Fcrispr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revng%2Fcrispr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revng%2Fcrispr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/revng%2Fcrispr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/revng","download_url":"https://codeload.github.com/revng/crispr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530569,"owners_count":21119597,"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-11-15T01:21:04.512Z","updated_at":"2025-10-06T18:50:56.990Z","avatar_url":"https://github.com/revng.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CRISPR\n\nCRISPR is a tool that allows easy static binary patching.\nIt aims to support multiple architectures and binary formats.\n\nCurrently CRISPR works with x86-64 ELF binaries.\n\n## Building/installing\n\n### Step 1: CRISPR compiler\n\nFollow the instructions in `jit/README.md`\n\n### Step 2: CRISPR patcher\n\nFollow the instructions in `patcher/README.md`\n\n## Usage\n\nSay you want to patch a function `char* function_to_patch(int)` in a binary.\nFirst, write your patch, e.g. in C:\n\n```c\n#include \"stdio.h\"\n\n__attribute__((visibility(\"hidden\")))\nint preexisting_function(void);\n\n__attribute__((visibility(\"protected\")))\nchar* function_to_patch(int p) {\n    printf(\"function_to_patch (patched): Patched version of function_to_patch called!\\n\");\n    printf(\"function_to_patch (patched): Parameter value: %d\\n\", p);\n    printf(\"function_to_patch (patched): preexisting_function returns: %d\\n\", preexisting_function());\n    printf(\"function_to_patch (patched): Returning to the caller\\n\\n\");\n    return \"A totally different string from the patched function!\";\n}\n```\n\nYou need to set the visibility of functions that will be patched as `protected`, \nwhile preexisting functions need to be marked as `hidden`.\n\nThen, compile your patch:\n\n```bash\n$ clang -S -emit-llvm patch.c -fno-exceptions -fno-unwind-tables -o patch.ll\n```\n\nYou can now invoke CRISPR\n\n```bash\n$ crispr --dylib /path/to/libc.so.6 -o binary-to-patch.patched /path/to/binary-to-patch\n```\n\nIf the target binary has symbols, nothing else is needed.\nOtherwise, you can provide a CSV with additional symbols by using the `--symbols` option.\nIn this case, you would need to provide the symbol for `preexisting_function`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevng%2Fcrispr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frevng%2Fcrispr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frevng%2Fcrispr/lists"}