{"id":17383369,"url":"https://github.com/trimscash/elfmt","last_synced_at":"2025-03-27T20:49:02.050Z","repository":{"id":213819434,"uuid":"735006478","full_name":"trimscash/elfmt","owner":"trimscash","description":"Read text section bytes and format it for shellcode. based on trimscash/texthex","archived":false,"fork":false,"pushed_at":"2023-12-26T18:46:56.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T23:27:03.468Z","etag":null,"topics":["cli","elf","elf-parser","exploiting","hex-converter","readelf","shellcode","shellcode-convert","tool"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trimscash.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":"2023-12-23T10:28:59.000Z","updated_at":"2023-12-24T15:22:42.000Z","dependencies_parsed_at":"2023-12-26T20:43:06.957Z","dependency_job_id":null,"html_url":"https://github.com/trimscash/elfmt","commit_stats":null,"previous_names":["trimscash/elfmt"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trimscash%2Felfmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trimscash%2Felfmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trimscash%2Felfmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trimscash%2Felfmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trimscash","download_url":"https://codeload.github.com/trimscash/elfmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245924493,"owners_count":20694728,"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":["cli","elf","elf-parser","exploiting","hex-converter","readelf","shellcode","shellcode-convert","tool"],"created_at":"2024-10-16T07:41:24.529Z","updated_at":"2025-03-27T20:49:02.027Z","avatar_url":"https://github.com/trimscash.png","language":"Rust","readme":"# elfmt\nRead text section bytes and format it for shellcode.\n\n![image](https://github.com/trimscash/elfmt/assets/42578480/47c7bf0d-bb58-4dc4-8e7b-8d7f1cbc7759)\n\n![image](https://github.com/trimscash/elfmt/assets/42578480/fc4daf84-8279-452c-93c3-5f938e9b5832)\n\n# Setup\n```\ngit clone https://github.com/trimscash/elfmt ~\ncd elfmt\ncargo build -r\necho \"export PATH=\\$PATH:\\$HOME/elfmt/target/release\" \u003e\u003e ~/.zshrc\nsource ~/.zshrc\n```\nand use it. \nReplace .zshrc with the one you are using\n\n# Usage\n```\nRead text section bytes and format it.\nWithout option, it just print text section bytes.\n\nUsage: elfmt [OPTIONS] \u003cFILE\u003e\n\nArguments:\n  \u003cFILE\u003e  \n\nOptions:\n  -s, --string-mode       Ex: \\x55\\x48\\x89\\xe5\\x48\n  -a, --array-mode        Ex: 0x55, 0x48, 0x89, 0xe5, 0x48\n  -p, --python-mode       Ex: python3 -c 'import sys; sys.stdout.buffer.write(b\"\\x55\\x48\\x89\\xe5\\x48\")'\n  -d, --disassemble-mode  Ex:\n                          push rbp\n                          mov rbp,rsp\n                          mov rax,3Bh\n                          ...\n  -w, --write-mode        Direct stdout. If you choose this option, other option will be ignore\n  -h, --help              Print help\n```\n\n# Example\n```\n$ elfmt test.elf\n554889e548c7c03b000000488d3c2524104000488d3425361040006a004889e20f05c9c32f62696e2f6361740063617400666c6167002d1040000000000031104000000000000000000000000000\n```\n\n```\n$ elfmt test.elf -aspd\n\\x55\\x48\\x89\\xe5\\x48\\xc7\\xc0\\x3b\\x00\\x00\\x00\\x48\\x8d\\x3c\\x25\\x24\\x10\\x40\\x00\\x48\\x8d\\x34\\x25\\x36\\x10\\x40\\x00\\x6a\\x00\\x48\\x89\\xe2\\x0f\\x05\\xc9\\xc3\\x2f\\x62\\x69\\x6e\\x2f\\x63\\x61\\x74\\x00\\x63\\x61\\x74\\x00\\x66\\x6c\\x61\\x67\\x00\\x2d\\x10\\x40\\x00\\x00\\x00\\x00\\x00\\x31\\x10\\x40\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\n\n0x55, 0x48, 0x89, 0xe5, 0x48, 0xc7, 0xc0, 0x3b, 0x00, 0x00, 0x00, 0x48, 0x8d, 0x3c, 0x25, 0x24, 0x10, 0x40, 0x00, 0x48, 0x8d, 0x34, 0x25, 0x36, 0x10, 0x40, 0x00, 0x6a, 0x00, 0x48, 0x89, 0xe2, 0x0f, 0x05, 0xc9, 0xc3, 0x2f, 0x62, 0x69, 0x6e, 0x2f, 0x63, 0x61, 0x74, 0x00, 0x63, 0x61, 0x74, 0x00, 0x66, 0x6c, 0x61, 0x67, 0x00, 0x2d, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x10, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n\npython3 -c 'import sys; sys.stdout.buffer.write(b\"\\x55\\x48\\x89\\xe5\\x48\\xc7\\xc0\\x3b\\x00\\x00\\x00\\x48\\x8d\\x3c\\x25\\x24\\x10\\x40\\x00\\x48\\x8d\\x34\\x25\\x36\\x10\\x40\\x00\\x6a\\x00\\x48\\x89\\xe2\\x0f\\x05\\xc9\\xc3\\x2f\\x62\\x69\\x6e\\x2f\\x63\\x61\\x74\\x00\\x63\\x61\\x74\\x00\\x66\\x6c\\x61\\x67\\x00\\x2d\\x10\\x40\\x00\\x00\\x00\\x00\\x00\\x31\\x10\\x40\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\")'\n\npush rbp\nmov rbp,rsp\nmov rax,3Bh\nlea rdi,[401024h]\nlea rsi,[401036h]\npush 0\nmov rdx,rsp\nsyscall\nleave\nret\n(bad)\nimul ebp,[rsi+2Fh],746163h\nmovsxd esp,[rcx+74h]\nadd [rsi+6Ch],ah\n(bad)\nadd [rel 404Bh],ch\nadd [rax],al\nadd [rcx],dh\nadc [rax],al\nadd [rax],al\nadd [rax],al\nadd [rax],al\nadd [rax],al\nadd [rax],al\nadd [rax],al\n```\n\n```\n$ texthex test.elf -w\nUH��H��;H�\u003c%$\u0010@H�4%6\u0010@jH��\u0005��/bin/catcatflag-\u0010@1\u0010@\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrimscash%2Felfmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrimscash%2Felfmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrimscash%2Felfmt/lists"}