{"id":13729632,"url":"https://github.com/crytic/pyevmasm","last_synced_at":"2025-04-05T09:08:32.109Z","repository":{"id":32739567,"uuid":"138043275","full_name":"crytic/pyevmasm","owner":"crytic","description":"Ethereum Virtual Machine (EVM) disassembler and assembler","archived":false,"fork":false,"pushed_at":"2024-05-29T14:38:40.000Z","size":151,"stargazers_count":370,"open_issues_count":18,"forks_count":48,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-30T05:32:16.565Z","etag":null,"topics":["assembler","dissassembler","ethereum","evm","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crytic.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":"2018-06-20T14:21:51.000Z","updated_at":"2025-03-15T19:22:16.000Z","dependencies_parsed_at":"2024-01-13T10:12:09.839Z","dependency_job_id":"a3950473-1f28-45f9-811d-5bfc33f6c6b5","html_url":"https://github.com/crytic/pyevmasm","commit_stats":null,"previous_names":["trailofbits/pyevmasm"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crytic%2Fpyevmasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crytic%2Fpyevmasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crytic%2Fpyevmasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crytic%2Fpyevmasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crytic","download_url":"https://codeload.github.com/crytic/pyevmasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598153,"owners_count":20802973,"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":["assembler","dissassembler","ethereum","evm","python"],"created_at":"2024-08-03T02:01:03.161Z","updated_at":"2025-04-05T09:08:31.956Z","avatar_url":"https://github.com/crytic.png","language":"Python","readme":"# pyevmasm\n[![Build Status](https://github.com/crytic/pyevmasm/workflows/CI/badge.svg)](https://github.com/crytic/pyevmasm/actions?query=workflow%3ACI)\n\n[![PyPI version](https://badge.fury.io/py/pyevmasm.svg)](https://badge.fury.io/py/pyevmasm)\n[![Slack Status](https://slack.empirehacking.nyc/badge.svg)](https://slack.empirehacking.nyc)\n\npyevmasm is an assembler and disassembler library for the Ethereum Virtual Machine (EVM). It includes a commandline utility and a Python API.\n\n## CLI Examples with evmasm\n\n`evmasm` is a commandline utility that uses pyevmasm to assemble or disassemble EVM:\n\n```\nusage: evmasm [-h] (-a | -d | -t) [-bi] [-bo] [-i [INPUT]] [-o [OUTPUT]] [-f FORK]\n\npyevmasm the EVM assembler and disassembler\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -a, --assemble        Assemble EVM instructions to opcodes\n  -d, --disassemble     Disassemble EVM to opcodes\n  -t, --print-opcode-table\n                        List supported EVM opcodes\n  -bi, --binary-input   Binary input mode (-d only)\n  -bo, --binary-output  Binary output mode (-a only)\n  -i [INPUT], --input [INPUT]\n                        Input file, default=stdin\n  -o [OUTPUT], --output [OUTPUT]\n                        Output file, default=stdout\n  -f FORK, --fork FORK  Fork, default: byzantium. Possible: frontier,\n                        homestead, tangerine_whistle, spurious_dragon,\n                        byzantium, constantinople, serenity. Also an unsigned\n                        block number is accepted to select the fork.\n```\n\nDisassembling the preamble of compiled contract:\n\n```\n$ echo -n \"608060405260043610603f57600035\" | evmasm -d\n00000000: PUSH1 0x80\n00000002: PUSH1 0x40\n00000004: MSTORE\n00000005: PUSH1 0x4\n00000007: CALLDATASIZE\n00000008: LT\n00000009: PUSH1 0x3f\n0000000b: JUMPI\n0000000c: PUSH1 0x0\n0000000e: CALLDATALOAD\n```\n\n## Python API Examples\n\n```\n\u003e\u003e\u003e from pyevmasm import instruction_tables, disassemble_hex, disassemble_all, assemble_hex\n\u003e\u003e\u003e instruction_table = instruction_tables['byzantium']\n\u003e\u003e\u003e instruction_table[20]\nInstruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)\n\u003e\u003e\u003e instruction_table['EQ']\nInstruction(0x14, 'EQ', 0, 2, 1, 3, 'Equality comparision.', None, 0)\n\u003e\u003e\u003e instrs = list(disassemble_all(binascii.unhexlify('608060405260043610603f57600035')))\n\u003e\u003e\u003e instrs.insert(1, instruction_table['JUMPI'])\n\u003e\u003e\u003e a = assemble_hex(instrs)\n\u003e\u003e\u003e a\n'0x60805760405260043610603f57600035'\n\u003e\u003e\u003e print(disassemble_hex(a))\nPUSH1 0x80\nJUMPI\nPUSH1 0x40\nMSTORE\n...\n\u003e\u003e\u003e assemble_hex('PUSH1 0x40\\nMSTORE\\n')\n'0x604052'\n```\n\n# Installation\n\nPython \u003e=2.7 or Python \u003e=3.3 is required.\n\nInstall the latest stable version using pip:\n```\npip install pyevmasm\n```\n\nOr, install the library from source:\n```\ngit clone https://github.com/trailofbits/pyevmasm\ncd pyevmasm\npython setup.py install --user\n```\n\n## Documentation\n\n[https://pyevmasm.readthedocs.io](https://pyevmasm.readthedocs.io)\n\nNew issues, feature requests, and contributions are welcome. Join us in #ethereum channel on the [Empire Hacking Slack](https://slack.empirehacking.nyc) to discuss Ethereum security tool development.\n","funding_links":[],"categories":["EVM","dApps directory"],"sub_categories":["Cairo","Assemblers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrytic%2Fpyevmasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrytic%2Fpyevmasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrytic%2Fpyevmasm/lists"}