{"id":24182902,"url":"https://github.com/codesteak/self-modifying-elf-prototype","last_synced_at":"2026-06-09T15:04:07.171Z","repository":{"id":72817341,"uuid":"173325199","full_name":"CodeSteak/self-modifying-elf-prototype","owner":"CodeSteak","description":"This is a **prototype/experiment** for an self modifying executable. ","archived":false,"fork":false,"pushed_at":"2019-03-01T18:25:32.000Z","size":111,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T21:32:46.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/CodeSteak.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-01T15:31:20.000Z","updated_at":"2021-08-30T13:02:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"7386ca0a-2b0e-4a6b-bcd2-387b11990ff8","html_url":"https://github.com/CodeSteak/self-modifying-elf-prototype","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodeSteak/self-modifying-elf-prototype","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSteak%2Fself-modifying-elf-prototype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSteak%2Fself-modifying-elf-prototype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSteak%2Fself-modifying-elf-prototype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSteak%2Fself-modifying-elf-prototype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeSteak","download_url":"https://codeload.github.com/CodeSteak/self-modifying-elf-prototype/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSteak%2Fself-modifying-elf-prototype/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34112225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-01-13T08:29:13.478Z","updated_at":"2026-06-09T15:04:07.150Z","avatar_url":"https://github.com/CodeSteak.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Self Modifying Binary\n\n## What is this?\nThis is a **prototype / experiment** for an self modifying executable. It's inspired by\n[tiddlywiki](https://tiddlywiki.com/). Instead of having a separat executable\nand some files containing data, all data are appended to the executable.\n\n---\n\n## What can it do?\n  * You can dynamically add plugins. (It does IPC).\n  * You can bundle executables with their dynamic libraries.\n\n### Commands\n#### Add\nAdds data to the executable. Each entry has some content, an name, an some tags\nwith optional string values.\n  * You can add files\n    `./microwiki add file --name \"My Cat\" cat-pic.png --tag lol --tag rating=5`\n  * You can add tags to existing entries.\n    `./microwiki add tag \"My Cat\" \"Cat-Pics\"`\n  * You can add executables or plugins.\n    `./microwiki add elf ${which nano} --name nano`\n    And run them via `microwiki nano`. (Dynamic libraries are bundled).\n\n#### Web\nThis starts a half backed web ui for managing entries und tags. Only text\nentries are supported.\n\n#### Export\nThis is used for bootstrapping.\n`./microwiki export -o microwiki.new \u0026\u0026 chmod +x microwiki.new` can be used\nto clone the executable. Then this done, the new executable is garbage\ncollected. This may be necessary because data in the executable is append only.\n\n### Special Tags\nThe `type`-tag is used to mark the type of an entry. The value of this tag\nshould be the file extension of the content. For Elf-Binaries `elf` is used.\nFor text `text` should be used.\n\nWhen `microwiki` is run, the first argument is used to determene what\nplugin/executable to run. For an entry to be selected, the `type` tag must be\n`elf` and the `command` tag must equal the first command line argument.\n\nThe value of `lib` specifies a dynamic library to use. Multiple `lib` can\nbe used for a single entry. If none is set is `LD_LIBRARY_PATH` overwritten.\n\nEvery entry with the `web/style` is added as css when displaying an entry\nvia the `web` plugin. Similarly, `web/script` is included as javascript.\n\n### Environment variables\nWhen `OVERLAY` is provided, microwiki scans the directory for `*.entry` files\nwhich are then loaded. _See entry files in repo._ This is used for bootstrapping.\n\nWhen `OVERLAY` and `OVERLAY_WATCH` is provided, microwiki watches for changes\nin the `OVERLAY_WATCH`, to reload the entry files in `OVERLAY_WATCH` and restart\nthe current plugin/command.\n\nIf `USE_STRIP` is set and `#cargo` is used in an entry file, the executable\ngets stripped before loading.\n\nIf `USE_UPX` is set and `#cargo` is used in an entry file, the executable\ngets compressed via upx before loading.\n\n---\n\n## Building\nThis runs only on linux.\nSince some bootstrapping is needed, `build.sh` can be used to build the\nexecutable. For building ~~`rust`~~ `cargo`, `clang`, `gnu-binutils` and `upx` are required.\nThe executable can be found at `out/microwiki`.\n\nOr run in debug mode with `OVERLAY=\".\" cargo run -p microwiki`.\n\n---\n\n## Known Bugs\n   * Web ui can't handle binary data.\n   * If `OVERLAY` used the dynamic libraries in `/tmp` are not deleted after the\n      programm exits.\n   * If you run `strip` on `out/microwiki` all data and the main programm is\n     deleted, since it's only append. Only the loader _(See loader/)_ is left.\n---\n\n## Lessons learned\n  * Rust web libraries are not major enough or too complicated because of\n    missing async/await.\n  * Set a clear focus for a project like this.\n    I'm still unsure what this is.\n  * Reuse and integrate existing software.\n    E.g. instead of building a web ui, a tiddywiki plugin could have been written.\n\n### That programms like this could be useful for\n  * Exporting a single executable.    Like  shipping\n    scripts + payload + interpreter in one executable.\n  * Building a persistent REPL.\n  * Making a tiddywiki server thing like [TiddlyServer](https://github.com/Arlen22/TiddlyServer)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesteak%2Fself-modifying-elf-prototype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesteak%2Fself-modifying-elf-prototype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesteak%2Fself-modifying-elf-prototype/lists"}