{"id":15010955,"url":"https://github.com/raehik/bytepatch","last_synced_at":"2025-04-09T18:40:22.815Z","repository":{"id":38443479,"uuid":"434382142","full_name":"raehik/bytepatch","owner":"raehik","description":"Patch data (text, bytes, assembly) in a file using a convenient, flexible schema","archived":false,"fork":false,"pushed_at":"2024-08-11T15:34:04.000Z","size":214,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T17:31:20.620Z","etag":null,"topics":["binary-data","haskell","json","patching","reverse-engineering"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/raehik.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-12-02T21:37:14.000Z","updated_at":"2024-03-22T02:06:08.000Z","dependencies_parsed_at":"2025-02-15T13:32:49.048Z","dependency_job_id":"1c4a488e-9058-45c5-bfd1-5590374a4813","html_url":"https://github.com/raehik/bytepatch","commit_stats":{"total_commits":93,"total_committers":1,"mean_commits":93.0,"dds":0.0,"last_synced_commit":"52e86c0a25dd40b9695aec2bb866d358b0a59609"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raehik%2Fbytepatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raehik%2Fbytepatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raehik%2Fbytepatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raehik%2Fbytepatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raehik","download_url":"https://codeload.github.com/raehik/bytepatch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248089682,"owners_count":21045949,"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":["binary-data","haskell","json","patching","reverse-engineering"],"created_at":"2024-09-24T19:37:49.371Z","updated_at":"2025-04-09T18:40:22.793Z","avatar_url":"https://github.com/raehik.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bytepatch\nA Haskell library and CLI tool for writing declarative patches over streams.\nWrite **patchscripts** (in-place edits to a file) using a configurable YAML\nschema, and apply them with a safe patching algorithm. On the library side,\ndefine patches of various forms over any type, apply them to pure/impure\nstreams, and write further patch data types and streams to extend as you like.\n\nbytepatch works with many data types:\n\n  * read pretty binary `00 FF 1234`, parse to bytes\n  * read text, re-encode, null-terminate to generate a C-style string\n  * read assembly, assemble down to machine code\n\nThe schema itself is highly configurable:\n\n  * align: add a value (set in patch file) to each patch offset\n  * compare: bytepatch can check expected data against actual during patching,\n    to assert that you're patching the expected file. You can select how this\n    check works: compare equality (exact, or match prefix), hashes\n  * seek type: what the patch offsets mean. You'll likely want absolute\n    offsets - but you may also write them as linear offsets, forward from the\n    previous.\n\nYou may also ask bytepatch to *compile* a patchscript, which reads it and then\noutputs a YAML file with a simplified schema: pre-aligned, compare via hashes,\nforward seeks.\n\nThe bytepatch executable aims to be a general tool for reverse engineers, hoping\nto make simple binary \u0026 assembly editing more manageable. The Haskell library is\nquite sprawling, and has personally made for a fun investigation into type-level\nHaskell.\n\n## What?\nIf you're modifying binaries, you often end up needing to make edits in a hex\neditor. This is fun for a very short while, then you realise how easy it is to\nmess up.\n\nbytepatch is primarily intended as a developer tool for writing a\n*human-friendly static patchscript*. It provides a nice schema for defining\nedits to a binary file, so that developers can read and write patches in a\nstructured, readable format. If one wanted, they could very easily read the\npatch file and use it to make the changes manually (though bytepatch wants to do\nthis for you).\n\nbytepatch is not aimed at replacing binary patch tools such as IPS, BPS: these\ntake an input and a result file, and generate a patch file that can be applied\nto the input in order to recreate the result. You need the result file in the\nfirst place. These tools both generate the patch file and apply it; bytepatch\nonly applies the patch file, and leaves the writing to the user.\n\n## When might I want to use this?\nYou might find bytepatch useful if you want to define edits to be made on binary\nfiles (especially executables) that are *static* and *in-place*. Examples are:\n\n  * instruction patching (via assembly)\n  * string patching (via text)\n\n### Less relevant use cases\nYou can't use bytepatch directly for edits which are dynamic in nature (e.g.\nyou need to read a file header in order to know what to change). *(You could\nhave a patch preparer that does the dynamic work and emits a bytepatch patch,\nbut this tool is largely focused the patch representation, so you wouldn't be\ngaining much.)*\n\nYou can't use bytepatch to make edits that aren't in-place. Edits are located\nusing stream offsets. Allowing edits to change the length of the segment they\nreplace would introduce issues for following edits: do we use the original\noffset, or do we implicitly shift them so they still write to the \"same place\"?\nThere *is* some support in the library for such edits, however, and it would be\ninteresting to explore.\n\n## License\nProvided under the MIT license. Please see `LICENSE` for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraehik%2Fbytepatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraehik%2Fbytepatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraehik%2Fbytepatch/lists"}