{"id":21845255,"url":"https://github.com/entysec/hatasm","last_synced_at":"2025-04-14T13:13:07.120Z","repository":{"id":43876905,"uuid":"450385233","full_name":"EntySec/HatAsm","owner":"EntySec","description":"HatAsm is a powerful assembler and disassembler that provides support for all common architectures.","archived":false,"fork":false,"pushed_at":"2025-01-24T22:15:48.000Z","size":373,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:22:10.123Z","etag":null,"topics":["arm","assembler","assembler-implementation","assembler-x86","assembly","assembly-arm","assembly-mips","assembly-x86","assembly-x86-64","compiler","intel","mips","payload","shellcode","x86","x86-64"],"latest_commit_sha":null,"homepage":"https://entysec.com","language":"Python","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/EntySec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"entysec"}},"created_at":"2022-01-21T06:52:35.000Z","updated_at":"2025-01-24T22:15:52.000Z","dependencies_parsed_at":"2024-08-07T23:26:37.106Z","dependency_job_id":null,"html_url":"https://github.com/EntySec/HatAsm","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/EntySec%2FHatAsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EntySec%2FHatAsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EntySec%2FHatAsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EntySec%2FHatAsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EntySec","download_url":"https://codeload.github.com/EntySec/HatAsm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886328,"owners_count":21177644,"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":["arm","assembler","assembler-implementation","assembler-x86","assembly","assembly-arm","assembly-mips","assembly-x86","assembly-x86-64","compiler","intel","mips","payload","shellcode","x86","x86-64"],"created_at":"2024-11-27T23:08:46.910Z","updated_at":"2025-04-14T13:13:07.087Z","avatar_url":"https://github.com/EntySec.png","language":"Python","readme":"\u003ch3 align=\"left\"\u003e\n    \u003cimg src=\"https://github.com/enty8080/HatAsm/blob/main/data/logo.png\" alt=\"logo\" height=\"250px\"\u003e\n\u003c/h3\u003e\n\n[![Developer](https://img.shields.io/badge/developer-EntySec-blue.svg)](https://entysec.com)\n[![Language](https://img.shields.io/badge/language-Python-blue.svg)](https://github.com/EntySec/HatAsm)\n[![Forks](https://img.shields.io/github/forks/EntySec/HatAsm?style=flat\u0026color=green)](https://github.com/EntySec/HatAsm/forks)\n[![Stars](https://img.shields.io/github/stars/EntySec/HatAsm?style=flat\u0026color=yellow)](https://github.com/EntySec/HatAsm/stargazers)\n[![CodeFactor](https://www.codefactor.io/repository/github/EntySec/HatAsm/badge)](https://www.codefactor.io/repository/github/EntySec/HatAsm)\n\nHatAsm is a powerful assembler and disassembler that provides support for all common architectures.\n\n## Features\n\n* Assembler and disassembler both available in one tool.\n* Support for most common architectures (e.g **x64**, **x86**, **aarch64**, **armle**, **mipsle**, **mipsbe**, etc).\n* Ability to assemble code right into the byte code or pack into an executable (e.g. **ELF**, **Mach-O**, **PE**).\n\n## Installation\n\n```shell\npip3 install git+https://github.com/EntySec/HatAsm\n```\n\n## Examples\n\n### Assemble\n\n```python3\nfrom hatasm import HatAsm\n\nhatasm = HatAsm()\ncode = \"\"\"\nstart:\n    mov al, 0xa2\n    syscall\n\n    mov al, 0xa9\n    mov edx, 0x1234567\n    mov esi, 0x28121969\n    mov edi, 0xfee1dead\n    syscall\n\"\"\"\n\nresult = hatasm.assemble('x64', code)\n\nfor line in hatasm.hexdump(result):\n    print(line)\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eResult\u003c/summary\u003e\u003cbr\u003e\n    \u003cpre\u003e\n00000000  b0 a2 0f 05 b0 a9 ba 67  45 23 01 be 69 19 12 28 |.......gE#..i..(|\n00000010  bf ad de e1 fe 0f 05                             |.......         |\u003c/pre\u003e\n\u003c/details\u003e\n\n## Disassemble\n\n```python3\nfrom hatasm import HatAsm\n\nhatasm = HatAsm()\ncode = (\n    b\"\\xb0\\xa2\\x0f\\x05\\xb0\\xa9\\xba\\x67\\x45\\x23\\x01\\xbe\"\n    b\"\\x69\\x19\\x12\\x28\\xbf\\xad\\xde\\xe1\\xfe\\x0f\\x05\"\n)\n\nfor line in hatasm.disassemble('x64', code):\n    print(line.mnemonic, line.op_str)\n```\n\n\u003cdetails\u003e\n    \u003csummary\u003eResult\u003c/summary\u003e\u003cbr\u003e\n    \u003cpre\u003e\nmov al, 0a2h\nsyscall\nmov al, 0a9h\nmov edx, 1234567h\nmov esi, 28121969h\nmov edi, 0fee1deadh\nsyscall\u003c/pre\u003e\n\u003c/details\u003e\n\n## HatAsm CLI\n\nHatAsm also has its own command line interface that can be invoked by executing `hatasm` command:\n\n```\nusage: hatasm [-h] [--arch ARCH] [--mode MODE] [--syntax SYNTAX] [-i INPUT]\n              [-o OUTPUT] [-a] [-d] [-e] [-f FORMAT] [--formats]\n\nHatAsm is a powerful assembler and disassembler that provides support for all\ncommon architectures.\n\noptions:\n  -h, --help            show this help message and exit\n  --arch ARCH           Architecture to assemble or disassemble for.\n  --mode MODE           Architecture mode (for example - arm/thumb).\n  --syntax SYNTAX       Assembler/Disassembler syntax (for example -\n                        intel/att).\n  -i INPUT, --input INPUT\n                        Input file for assembler or disassembler.\n  -o OUTPUT, --output OUTPUT\n                        Output file to write output.\n  -a, --assemble        Launch HatAsm assembler.\n  -d, --disassemble     Launch HatAsm disassembler.\n  -e, --emulate         Emulate assembled code (use with -a).\n  -f FORMAT, --format FORMAT\n                        Output file format (e.g. elf, macho, pe).\n  --formats             Display all available formats.\n  \n```\n\n### Examples\n\n```\nhatasm -a --arch x64\n```\n\nRun interactive assembler shell for **x64** architecture.\n\n```\nhatasm % nop\n00000000  90                                               |.               |\nhatasm % start:\n........     xor rax, rax\n........     cdq\n........     nop\n........     \n00000000  48 31 c0 99 90                                   |H1...           |\nhatasm %\n```\n\nWrite macOS **x64** execve() /bin/sh shellcode from command-line.\n\n```\nhatasm % start:\n........     xor rax, rax\n........     cdq\n........     push rax\n........     mov rdi, 0x68732f6e69622f2f\n........     push rdi\n........     push rsp\n........     pop rdi\n........     xor rsi, rsi\n........     mov al, 0x2\n........     ror rax, 0x28\n........     mov al, 0x3b\n........     syscall\n........\n00000000  48 31 c0 99 50 48 bf 2f  2f 62 69 6e 2f 73 68 57 |H1..PH.//bin/shW|\n00000010  54 5f 48 31 f6 b0 02 48  c1 c8 28 b0 3b 0f 05    |T_H1...H..(.;.. |\nhatasm %\n```\n","funding_links":["https://github.com/sponsors/entysec"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentysec%2Fhatasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fentysec%2Fhatasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentysec%2Fhatasm/lists"}