{"id":29101942,"url":"https://github.com/tyilo/ineffective_hooker","last_synced_at":"2025-07-06T16:04:43.364Z","repository":{"id":21245774,"uuid":"24561233","full_name":"tyilo/ineffective_hooker","owner":"tyilo","description":"Lets you replace a functions implementation with another function which can call the original function normally","archived":false,"fork":false,"pushed_at":"2014-12-25T16:20:27.000Z","size":200,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-28T21:09:04.608Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyilo.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}},"created_at":"2014-09-28T14:21:07.000Z","updated_at":"2024-10-10T07:29:00.000Z","dependencies_parsed_at":"2022-08-18T05:10:37.971Z","dependency_job_id":null,"html_url":"https://github.com/tyilo/ineffective_hooker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tyilo/ineffective_hooker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyilo%2Fineffective_hooker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyilo%2Fineffective_hooker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyilo%2Fineffective_hooker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyilo%2Fineffective_hooker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyilo","download_url":"https://codeload.github.com/tyilo/ineffective_hooker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyilo%2Fineffective_hooker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262685445,"owners_count":23348423,"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":"2025-06-28T21:08:53.563Z","updated_at":"2025-07-06T16:04:43.341Z","avatar_url":"https://github.com/tyilo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"ineffective_hooker\n==================\n\nSimilar to [mach_override](https://github.com/rentzsch/mach_override) and [rd_route](https://github.com/rodionovd/rd_route)\n\nLets you replace a functions implementation with another function which can call the original function normally.\n\nExample usage\n-------------\n\n```\n#include \u003cstdio.h\u003e\n#include \"hooker.h\"\n\nint foo(void) {\n\treturn 1;\n}\n\nint my_foo(void) {\n\treturn foo() + 1;\n}\n\nint main(void) {\n\tprintf(\"%d\\n\", foo()); // 1\n\thook(foo, my_foo, NULL, NULL);\n\tprintf(\"%d\\n\", foo()); // 2\n}\n```\n\nUsing other hooking libraries such as mach_override or rd_route you would get back a reference to the original function which then must be used inside the replacement function.\n\nThis is not required (or possible) with ineffecitive_hooker.\n\nHow it works\n------------\n\nineffecitive_hooker works by replacing the original function with some self-modifying code that does the following every time the original function is called:\n\n- puts the original function's code back in place\n- calls the replacement function (which might call the original function)\n- puts the hooking code back instead of the original function\n\nThe reason this code is so ineffective is that instead of requiring a few more instructions to be executed like other libraries, it makes the code run a couple of thousand more instructions instead.\n\nCaveats\n-------\n\n- Only supports x86_64 and i368 architectures.\n- When hooking a function the first 13 bytes for x86_64 or 6 bytes for i368 will be overwritten. If the function is smaller than that other data/functions might be overwritten.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyilo%2Fineffective_hooker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyilo%2Fineffective_hooker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyilo%2Fineffective_hooker/lists"}